Skip to content

Interactive Terminal Sessions on Compute Nodes

Picotte

Run a Shell

Use srun to request an interactive shell:

[juser@picotte001 ~]$ srun --nodes=1 --cpus-per-task=48 --mem=32G --time=00:15:00 --pty /bin/bash -l
[juser@node002 ~]$

640px

Temporary Directory

When requesting more than one task, i.e. --ntasks-per-node=N where N > 1, the TMP directory is not automatically created by srun. Check by doing:

[juser@node002 ~]$ ls -ld $TMP
/bin/ls: cannot access '/local/scratch/12345': No such file or directory

In that case, create the directory:

[juser@node002 ~]$ mkdir $TMP
[juser@node002 ~]$ ls -ld $TMP
drwxrwxr-x 2 juser juser 6 Mar 22 17:21 /local/scratch/12345

A better solution is to request only one task (or just omit the specification since the default is 1), and specify only "--cpus-per-task".

Run a Terminal-based Application

We will use Matlab as an example. The same applies to any application with a terminal interface, e.g. Stata, R, IPython, etc. Note that this runs on node002 (assigned at run time by Slurm):

[juser@picotte001 ~]$ module load matlab/R2020b
[juser@picotte001 ~]$ srun --nodes=1 --ntasks=1 --cpus-per-task=48 --mem=32G --time=00:15:00 --pty matlab -nodisplay -nodesktop -nosplash -noFigureWindows

640px

Proteus

You may also request interactive sessions, i.e. to login remotely to one of the compute nodes. You may want to do this because your interactive session requires an amount of memory above the limits imposed on the login nodes.

To do this, use the qlogin command. This has the same options as qsub. So, if you would like an interactive session on an Intel node with 16 cores, for 1 hour:

[juser@proteusi01]$ qlogin -pe shm 16 -l h_rt=1:00:00 -l h_vmem=63g Your job 205563 ("QLOGIN") has been submitted waiting for interactive job to be scheduled ... Your interactive job 205563 has been successfully scheduled. Establishing builtin session to host ic19n01.cm.cluster ... TERM: Undefined variable.

Once logged in, set the TERM variable so that text output can be formatted properly:

[juser@ic19n01]$ export TERM=xterm

From here, you can run terminal-based programs, e.g. Matlab:

[juser@ic19n01]$ module load matlab [juser@ic19n01]$ matlab -nodisplay ...

When the hour is up, your session will be terminated. You may also terminate normally by logging out. Please do so if you are not actively working as the session blocks resources regardless of whether they are actually being used.