SLURM Command Reference

Basic commands and common options are below. For full list of options, refer to the linked official documentation. Some options may not be available in our version of SLURM.

srun

Srun directly runs a simple job.

Usage and sample options:

srun -p $PARTITION $COMMAND

(valid partitions are cpu or gpu)

--mem-per-cpu

(mem is in GB, or specify unit like: ‘–mem 500M’)

--time $TIMEOUT

(timeout is in minutes, or minutes:seconds, hours:minutes:seconds, or days-hours:minutes:seconds) (default is 1 day, maximum is 4 days)

--nodes=$NUM_OF_NODES

(run this job on each of multiple nodes)

--gres=gpu:$NUM_OF_GPUS

(these resources are only available in the ‘gpu’ partition)

--gres=gpu:$GPU_TYPE:$NUM_OF_GPUS

(specify type of GPU. currently, valid values are ‘titan’ and ‘k80’.)

--cpus-per-task=$NUM_CPUS

(for a multi-threaded process)

https://slurm.schedmd.com/srun.html

sbatch

Sbatch submits a batch script that allocates resources and then executes one or more jobs.

This is good for jobs with multiple steps, and is also useful to submit a job that will continue to run after exiting your terminal session.

sbatch -p $PARTITION $BATCH_SCRIPT

An sbatch script specifies the required resources in commented lines beginning with #SBATCH as follows:

#!/bin/sh
#SBATCH --time=1:00
#SBATCH --mem-per-cpu=4000M
#SBATCH --partition=gpu
#SBATCH --gres=gpu:1
#SBATCH --nodes=4
srun my_job.js

https://slurm.schedmd.com/sbatch.html

sinfo

sinfo provides basic information about available cluster resources.

groenig-0% sinfo
PARTITION AVAIL  TIMELIMIT  NODES  STATE NODELIST
cpu          up 4-00:00:00      2   idle groenig-[1-2]
gpu*         up 4-00:00:00      1   resv vcuda-4
gpu*         up 4-00:00:00      1    mix vcuda-0
gpu*         up 4-00:00:00      3   idle vcuda-[1-3]

squeue

squeue lists the current contents of the queue

groenig-0% squeue
JOBID PARTITION     NAME     USER    ST       TIME  NODES NODELIST(REASON)
1879       gpu     bash    aaronb   R   22:33:17      1 vcuda-0
1880       gpu     bash    aaronb   R    6:46:13      1 vcuda-0