# Starting Interactive Jobs

Though batch submission is the best way to take full advantage of the compute power of the Grid, foreground, interactive jobs can also be run. These can be useful for things like:

• RAM intensive graphical applications like MATLAB or SAS
• Iterative data exploration at the command line
• Interactive "console tools" like R and iPython
• Significant code development and compiling efforts

An interactive job differs from a batch job in two important aspects: 1) the queue to be used is interactive and, 2) jobs should be initiated with the bsub command, but need to include the -Is option to indicate an interactive shell. This command:

bsub -q interactive -Is -W 6:00 -R "rusage[mem=500]" /bin/bash

will start a command line shell (/bin/bash) on the interactive queue with 500 MB RAM for 6 hours; 1 core (CPU) on 1 node is assumed as these parameters (-n 1) were left out. When the interactive session starts, you will notice that you are no longer on a login node, but rather one of the compute nodes dedicated to this queue. The -Is option allows the session to act like a standard terminal. In a pinch, you can also run an application directly though this is discouraged due to problems setting up bash environment variables. After setting the PATH for MATLAB, you can start the application with the following command:

bsub -q interactive -Is -W 6:00 -R "rusage[mem=4000]" matlab

In this case, we've asked for more memory because of the larger MATLAB footprint. The interactive queue requires that you actually interact with the session. If you have interactive tasks that must stretch over days, you can use NoMachine, or you may be able to use the GNU Screen or tmux utility to prevent the termination of a session when you disconnect (e.g. closing your terminal or closing your laptop). Both are already installed on the compute grid, and brief tutorials of screen and tmux are easily found by Google.