Top 12 Most Useful Slurm Commands

Top 12 Most Useful Slurm Commands 

A quick-reference guide to the SLURM workload manager commands you will use most often: submitting and cancelling jobs, monitoring the queue and cluster, and analyzing job history, priority, and efficiency. 

Slurm’s official cheat sheet document: 

https://slurm.schedmd.com/pdfs/summary.pdf 

 

1. sbatch — Submit a batch job 

The workhorse of Slurm. Submits a script to the queue for execution. 

sbatch my_job.sh 

sbatch --job-name=training --time=04:00:00 --gres=gpu:1 train.sh 

 

Typical script header: 

#!/bin/bash 

#SBATCH --job-name=sim 

#SBATCH --time=02:00:00 

#SBATCH --cpus-per-task=8 

#SBATCH --mem=16G 

#SBATCH --output=sim_%j.log   # %j = job ID 

python simulate.py 

 

2. squeue — View the job queue 

Shows pending and running jobs.

squeue -u $USER              # just your jobs 

squeue -u $USER -t PENDING   # only pending jobs 

squeue -j 12345              # a specific job 

squeue -o "%.10i %.20j %.8T %.10M %.6D %R"   # custom columns 

The NODELIST(REASON) column explains why a job is waiting (e.g. Priority, Resources, QOSMaxJobsPerUserLimit). 

 

3. scancel — Cancel jobs 

scancel 12345                # cancel one job 

scancel -u $USER             # cancel all your jobs 

scancel -u $USER -t PENDING  # cancel only your pending jobs 

scancel --name=training      # cancel by job name 

 

4. sinfo — View cluster/partition status 

Shows partitions, node states, and availability. 

sinfo 

sinfo -p gpu                     # one partition 

sinfo -N -l                      # per-node long listing 

sinfo -o "%P %a %l %D %t %C"     # partition, avail, timelimit, nodes, state, CPUs 

Node states worth knowing: idle, alloc, mix, drain, down. 

 

5. sacct — Job accounting / history 

Inspect finished (or running) jobs — essential for debugging failures and checking resource usage. 

sacct -j 12345 

sacct -j 12345 --format=JobID,JobName,State,Elapsed,MaxRSS,ExitCode 

sacct -u $USER --starttime=2026-07-01   # your jobs since July 1 

sacct --batch-script -j 39071      # show job submission script 

MaxRSS shows actual peak memory used — great for right-sizing --mem requests. State=OUT_OF_MEMORY or TIMEOUT immediately explains most failures. 

 

6. scontrol — Inspect and modify jobs/nodes 

The detailed-info Swiss army knife. 

scontrol show job 12345        # full details of a job 

scontrol show node node042     # node details 

scontrol hold 12345            # prevent a pending job from starting 

scontrol release 12345         # release the hold 

scontrol update JobId=12345 TimeLimit=08:00:00   # modify a pending job 

 

7. salloc — Allocate resources interactively 

Grabs an allocation and gives you a shell for interactive work. 

salloc --time=2:00:00 -p general --nodes=1 --cpus-per-task=8 

# ...you now have a shell with the allocation... 

./my_program 

exit   # releases the allocation 

 

8. sprio — Priority breakdown of pending jobs 

Shows why your job sits where it does in the queue (fairshare, age, QOS components). 

sprio -j 12345 

sprio -u $USER -l 

Useful when a job seems stuck: you can see if low fairshare (recent heavy usage) is the reason. 

 

9. seff — Job efficiency summary 

Post-mortem report of how efficiently a completed job used its allocation. 

seff 12345 

Output shows CPU and memory efficiency, e.g. “CPU Efficiency: 12%” means you requested far more cores than the job used. Run it after every job to tune future requests. 

 

10. sstat — Live stats for a running job 

Like sacct, but for jobs that are currently running — check memory/CPU usage in real time. 

sstat -j 12345.batch --format=JobID,MaxRSS,AveCPU,MaxDiskRead,MaxDiskWrite 

Note you usually need the .batch (or step) suffix. Perfect for catching a memory leak before the job dies of OOM. 

 

11. sshare — Fairshare usage 

Shows your (and your account's) fairshare standing — the main driver of queue priority on most clusters. 

sshare -u $USER 

sshare -a -A myaccount   # everyone in your account/allocation 

A low FairShare value (close to 0) means recent heavy usage is pushing your pending jobs down the queue.

 

12. sreport — Usage reports over time 

Aggregated historical usage — handy for allocation tracking and end-of-month accounting. 

sreport cluster AccountUtilizationByUser start=2026-06-01 end=2026-07-01 

sreport user TopUsage start=2026-06-01 -t hours   # top consumers 

 

Bonus Tips 

  • sbatch --array=0-99 gives you job arrays for parameter sweeps (use $SLURM_ARRAY_TASK_ID in the script). 

  • sbatch --dependency=afterok:12345 next.sh chains jobs so one starts only after another succeeds. 

  • watch squeue -u $USER is the classic way to monitor your queue live. 

 

For Additional Assistance

For additional assistance with SLURM commands, please see the SLURM docs page Slurm Workload Manager - Documentation.