Quick reference sheet for SLURM resource manager

Job scheduling commands

CommandsFunctionBasic UsageExample
sbatchsubmit a slurm jobsbatch [script]$ sbatch job.sub
scanceldelete slurm batch jobscancel [job_id]$ scancel 123456
scontrol holdhold slurm batch jobsscontrol hold [job_id]$ scontrol hold 123456
scontrol release release hold on slurm batch jobsscontrol release [job_id]$ scontrol release 123456

Job management commands

Job StatusCommands
sinfo -alist all queues
squeue list all jobs
squeue -u useridlist jobs for userid
squeue -t Rlist running jobs
smap show jobs, partitions and nodes in a graphical network topology

Job script basics

A typical job script will look like this:

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --cpus-per-task=8
#SBATCH --time=02:00:00
#SBATCH --mem=128G
#SBATCH --mail-user=netid@gmail.com
#SBATCH --mail-type=begin
#SBATCH --mail-type=end
#SBATCH --error=JobName.%J.err
#SBATCH --output=JobName.%J.out

cd $SLURM_SUBMIT_DIR

module load modulename

your_commands_goes_here

Lines starting with #SBATCH are for SLURM resource manager to request resources for HPC. Some important options are as follows:

OptionExamplesDescription
--nodes#SBATCH --nodes=1Number of nodes
--cpus-per-task#SBATCH --cpus-per-task=16Number of CPUs per node
--time#SBATCH --time=HH:MM:SSTotal time requested for your job
--output#SBATCH -output filenameSTDOUT to a file
--error#SBATCH --error filenameSTDERR to a file
--mail-user #SBATCH --mail-user user@domain.eduEmail address to send notifications

Interactive session

To start a interactive session execute the following:

#this command will give 1 Node for a time of 4 hours

srun -N 1 -t 4:00:00 --pty /bin/bash

Getting information on past jobs

You can use slurm database to see how much memory your previous jobs used, e.g. the following command will report requested memory and used residential and virtual memory for job

sacct -j <JOBID> --format JobID,Partition,Submit,Start,End,NodeList%40,ReqMem,MaxRSS,MaxRSSNode,MaxRSSTask,MaxVMSize,ExitCode

Aliases that provide useful information parsed from the SLURM commands

Place these alias’ into your .bashrc

alias si="sinfo -o \"%20P %5D %14F %8z %10m %10d %11l %16f %N\""
alias sq="squeue -o \"%8i %12j %4t %10u %20q %20a %10g %20P %10Q %5D %11l %11L %R\""

More information about Slurm can be found here:


Table of contents