Interactive Computing with srun

Interactive Job Support on MSI Systems for Immediate Task Execution

Each of MSI’s systems that support batch job submission also support interactive jobs. Interactive jobs are useful for tasks that need immediate feedback, including data exploration, script development, or visualization (e.g., with the X11 graphics system).

The command used to submit an interactive job is ‘srun.’ An example is shown below:

srun -N 1 --ntasks-per-node=4  --mem-per-cpu=1gb -t 1:00:00 -p interactive --pty bash 

This command will request 1 node (-N 1), 4 tasks on the node (--ntasks-per-node=4), a total of 4GB of memory (--mem-per-cpu=1gb, with 4 CPUs), and 1 hour of walltime (-t 1:00:00) in the interactive partition (-p interactive) running a bash shell (--pty bash).

If you plan to use the X11 graphical system in your interactive job, then you should connect to the login node with X11 forwarding, and add the ‘--x11’ option to ‘srun’ as follows:

srun -N 1 --ntasks-per-node=4 --mem-per-cpu=1gb -t 1:00:00 -p interactive --x11 --pty bash 

To request multiple nodes, for instance to test MPI code between nodes, change the value of the -N option. In this example we request two nodes:

srun -N 2 --ntasks-per-node=1 --mem-per-cpu=1gb -t 1:00:00 -p interactive --pty bash 

To request a GPU, add the ‘--gres=gpu:’ option and use the ‘interactive-gpu’ partition. This command requests one core of a K40 GPU:

srun -N 1 --ntasks-per-node=1 --mem-per-cpu=1gb -t 1:00:00 -p interactive-gpu --gres=gpu:k40:1 --pty bash

Example interactive srun Session

username@mydesktop$ ssh -Y
Last login: Tue May 10 15:16:06 2018 from
           University of Minnesota Supercomputing Institute
                       HP Haswell Linux Cluster
[... output truncated ...]
username@ln0006 [~] % srun -N 2 --ntasks-per-node=1  --mem-per-cpu=1gb --x11 -t 1:00:00 --pty bash
username@cn0001 [~] % 
username@cn0001 [~] % echo $SLURM_JOB_NODELIST
username@cn0001 [~] %

Note that this interactive job is using two nodes (-N 2). At this point you are currently in your home directory, and can load modules and launch software, including GUI software.

For more information on srun, here is the official documentation.

Discover Advanced Computing and Data Solutions at MSI

Our Services