// Deep Dive ยท HPC Administration

SLURM Workload Manager

๐Ÿ“… Updated: June 2026 โฑ 9 min read ๐Ÿท Job Scheduling ยท Cluster Management ยท HPC Operations
SBATCH Partitions QOS Job Arrays GPU Allocation Backfill Accounting

What is SLURM?

SLURM (Simple Linux Utility for Resource Management) is the world's most widely deployed HPC workload manager, used by more than 60% of TOP500 supercomputers including Frontier, Perlmutter, and LUMI. It manages the allocation of compute resources โ€” nodes, CPUs, GPUs, memory โ€” among competing jobs from multiple users.

SLURM operates as a daemon running on every node. The slurmctld controller daemon runs on the management node; slurmd runs on each compute node. Users submit jobs via command-line tools; SLURM queues them, schedules execution based on priority, and tracks resource usage for billing.

// Market position

SLURM is open-source (GPLv2), developed originally at Lawrence Livermore National Laboratory, and now maintained by SchedMD. It replaced PBS/Torque and LSF as the dominant HPC scheduler because of its scalability to millions of cores, active development, and strong community support.

Core Architecture

ComponentRoleLocation
slurmctldCentral controller โ€” scheduling decisions, state managementManagement / head node
slurmdNode daemon โ€” launches jobs, monitors resources, reports stateEvery compute node
slurmdbdDatabase daemon โ€” accounting, job history, fairshare dataDatabase server
slurmrestdREST API โ€” programmatic cluster accessManagement node

Essential SLURM Commands

CommandPurposeExample
sbatchSubmit a batch job scriptsbatch job.sh
srunRun a parallel job interactively or within sbatchsrun -n 128 ./sim
squeueView job queue statussqueue -u username
scancelCancel a queued or running jobscancel 12345
sinfoView partition and node statussinfo -l
sacctJob accounting and historysacct -j 12345 --format=JobID,Elapsed,CPUTime
scontrolAdmin control and job detailsscontrol show job 12345
sallocAllocate resources interactivelysalloc -N 4 --time=1:00:00

Writing SBATCH Job Scripts

Jobs are submitted as shell scripts with SLURM directives in #SBATCH comments. Here is a complete GPU training job example:

#!/bin/bash #SBATCH --job-name=llm-training #SBATCH --partition=gpu-large #SBATCH --nodes=8 # 8 compute nodes #SBATCH --ntasks-per-node=4 # 4 MPI ranks per node #SBATCH --cpus-per-task=16 # 16 CPU threads per rank #SBATCH --gpus-per-node=4 # 4 GPUs per node (32 total) #SBATCH --mem=512G # 512 GB RAM per node #SBATCH --time=24:00:00 # Max walltime: 24 hours #SBATCH --account=project_12345 # Billing account #SBATCH --output=logs/%j_stdout.log # %j = job ID #SBATCH --error=logs/%j_stderr.log #SBATCH --mail-type=END,FAIL #SBATCH --mail-user=user@institute.edu # Load modules module load cuda/12.3 openmpi/4.1 python/3.11 # Set environment export OMP_NUM_THREADS=16 export CUDA_VISIBLE_DEVICES=0,1,2,3 # Run the job srun python train.py \ --model llama-70b \ --data /scratch/project_12345/dataset \ --checkpoint-dir /project/project_12345/checkpoints

Partitions

Partitions (called queues in PBS) are groups of nodes with shared policies โ€” time limits, access controls, and resource constraints. A cluster typically has multiple partitions for different use cases:

Partition exampleNode typeMax timeTypical use
shortCPU nodes4 hoursTesting, debugging, quick jobs
standardCPU nodes48 hoursProduction simulation
longCPU nodes7 daysLong-running research jobs
gpuGPU nodes24 hoursAI training, GPU simulation
bigmemHigh-memory nodes48 hoursGenomics, in-memory databases
interactiveMixed2 hoursInteractive development

GPU Resource Allocation

SLURM 19.05+ introduced native GPU scheduling via GRES (Generic RESource). Requesting GPUs correctly is critical for AI workloads:

# Request specific GPU type #SBATCH --gres=gpu:h100:4 # 4x H100 GPUs #SBATCH --gres=gpu:a100:8 # 8x A100 GPUs # Or use the newer --gpus directive #SBATCH --gpus-per-node=4 #SBATCH --gpus-per-task=1 # 1 GPU per MPI rank # Verify allocation inside the job nvidia-smi echo "CUDA devices: $CUDA_VISIBLE_DEVICES"

Job Arrays

Job arrays submit many similar jobs with a single sbatch command โ€” ideal for parameter sweeps, ensemble runs, or processing large numbers of input files. SLURM assigns each task a unique SLURM_ARRAY_TASK_ID.

#!/bin/bash #SBATCH --array=1-100 # 100 tasks, IDs 1-100 #SBATCH --array=0-999%20 # 1000 tasks, max 20 running at once # Each task processes a different input file INPUT_FILE="inputs/sample_${SLURM_ARRAY_TASK_ID}.dat" OUTPUT_FILE="outputs/result_${SLURM_ARRAY_TASK_ID}.out" python process.py --input $INPUT_FILE --output $OUTPUT_FILE

Quality of Service (QOS)

QOS policies layer additional constraints and priorities on top of partitions โ€” used to implement fairshare scheduling, reservation policies, and special access for priority users or projects.

Scheduling Algorithms

SLURM uses two main scheduling plugins:

// Backfill in practice

A 1000-node job is waiting for resources. Backfill allows a 10-node job with a short walltime to run in the gap โ€” provided it won't delay the large job. Well-tuned backfill scheduling routinely achieves 85โ€“95% cluster utilization.

Accounting and Fairshare

SLURM's database daemon (slurmdbd) records every job's CPU-hours, GPU-hours, memory, and walltime. This enables:

# View your fairshare score sshare -u username # Detailed accounting for completed jobs sacct -u username --starttime=2026-01-01 \ --format=JobID,JobName,Partition,AllocNodes,Elapsed,CPUTimeRAW,State # Cluster-wide utilization report sreport cluster utilization start=2026-01-01 end=2026-06-01

Best Practices for Users

Key Takeaways