skills.cirrus.ac.uk

Slurm on Cirrus

Cirrus uses the Slurm Workload Manager to schedule jobs on compute nodes. Jobs are submitted to a queue and run when the requested resources become available.

Never poll the queue rapidly. Running squeue or sinfo in a tight loop (watch with a short interval, or --iterate) floods the scheduler and slows job scheduling for every user. Minimum polling interval from scripts: 60 seconds. Disruptive polling is a breach of the acceptable use policy and may result in account suspension.

Critical Rules


System Setup

System Cores per node Notes
Cirrus 144 per socket (2 sockets per node)  

Max walltime on all systems: 24 hours. See the job scheduling page for partition and QOS limits.


Monitoring

squeue --me                    # your jobs only
sinfo                          # partition and node state (general impression only)
sacct                          # current and recently completed jobs with exit codes

Common job states: R = running, PD = pending, CG = completing, F = failed, TO = timed out.


Submitting Jobs

Key information

Batch jobs (sbatch)

sbatch my_job.sh

Cirrus — single core job:

#!/bin/bash
#SBATCH --job-name=my_job
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=1
#SBATCH --time=00:05:00
#SBATCH --partition=standard
#SBATCH --qos=standard
#SBATCH --account=<budgetID>   # Replace "<budgetID>" with your budget code

hostname
cpuinfo

Always set --time — shorter walltimes usually mean shorter queue waits.

Interactive jobs (srun)

# Run a single command on a compute node
srun --nodes=1 --ntasks-per-node=1 --cpus-per-task=1 --partition=standard --qos=standard --account=<budgetID> --time=00:02:00 cpuinfo

# Start an interactive shell (job ends when you close the terminal)
srun --nodes=1 --ntasks-per-node=1 --cpus-per-task=1 --time=00:15:00 --partition=standard --qos=standard --account=<budgetID> --pty /bin/bash --login

Running multiple tasks in parallel on a single node

Cirrus — single full node job:

#!/bin/bash
#SBATCH --job-name=my_job
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=288
#SBATCH --cpus-per-task=1
#SBATCH --exclusive
#SBATCH --time=00:05:00
#SBATCH --partition=standard
#SBATCH --qos=standard
#SBATCH --account=<budgetID>   # Replace "<budgetID>" with your budget code

hostname
sun --hint=nomultithread --distribution=block:block my_mpi_app.x

Managing Jobs

Job arrays

#SBATCH --array=1-4                # tasks 1, 2, 3, 4
#SBATCH --output=my_array_%a.out   # %a = task ID
#SBATCH --array=1-100%4            # limit to 4 concurrent tasks
#SBATCH --array=0-90:10            # step: 0, 10, 20 ... 90

# Inside script, task ID is:
echo $SLURM_ARRAY_TASK_ID

Array tasks appear as JOBID_TASKID in squeue. Cancel one task: scancel JOBID_TASKID. Cancel the whole array: scancel JOBID.

For many short tasks, prefer concurrent srun steps in one batch job over a large array — reduces scheduler overhead and avoids exhausting credit reservations.

Job dependencies

# Run job2 only after job1 succeeds (exit code 0)
JOBID_1=$(sbatch --parsable job1.sh)
JOBID_2=$(sbatch --parsable --dependency=afterok:${JOBID_1} job2.sh)

# Only one job with this name runs at a time
sbatch --dependency=singleton my_job.sh
sbatch --dependency=singleton my_job.sh   # waits for the first to finish

View dependencies: squeue --me --Format="JobID,Name,StateCompact:6,ReasonList,Dependency:32"

Other types: afterany (regardless of exit code), afternotok (only if failed). See the sbatch man page.

Cancelling jobs

scancel <JOBID>         # cancel a job or array task
scancel <JOBID_TASKID>  # cancel one array task
scancel --me            # cancel all your jobs

Advanced Topics

See references/advanced.md for full detail on:

Read this file when helping with any of these topics.


Troubleshooting

See references/troubleshooting.md for a full symptom → cause → fix reference covering:

Read this file when a user is asking why their job won’t start, is failing, or is behaving unexpectedly.


Quick Reference

Goal Command
View your jobs squeue --me
Check job history + exit codes sacct
Submit batch job sbatch my_job.sh
Interactive command srun --nodes=1 --ntasks-per-node=1 --cpus-per-task=1 --time=00:05:00 <cmd>
Interactive shell srun --nodes=1 -ntasks-per-node=1 --cpus-per-task=1 --time=00:15:00 --pty /bin/bash --login
Reserve allocation salloc --nodes=1 -ntasks-per-node=1 --cpus-per-task=1 --time=00:10:00
Cancel job scancel <JOBID>
Cancel all my jobs scancel --me
Chain jobs sbatch --parsable + --dependency=afterok:<ID>
Limit array concurrency --array=1-100%4
Attach to running job srun --jobid=<ID> --overlap --pty /bin/bash -l
Check QOS limits sacctmgr show qos
Check my accounts sacctmgr show user $(whoami) withassoc