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.  This is specified by short_int or log_int,

2) jobs should be initiated with the bsub command, but need to include the -Ip option to indicate an interactive shell. This command:

    bsub -q short_int -Ip -W 6:00 -R "rusage[mem=500]" -M 500 -hl /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 -Ip option allows the session to act like a standard terminal. In a pinch, you can also specify an application directly (instead of /bin/bash), though this is discouraged due to problems setting up bash environment variables. For example, after setting the PATH for MATLAB, you can start the application with the following command:

    bsub -q short_int -Ip -W 6:00 -R "rusage[mem=4000]" -M 4000 -hl 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.

If your interactive job stretches over a day please consider using our new offering of long-interactive sessions instead.  An example command for the long interactive session could be:

    bsub -q long_int -Ip -R "rusage[mem=2000]" -M 2000 -hl matlab

Note that if one does not specify a time, the job can run for the max queue length time; at the end of that time, the job will be terminated by the scheduler.

Ending interactive sessions: It is best practice to explicitly end your interactive sessions by issues the exit or quit command (shell sessions), or pressing Ctrl-d (GUI sessions). This not only exits your sessions but also free up the reserved resources for other people to use.

Last Updated 2/19/2019