Interactive job sessions are useful for when you need to compile software, test jobs and scripts or run software that requires keyboard inputs and user interaction.
The basic command for an interactive session is below:
>srun -p sb.q -I -N 1 -c 1 --pty -t 0-00:05 /bin/bash
The above command launches an interactive session on sb.q partition using 1 node and 1 core for 5 minutes executing bash shell. The important flags that must be present for an interactive session to work are: -p to specify which partition this session should run in, -I to tell the scheduler to run this immediately and not place it in the queue (if there are no resources this will not run), –pty tells SLURM to drop you in an ssh session to the node your session is scheduled on, -t sets the amount of time your session should run for, and finally the very last thing is a command to run and usually for an interactive session you want a shell of some type so in the above we have indicated a bash shell.
Sometimes you want to run application that have a GUI interface and for those case X11 is required and we must pass-through an authenticated X11 session for the login node to your interactive session on a compute node. The following steps are required:
Login like this from Linux or a Mac terminal.
>ssh -Y YourUHusername@uhhpc1.its.hawaii.edu
>srun.x11 -p sb.q -N 1 -c 1 -t 0-00:30
Note that we don’t need –pty as above or a shell command at the end since the “srun.x11” command takes care of that. Once in your interactive session you can launch software that has a GUI the same way you would launch if from the command line elsewhere.
Firefox for instance:
We use the “&” at the end so that the GUI task runs in the background and we can continue to use the terminal to run other commands – such as ipython for example which require firefox. If you leave the “&” off the terminal will wait for firefox or what other command you have issues to complete before allow you to input any other commands.