SLURM Workload Manager
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.
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
| Component | Role | Location |
|---|---|---|
| slurmctld | Central controller โ scheduling decisions, state management | Management / head node |
| slurmd | Node daemon โ launches jobs, monitors resources, reports state | Every compute node |
| slurmdbd | Database daemon โ accounting, job history, fairshare data | Database server |
| slurmrestd | REST API โ programmatic cluster access | Management node |
Essential SLURM Commands
| Command | Purpose | Example |
|---|---|---|
| sbatch | Submit a batch job script | sbatch job.sh |
| srun | Run a parallel job interactively or within sbatch | srun -n 128 ./sim |
| squeue | View job queue status | squeue -u username |
| scancel | Cancel a queued or running job | scancel 12345 |
| sinfo | View partition and node status | sinfo -l |
| sacct | Job accounting and history | sacct -j 12345 --format=JobID,Elapsed,CPUTime |
| scontrol | Admin control and job details | scontrol show job 12345 |
| salloc | Allocate resources interactively | salloc -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:
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 example | Node type | Max time | Typical use |
|---|---|---|---|
| short | CPU nodes | 4 hours | Testing, debugging, quick jobs |
| standard | CPU nodes | 48 hours | Production simulation |
| long | CPU nodes | 7 days | Long-running research jobs |
| gpu | GPU nodes | 24 hours | AI training, GPU simulation |
| bigmem | High-memory nodes | 48 hours | Genomics, in-memory databases |
| interactive | Mixed | 2 hours | Interactive development |
GPU Resource Allocation
SLURM 19.05+ introduced native GPU scheduling via GRES (Generic RESource). Requesting GPUs correctly is critical for AI workloads:
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.
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.
- Priority boost โ give certain projects higher scheduling priority
- Resource limits โ cap maximum nodes or GPUs a user can use simultaneously
- Time overrides โ allow some users to submit jobs with longer walltimes
- Preemption โ allow high-priority jobs to preempt lower-priority ones
Scheduling Algorithms
SLURM uses two main scheduling plugins:
- Priority/Multifactor โ ranks jobs by a weighted combination of age, fairshare, job size, QOS, and partition priority
- Backfill โ fills gaps in the schedule with smaller jobs that won't delay higher-priority jobs, dramatically improving cluster utilization
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:
- Fairshare scheduling โ users/projects who have used less than their allocation get higher priority
- Billing โ charge research projects for compute usage
- Reporting โ
sreportgenerates utilization reports for cluster administrators
Best Practices for Users
- Request accurate walltimes โ overestimating delays your job in backfill scheduling; underestimating kills it before completion
- Use scratch storage โ read/write data from the fast parallel filesystem, not your home directory
- Implement checkpointing โ save state every 1โ4 hours so long jobs can restart after failures
- Test with small jobs first โ verify correctness on 1โ2 nodes before scaling to hundreds
- Use job arrays for parameter studies โ far more efficient than submitting hundreds of individual jobs
- Monitor with squeue/sacct โ check your jobs are actually running efficiently, not just queued
Key Takeaways
- SLURM is the dominant HPC scheduler on over 60% of TOP500 systems
- SBATCH scripts are the standard way to submit reproducible, documented HPC jobs
- Partitions and QOS let administrators shape resource usage policies per project and user group
- GPU-aware scheduling via GRES is essential for modern AI and simulation workloads
- Backfill scheduling is the key to high cluster utilization โ short, accurate walltime estimates help everyone