Interactive jobs with Slurm

The command srun can be used to request nodes for interactive use. For example: srun -p PARTITION_NAME --time=2:30:0 -N 2 --ntasks-per-node=4 --pty bash -i creates an interactive job which will occupy 4 cores per a node on 2 nodes for 2:30 hours. By default an interactive job allocates one core on one node for 30 minutes. Upon the command execution you will be connected to the allocated resources by SSH. Type exit to quit the interactive job and to get back to your shell on one of the logins node.

Here is a little trick which will help you to estimate the time left till the end of the job (you have to add following lines to your $HOME/.bashrc file):

# Prompt SLURM
if [ "$PS1" ]; then
PS1='[\u@\h \W] $(if [[ -v SLURM_JOB_ID ]]; then echo -n "($SLURM_JOB_ID -> `squeue --job $SLURM_JOB_ID -o %L | tail -1f`) "; fi)> '
fi

The prompt looks as follows:

[user@login02 ~]$ srun -p westmere -t 10:00 --pty bash -i
[user@westmere001 ~] (224459 -> 10:00) >
[user@westmere001 ~] (224459 -> 8:16) > exit
exit
[user@login02 ~] >

Where (224459–>10:00) : shows that the job id is 224459 and the job will ends in 10 minutes. The end of job time will be updated each time you run a command in the terminal.


Dernière mise à jour : 19 September 2018 mesocentre-techn@univ-amu.fr

+33 (0)4 13 94 58 29 / (0)4 13 94 58 27