Slurm from zero: allocation, gang scheduling, fairshare and preemption

How the scheduler most training clusters run decides who gets which nodes, and how to drive it for training: the daemons, the life of a job, resources and steps, limits, the main loop and backfill, priority, preemption, arrays, reservations and accounting. Every command ran on a real Slurm 24.11.5 cluster in containers (3 nodes, 12 fake GPUs) with the topic's running example. A child of Topic: ml-infra-and-orchestration. Data as of October 2026. Reading: 34 min, plus 16 in closed details.

The idea in one screen

Slurm is one controller that gives each job its whole allocation at once or nothing, tries waiting jobs in the order of one priority number, and lets a lower job start early (backfill) only when its time limit fits a gap; steps, limits, preemption and reservations are refinements of that one loop.

One job's path: queue, allocation, steps

  1. A full cluster. Three nodes of 4 CPUs and 4 fake GPUs, each running slurmd; one controller, slurmctld, holds every job and node in memory; slurmdbd keeps the accounting. Bob's job 78 holds all 12 GPUs, with a time limit of 1 minute.
  2. sbatch. At 05:36:55.526 UTC sbatch hands the running example, job 79 (2 nodes, 2 GPUs each), to the controller, which queues it with priority 4166 and reason Resources.
  3. A plan made from time limits. Backfill plans job 79 for 05:37:53, the moment job 78's limit runs out, not its real end, and re-plans every 2 s (12 times).
  4. Both nodes at once. Job 78 ends at 05:37:18.890, 25 s into its limit; 22 ms later the main loop grants c1 and c2 together, 34 s before the plan. A job gets its whole allocation or nothing, so gang scheduling comes free.
  5. Steps. The script runs on c1 as step 79.batch; its srun starts step 79.0, one torchrun per node with 2 ranks each, which train to global loss 2.2638769149780273.
  6. Recorded. By 05:37:28.650 the epilogs have run and the nodes are free; slurmdbd keeps the job's billing=5,cpu=4,gres/gpu=4,node=2. That usage feeds fairshare, and the order of waiting jobs is one integer per job (section 7).

Drawn from job 79's own log lines (slurmctld, slurmd, prolog and epilog, 16 Oct 2026); positions and sizes are illustrative. Section numbers below follow the same path; section 2 puts every log line on a clock.

You need: nothing beyond Linux processes and a training job. Why clusters need a scheduler at all, and Slurm against Kubernetes and Ray, are on the parent Topic: ml-infra-and-orchestration; how torchrun and NCCL start the ranks inside a step is on Launching distributed training.

Allocation (job)
nodes, CPUs, memory and GPUs held for a time limit, granted all at once.
Job step
one srun inside an allocation: the processes (tasks) that do the work.
Partition
a named set of nodes with its own rules (a queue).
Association, QOS
a user in an account, and a named bundle of priority and limits; both live in the accounting database.
TRES, GRES
anything Slurm counts (cpu, mem, gres/gpu, billing); GRES are devices such as GPUs.
Backfill
starting a lower-priority job in a gap that its time limit fits, without delaying higher jobs.
Fairshare
a priority factor that falls as a user's or team's recent usage rises.
Reason
the one word squeue prints for a pending job: the first check it failed.

What "measured" means here. Every command output ran on the topic's lab cluster on 16 October 2026: Slurm 24.11.5 in four containers, 3 nodes of 4 CPUs and 4 fake GPUs each, which Slurm counts, allocates and bills but which do not exist (jobs get SLURM_GPUS_ON_NODE and no CUDA_VISIBLE_DEVICES) measured on Apple M1 Pro, Docker Desktop VM, shared machine. Which job ran where, in what order, with which reason and priority is deterministic Slurm behaviour and transfers to a real cluster; seconds and milliseconds are rough.

Commands at a glance, the cluster, versions (reference)
You want toCommandSection
submit a script to run latersbatch job.sbatch2
launch processes (a step) inside an allocationsrun4
get an allocation for interactive worksalloc -N2 --gres=gpu:4(same as sbatch, but a shell)
see the queue and why jobs waitsqueue, squeue --start6, Why pending?
see why a job has its prioritysprio -l, sshare -a -l7
see nodes and partitionssinfo, scontrol show node1
change or inspect anythingscontrol (hold, release, requeue, update, show job)throughout
see what jobs used, aftersacct, sreport11
cancelscancel

The running example. One small PyTorch job is used across the whole topic: a 112,577-parameter GPT trained with DDP over gloo, 2 nodes by 2 ranks, 200 steps, checkpoint every 50, submitted with sbatch train.sbatch. Its global loss at step 200 is 2.2638769149780273 on Slurm, Kubernetes and Ray alike (root page, src/data/runs/), and it was again in both runs of it on this page (jobs 79 and 125).

The cluster. A controller container ctl (slurmctld, slurmscriptd, slurmdbd with MariaDB, munged; 512 MB, 1 CPU) and three compute containers c1 to c3 (slurmd and munged only, configless; each declared 4 CPUs, 4,000 MB and gpu:4, four empty placeholder files, while Docker caps each container at 800 MB and 2 CPUs, which Slurm does not know). Users alice and carol are in account teama, bob in teamb. A Docker volume at /shared stands in for a cluster file system (jobs, output, checkpoints). Setup in the root's src/data/README.md.

Versions. Slurm here is the Debian 13 package 24.11.5; the current upstream release is 26.05.5 (13 October 2026, SchedMD releases); source is quoted at tag slurm-24-11-5-1 so it matches what ran. Slurm has been open source (GPL-2.0) since 2002; NVIDIA bought SchedMD, its developer, in December 2025 and said it stays open source (NVIDIA, 2025-12-15). Most large GPU training clusters run it: the root's Tool map has the dated evidence.

What the root's labs already show on this same cluster, and this page links instead of repeating: the Scheduling lab (an eight-job queue under FIFO and backfill, Fair Tree between two teams, partition preemption, the Kubernetes gang deadlock), the Failure lab (killed and drained nodes, health checks) and the Launch lab (start-up time by stage).

1. The daemons: one brain, many hands

No GPU may be given to two jobs at once, on thousands of machines with many users. Slurm's answer is a single brain: every decision is made in one process that holds the whole cluster in memory (the hero's top box), and the machines only do what it says.

DaemonRuns onDoesIf it dies
slurmctld
the controller
one head node (plus optional backups)holds every job, node, partition and reservation in memory; runs both schedulers; answers every sbatch, squeue, scontrol; saves its state to StateSaveLocation so a restart loses nothingrunning jobs keep running; nothing new starts and commands fail until it is back or a backup controller (a second SlurmctldHost line) takes over after SlurmctldTimeout (default 120 s)
slurmdevery compute node, as rootregisters the node (CPUs, memory, GRES), starts job steps, runs the prolog and epilog, reports backafter SlurmdTimeout without an answer (default 300 s) the node is marked DOWN and its jobs requeued or killed
slurmstepdone per step per node, started by slurmdstarts the step's tasks, tracks every process they fork, applies cgroup limits, collects usage, forwards stdout to srunits step fails
slurmdbd + MariaDB/MySQLusually the head nodethe accounting database: every job's usage (what sacct and fairshare read), users, accounts, QOS and their limitsthe controller queues records and keeps scheduling; limits and users cannot be changed until it returns
mungedevery nodeauthentication: every message carries a credential sealed with a key every node sharesnothing on that node can talk to Slurm

Defaults read from src/common/read_config.h at slurm-24-11-5-1: . This lab cluster sets both timeouts to 30 s so the root's Failure lab could watch a node die in seconds: there a killed node was marked DOWN and its job requeued 32.1 s after the kill.

Declared, not detected. Slurm schedules what slurm.conf declares for a node, not what the hardware has. Here each node declares 4 CPUs and 4,000 MB while slurmd -C sees 5 CPUs and 9,951 MB, and Slurm hands out exactly the declared amounts. Declaring less is safe; declaring more is not: a node that registers with fewer CPUs, memory or temporary disk than declared is taken out of service "to avoid scheduling jobs on them" (state INVAL, slurm.conf). This cluster hit it while being built: gres/gpu count reported lower than configured (0 < 4). So a typo in slurm.conf takes nodes out of service, and sites declare a little less memory than slurmd -C reports.

Predict: the controller crashes on day 2 of a 3-day training job and is restarted an hour later. What happened to the job?
It kept training. The processes run under slurmstepd on the compute nodes and do not need the controller while they run; the controller's state is on disk in StateSaveLocation, and on restart it logs Recovered state of N nodes and Recovered information about N jobs, as it did here at every reconfigure. What stops for that hour is everything new: submissions, starts and steps (srun asks the controller for each step, so a script that launches a new step every epoch would stall).
What runs where, configless nodes, scontrol reconfigure (measured)
$ ps -eo user,comm        # on the controller container (ctl)
munge    munged
mysql    mariadbd
slurm    slurmdbd
slurm    slurmctld
slurm    slurmscriptd     # a helper slurmctld forks once, to run scripts so the controller never forks itself
$ ps -eo user,comm        # on a compute node (c1), idle
root     slurmd
munge    munged
$ scontrol ping
Slurmctld(primary) at ctl is UP
$ slurmd -C                      # on c1: what the hardware says
NodeName=c1 CPUs=5 Boards=1 SocketsPerBoard=1 CoresPerSocket=5 ThreadsPerCore=1 RealMemory=9951
$ scontrol show node c1          # what Slurm uses (lines trimmed)
NodeName=c1 Arch=aarch64 CoresPerSocket=4
   CPUAlloc=0 CPUEfctv=4 CPUTot=4 CPULoad=0.45
   Gres=gpu:4
   RealMemory=4000 AllocMem=0 FreeMem=5565 Sockets=1 Boards=1
   State=IDLE ThreadsPerCore=1 TmpDisk=0 Weight=1
   CfgTRES=cpu=4,mem=4000M,billing=5,gres/gpu=4

billing=5 is this cluster's TRESBillingWeights: 4 GPUs at 1.0 plus 4 CPUs at 0.25.

Configless. Every daemon needs slurm.conf; on old clusters it was copied to every node, where copies drifted apart. Since Slurm 20.02 a node can fetch it: slurmd --conf-server ctl asks the controller, which serves slurm.conf, gres.conf, cgroup.conf and a few others, cached under SlurmdSpoolDir/conf-cache (configless docs). On c1, ls /var/spool/slurmd/conf-cache printed cgroup.conf gres.conf slurm.conf.

A change is then: edit slurm.conf on the controller, run scontrol reconfigure. In 24.11 that restarts the controller in place; its log (05:36:39 to 05:36:40 UTC): Reconfigure signal (SIGHUP) received, Saving all slurm state, slurmctld version 24.11.5 started on cluster mi, Recovered state of 3 nodes, Relinquishing control to new slurmctld process. Running jobs are not touched. Every experiment here that changed the configuration did it this way and put the original back the same way.

Only the wait changes: the same job behind a 12-GPU job, then on an idle cluster


Lanes: the controller, the backfill scheduler, the two nodes (prolog, batch script, step launch, epilog) and the training ranks; the band on top is the job state; time is to scale. Under the chart, the raw log lines of the current stage. squeue, polled every second, agreed. Logs in src/runs/raw1 and raw2, IPs scrubbed.

2. The life of a job, from the controller's own log

"My job is not running" can mean a dozen things, and each is a different state. The running example was submitted twice: once while bob's job (12 GPUs, time limit 1 minute, sleeping 25 s) held every GPU, once on an idle cluster, with the controller at debug level and the Backfill flag on and a prolog and epilog that log a line per node measured. Each dot on the right is one real log line; the eight stages below group them.

  1. Submit. sbatch sends the script and its options; the controller checks them against partitions, limits and node configurations (a request no node could ever satisfy is refused here with Requested node configuration is not available), assigns an id and an initial priority (InitPrio=4166), and stores the script: editing the file afterwards changes nothing.
  2. Pending, with a reason, here Resources (first in line, resources busy). Backfill planned the start at 05:37:53 and logged the same plan 12 times (every 2 s, bf_interval=2): that is the blocker's time limit, not its real end. Slurm plans with limits because it cannot know runtimes.
  3. Allocate. The blocker ended at 05:37:18.890; a job ending is an event that runs the main scheduler, which allocated c1 and c2 22 ms later, 34 s before the plan. A planned start is an upper bound that usually moves earlier.
  4. Prolog. With PrologFlags=Alloc, slurmd runs the site's prolog as root on every node first (5 ms later here). Sites check GPU health here; a prolog that exits non-zero drains the node and requeues the job.
  5. Batch step. The script runs on the first node (c1) as the user: step 79.batch.
  6. Job steps. Each srun asks the controller for a step; slurmd starts a slurmstepd on each node, which starts the tasks. The one srun here started one torchrun per node: step 79.0. The ranks began 2.3 s later and trained for about 6.5 s.
  7. Completing. When the script exits, every node kills leftovers and runs the epilog; only then are the nodes free.
  8. Completed, and recorded in slurmdbd; sacct shows the job and each step (below).
Stagebusy (job 79)idle (job 125)

From allocation to the last epilog the two runs took 9.7 s and 9.4 s; the rest of the difference, 23 s, is all queue. Slurm's own steps are milliseconds (allocation to prolog 5 to 7 ms, prolog to batch script 11 to 12 ms, script to step launch 27 to 28 ms); the training processes began 2.2 to 2.3 s after the step launch (torchrun, imports, rendezvous) and trained for about 6.3 to 6.5 s.

$ sacct -j 79 --format=JobID,JobName,State,Elapsed,NodeList,AllocTRES
       JobID    JobName      State    Elapsed        NodeList                         AllocTRES
------------ ---------- ---------- ---------- --------------- ---------------------------------
          79   mi-train  COMPLETED   00:00:10          c[1-2] billing=5,cpu=4,gres/gpu=4,node=2
    79.batch      batch  COMPLETED   00:00:10              c1     cpu=2,gres/gpu=2,mem=0,node=1
        79.0   torchrun  COMPLETED   00:00:10          c[1-2]     cpu=4,gres/gpu=4,mem=0,node=2

The states squeue and sacct print

Main line: PENDING (PD), CONFIGURING (CF, nodes booting or a slow prolog), RUNNING (R), COMPLETING (CG, about 1 s here), COMPLETED (CD). Bad ends: FAILED (script exited non-zero; not requeued; under torchrun the code Slurm records is torchrun's 1, not the failed rank's, as Launching distributed training, section 3, shows), TIMEOUT (SIGTERM at the limit, SIGKILL after KillWait), CANCELLED, NODE_FAIL (with --requeue the job is requeued instead), OUT_OF_MEMORY (needs ConstrainRAMSpace), PREEMPTED. Back to the queue or paused: REQUEUED, SUSPENDED (keeps its memory, GPU memory included). Click a state for its note.

Where the 10 seconds went. The training loop ran about 6.5 s (the ranks' own wall_s); the rest is the chain every job pays: prolog, batch shell, step request, torchrun and imports (the ranks began 2.3 s after the step launch), rendezvous, epilog. On a real cluster GPU health checks, image pulls and the rendezvous of hundreds of nodes make this chain minutes long, paid again on every restart; the root's Launch lab splits it by stage.

Predict: squeue --start said job 79 would start at 05:37:53. Why did it start at 05:37:18?
The plan uses time limits; the blocker asked for 1 minute and used 25 s. _job_complete was followed 21 ms later by Running job scheduler for default depth and the allocation: the main scheduler runs on events (a job submitted or ending, a node coming back) as well as periodically. Nothing was preempted: both jobs were in partition batch, and preemption here works only across partition tiers (section 8).
The key log lines of the busy run (measured)
# slurmctld.log on the controller (UTC; lines trimmed)
05:36:55.526 _slurm_rpc_submit_batch_job: JobId=79 InitPrio=4166
05:36:55.852 sched/backfill: BACKFILL: test for JobId=79 Prio=4166 Partition=batch
05:36:55.852 sched/backfill: _dump_job_sched: BACKFILL: JobId=79 to start at 2026-10-16T05:37:53,
             end at 2026-10-16T05:47:53 on nodes c[1-2] in partition batch
  ... the same plan every 2 s (bf_interval=2), 12 times ...
05:37:18.890 _job_complete: JobId=78 WEXITSTATUS 0                # the blocker ends
05:37:18.911 debug:  sched: Running job scheduler for default depth.
05:37:18.912 sched: Allocate JobId=79 NodeList=c[1-2] #CPUs=4 Partition=batch
# slurmd.log on c1, and the prolog's own line
05:37:18.917 prolog c1 job=79 user=alice
05:37:18.929 Launching batch job 79 for UID 2001
05:37:18.956 launch task StepId=79.0 request from UID:2001 ...   # srun torchrun, on c1 and c2
# the training processes (rank logs): started 05:37:21.2, step 200 at 05:37:27.7, gloss 2.2638769149780273
05:37:28.639 [79.0] done with step
05:37:28.644 [79.batch] done with step
05:37:28.649 epilog c1 job=79 user=alice

Raw logs in src/runs/raw1/. The same log, when a node dies mid-run, shows requeue job JobId=48 due to failure of node c2 (the root's Failure lab).

3. Resources: what a job asks for, and what it gets

A GPU node is not a box of GPUs: it is CPUs, memory and GPUs that must be handed out together. Slurm counts every kind of thing it hands out as a TRES (trackable resource): cpu, mem, node, gres/gpu, and billing, a weighted sum used for fairshare. The selection plugin select/cons_tres (the default) allocates individual cores, memory and GPUs, so several jobs can share a node; SelectTypeParameters says what is consumable (here CR_Core, cores only; GPU clusters use CR_Core_Memory so memory is counted too).

OptionMeansTypical use
-N 2 / --nodesnumber of nodesmulti-node training: one node per 8 GPUs
--ntasks-per-node=8, -ntasks (processes srun will start)one task per GPU (srun launches the ranks), or one per node (torchrun launches them)
-c 12 / --cpus-per-taskCPUs per taskdata-loader workers
--gres=gpu:8 or --gpus-per-node=8GPUs on each nodewhole-node training jobs
--gpus=16GPUs for the whole job, spread as Slurm likesrarely what training wants: the split per node is not fixed
--gpus-per-task=1, --cpus-per-gpu, --mem-per-gputie CPUs and memory to GPUsshared nodes: keeps each GPU's CPU and memory share fixed
--exclusive, --mem=0whole nodes shared with no one; all of each node's memorybig training jobs; benchmarking

The rule behind it: a GPU is schedulable only with the CPUs and memory that come with it. One task per node takes all the node's CPUs, and under CR_Core_Memory a job without --mem on a cluster whose default is the whole node takes all its memory. Check AllocTRES in scontrol show job against what you meant after submitting anything new.

Predict: the running example asks --nodes=2 --ntasks-per-node=1 --cpus-per-task=2 --gres=gpu:2, and this cluster bills a GPU 1.0 and a CPU 0.25. What does sacct show as its AllocTRES?
billing=5,cpu=4,gres/gpu=4,node=2 (section 2's sacct): --gres and --ntasks-per-node are per node, so 2 nodes give 2 x 2 CPUs and 2 x 2 GPUs; billing is 4 x 1.0 + 4 x 0.25 = 5. The batch step 79.batch shows only the first node's share, cpu=2,gres/gpu=2.

Which GPU is mine? On a real node gres.conf maps each GPU to its device file (Name=gpu File=/dev/nvidia[0-7], or AutoDetect=nvml), and Slurm sets CUDA_VISIBLE_DEVICES for every job and step to the GPUs it was given. Only cgroups make that a fence: with TaskPlugin=task/cgroup, ProctrackType=proctrack/cgroup and ConstrainCores, ConstrainRAMSpace, ConstrainDevices in cgroup.conf (each "no" by default, cgroup.conf), the job's processes cannot see other GPUs or use other cores, and are killed past their memory (state OUT_OF_MEMORY). Without them a process can open every GPU on the node, as on this lab cluster, where cgroups are off (inside a container without systemd, slurmd 24.11 stops with fatal: systemd scope for slurmstepd could not be set). How cgroups work is owned by Containers and isolation.

Topology. Where the nodes sit decides all-reduce speed: topology/tree (switches) and topology/block (blocks of nodes such as NVL72 racks; both in 24.11, and 25.05 added several topologies in one topology.yaml, topology docs) keep a job inside one switch or block, and --switches=1@01:00:00 waits up to an hour for that. The networks themselves are Cluster anatomy's.

What each task sees: rank variables from a four-task step (measured)
$ srun -l bash -c 'echo rank=$SLURM_PROCID local=$SLURM_LOCALID node=$(hostname) gpus_on_node=$SLURM_GPUS_ON_NODE cuda=${CUDA_VISIBLE_DEVICES:-unset}'
0: rank=0 local=0 node=c1 gpus_on_node=2 cuda=unset
1: rank=1 local=1 node=c1 gpus_on_node=2 cuda=unset
2: rank=2 local=0 node=c2 gpus_on_node=2 cuda=unset
3: rank=3 local=1 node=c2 gpus_on_node=2 cuda=unset

On a real GPU node cuda= would print the GPU indices; here there are no devices to name. SLURM_PROCID is the global rank, SLURM_LOCALID the rank on the node (which picks the GPU when srun launches one task per GPU).

The same 6 GPUs asked two ways: one strands 2 GPUs, one does not

Two nodes of 4 CPUs and 4 GPUs; one square is one CPU or one GPU. Measured in the root's Scheduling lab on this cluster (scontrol -d show job, 16 Oct 2026): the first form got NumCPUs=8 (c1 CPUs 0-3 and GPUs 0-3, c2 CPUs 0-3 and GPUs 0-1), so the next 2-GPU job sat in (Resources) while sinfo showed GPUs free. The second form got exactly 6 CPUs; its split across nodes was not recorded, so the drawing's split is illustrative.

Four steps side by side: 12 s without --exact, 6 s with it measured

Each bar is a step as sacct recorded it (start, end, node, CPUs). The allocation holds 2 CPUs and 2 GPUs on each of c1 and c2. Jobs 129 (without) and 126 (with), 16 Oct 2026; one-second resolution.

4. Job steps: the processes inside an allocation

An allocation is only a reservation; srun starts the processes. Each srun in a script is one job step: it asks the controller for a slice of the allocation, slurmd on each node starts a slurmstepd, and that starts the tasks, gives each its rank and collects their exit codes. Steps run one after another (preprocess, train, evaluate) or side by side (a sweep of small runs inside one big allocation).

The trap. By default a step may use every CPU of the job on each of its nodes ("By default, all non-GRES resources on each node in the step allocation will be used", srun --exact), so steps meant to run side by side queue behind each other. Predict how long four 6-second one-task steps take in a 2-node allocation of 2 CPUs per node, then watch:

  1. 0 to 6 s: one step per node. Four srun -n1 -N1 sleep 6 & start together. Without --exact (job 129, submitted without --cpus-per-task) each step is given both CPUs of its node (AllocTRES cpu=2), so one runs on c1, one on c2, and the other two wait; srun prints nothing.
  2. 6 to 12 s: the second wave. The first two end and the waiting two get in; only then does srun print srun: Step created for StepId=129.4.
  3. Done at 12 s: two waves for four 6-second steps.

A subtlety: a job submitted with --cpus-per-task exports SLURM_CPUS_PER_TASK, and srun treats that as an explicit -c, which "implies --exact" (srun's -c entry): the same steps without --exact inside a job with --cpus-per-task=1 (job 130) ran side by side. So a step's behaviour depends on how its job was submitted: write --exact when you mean it, and -N1 for one-task steps in a multi-node job.

$ srun -n 8 true          # inside an allocation of 4 tasks
srun: error: Unable to create step for job 80: More processors requested than permitted
$ srun -n1 sleep 6        # inside a 2-node allocation, without -N1
srun: warning: can't run 1 processes on 2 nodes, setting nnodes to 1

Overlap. Steps never share CPUs unless asked: srun --overlap --jobid=N --pty bash runs a step on resources another step holds, which is how you attach a debugger or py-spy to a running training step. For training the usual layout is one step that starts everything: one torchrun per node (the running example, section 13), or one task per GPU with ranks from SLURM_PROCID. Launching distributed training compares the launchers, and Distributed PyTorch owns torchrun at the PyTorch level.

5. Partitions, QOS and associations: who may use what

A shared cluster needs rules beyond first come, first served: one team may not take every GPU, debug jobs must start fast, a huge job may run only at night. Slurm has three places to put a rule, and a pending job's reason names the one holding it.

All three were accepted and will never start: 8 GPUs exceed sl-small's 4 per user, 4 GPUs exceed carol's 2, and 120 minutes exceed batch's MaxTime=60. A job that breaks a limit on its own pends forever unless its QOS has the DenyOnLimit flag (then it is refused at submission), and a job over a partition's time limit is accepted unless EnforcePartLimits is set. Carol's priority, 6500, was the highest of the three: priority and limits are separate questions. squeue --start printed N/A for job 88 but a start time for 92 and 93, so a start time is not a promise that a job can run.

When several places define the same limit, the first found wins, in this order: partition QOS, job QOS, user association, account associations up the tree, root, partition (resource limits). And none of it applies unless AccountingStorageEnforce includes limits and qos: the default is none, as on this lab cluster, so for these runs it was set to associations,limits,qos.

The setup commands, and requests refused at submission (measured)
$ sacctmgr -i add qos sl-high Priority=100
$ sacctmgr -i add qos sl-small Priority=20 MaxTRESPerUser=gres/gpu=4
$ sacctmgr -i modify user where name=alice,bob,carol set qos+=sl-high,sl-small
$ sacctmgr -i modify user where name=carol set GrpTRES=gres/gpu=2
$ sacctmgr show assoc format=account,user,grptres,qos
   Account       User       GrpTRES                            QOS
---------- ---------- ------------- ------------------------------
      root                                                  normal
     teama                                                  normal
     teama      alice                      normal,sl-high,sl-small
     teama      carol    gres/gpu=2        normal,sl-high,sl-small
     teamb                                                  normal
     teamb        bob                      normal,sl-high,sl-small
$ squeue
JOBID         NAME   USER PARTITI       QOS ST PRIORITY NODES CPUS NODELIST(REASON)
   92    sl-g-qmax  alice   batch  sl-small PD     4733     2    8 (QOSMaxGRESPerUser)
   93   sl-g-assoc  carol   batch    normal PD     6500     1    4 (AssocGrpGRES)
   88     sl-g-ptl  alice   batch    normal PD     3750     1    1 (PartitionTimeLimit)

Some requests never reach the queue, because no node could ever satisfy them. Requested node configuration is not available covers 5 GPUs on a 4-GPU node, 4 nodes on a 3-node partition, 8,000 MB on a 4,000 MB node and 5 CPUs per task on a 4-CPU node alike; compare your request with scontrol show node and the partition's limits:


The controller's log names the cause the user does not see: _pick_best_nodes: JobId=97 never runnable in partition batch, _build_node_list: No nodes satisfy JobId=99 requirements in partition batch, error: Invalid qos (nope). Every reason Slurm knows, and a decoder for limit names, is in the Why pending? tab.

Each limit lives at one level, and the reason names that level

The three jobs this page submitted to break one rule each, while every GPU was busy (squeue at 05:38:07 UTC, 16 Oct 2026). Partition: a named set of nodes with MaxTime, MaxNodes, a default time, who may submit, PriorityJobFactor and PriorityTier, in slurm.conf; partitions may overlap (here batch, urgent and sllow all cover c[1-3]). Association: a (cluster, account, user) triple in slurmdbd; accounts form a tree with fairshare shares and limits such as GrpTRES=gres/gpu=64 (the whole team at once) or MaxJobs, set with sacctmgr. QOS: a named bundle of a priority, limits (MaxTRESPerUser, MaxWall, GrpTRES) and preemption rules that a job selects with --qos; typical are debug (high priority, 1 node, 30 minutes), normal and scavenger (lowest, preemptible).

6. The scheduler: a main loop and a backfill loop

Testing every job against every node on every change is too slow, and starting jobs in strict priority order wastes nodes that a big job at the head cannot use yet. So the controller runs two loops. The main loop runs on every event (a job submitted or ending, a node returning) and every sched_interval (60 s by default, ); it walks pending jobs in priority order, starts each one that fits now, tests at most default_queue_depth jobs on an event (100 by default), and the moment one job of a partition cannot start, starts nothing else in that partition or on its nodes in that pass. The backfill loop runs every bf_interval (30 s by default, 2 s here): it builds a timeline from every running job's time limit, reserves the earliest start for each waiting job in priority order, and starts a lower job that fits a gap and ends before any reservation it would cross. Slurm's version reserves for every job it tests (conservative) and reserves whole nodes.

The main loop stops at the first blocked job; backfill fills the gap it leaves

  1. Minute 5. Job A runs on c1 and c2 with a 40-minute limit; c3 is idle. Three jobs wait, in priority order: B wants all 3 nodes for 30 minutes, C one node for 20, D one node for 60.
  2. The main loop. B is first and needs 3 nodes; only c3 is free, so B cannot start: reason Resources. The loop now starts nothing else in this partition, so C and D are not even tried: reason Priority. c3 stays idle.
  3. Backfill plans. It cannot know runtimes, so it assumes A runs to its limit (minute 40) and reserves all 3 nodes for B from 40 to 70. This is what squeue --start shows.
  4. Backfill fills the gap. C needs one node for 20 minutes; on c3, from minute 5 to 25, it ends before B's reservation at 40, so backfill starts it now. B is not delayed.
  5. A job that does not fit. D asks for 60 minutes; on c3 it would run past 40 and delay B, so it waits. Slurm reserves a start for every job it tests (here 70). A shorter limit is D's only way in.
  6. A ends at 15, 25 minutes before its limit. The job-end event runs the main loop at once; B still needs c3, which C holds until at most 25, so B waits, but its planned start moves from 40 to 25 (and D's from 70 to 55). A plan is an upper bound that moves earlier: job 79 started 34 s before its plan.
  7. C ends at 25. The main loop starts B on all three nodes, 15 minutes before the first plan. Backfill used c3 for C without costing B a minute.

Three nodes, four jobs, time in minutes along the floor; solid blocks run, glass blocks are backfill's reservations, the outline on job A is its time limit, the red pane is now. Jobs and sizes are illustrative; the rules are the source's. The root's Scheduling lab runs a real eight-job queue under FIFO and backfill on this cluster.

That rule is where the two most common reasons come from: the first blocked job of a partition shows Resources, and every job behind it shows Priority ("a job ahead of me is waiting"). Backfill is the only way a job jumps that line, and it needs your time limit to do it: a 2-hour job asking for 24 hours fits no gap. Either loop may start any job, and the log says which (sched: Allocate for the main loop, sched/backfill: _start_job for backfill): on the idle cluster job 125 was started by backfill 444 ms after sbatch, because this cluster's sched_min_interval=500000 (0.5 s) keeps the main loop from running more than twice a second and the backfill cycle came first.

A message that misleads: "Nodes required for job are DOWN, DRAINED or reserved for jobs in higher priority partitions" measured
Job 91, in partition sllow (same nodes as batch, same tier), pended with exactly this reason although every node was up and nothing was drained. When batch's top job could not start, the main loop removed batch's nodes from the rest of that pass, so sllow saw zero usable nodes and the code fills in its generic text (the source below). On clusters with overlapping partitions this reason usually means "a higher-priority job in another partition is waiting for these nodes". Check sinfo before calling the administrators.
The source lines, and sdiag: how to look inside both loops (source and measured)
The main loop stops a partition at its first blocked job

On an event it tests a limited depth

The generic "DOWN, DRAINED" text

sdiag prints both loops' statistics. Over this page's 3.7 minutes of experiments:

cyclesper minutemean cyclemax cycleother
main loop3913172 µs945 µsnever hit default_queue_depth
backfill65409 µs939 µs9 jobs started by backfill, 2 of them heterogeneous-job components; mean depth 6 jobs

sdiag at 05:40:22 UTC, statistics since the reconfigure at 05:36:40 (src/runs/raw1/acct.txt). On a large cluster backfill cycles take seconds; when Backfill exit shows Hit bf_max_job_test or Timeout (bf_max_time), jobs deep in the queue are never considered for backfill at all. The knobs: bf_max_job_test, bf_max_job_user (a cap per user so one user's thousand jobs do not fill the test budget), bf_continue and bf_max_time.

7. Priority: one number per job

The main loop walks jobs in priority order, so the whole policy of who goes first is how that number is computed. With PriorityType=priority/multifactor it is a weighted sum of factors, each between 0 and 1, then truncated to an integer. A concrete case first: for this page's gallery run the weights were age 1,000, fairshare 10,000, job size 1,000, partition 1,000, QOS 2,000 and GPU TRES 500 (the cluster's normal configuration uses only fairshare and age; the variant is src/scripts/sl_slurm.conf). Fifteen jobs waited behind bob's 12-GPU job, and sprio was read twice, 51 seconds apart. Nobody touched anything in between:

Predict: bob's job 95 had the highest priority of all at 05:38:07 (9,166). At 05:38:58 it was the lowest of the eleven jobs with a priority (4,250). What changed?
Fairshare: bob's own running job raised his team's usage, and Fair Tree ranked him last. Steps 2 to 5 on the right show it.

The same queue, 51 seconds later: fairshare reorders it

  1. 05:38:07: the queue. The eleven jobs with a priority, in the order the main loop would try them. Bob's job 95 leads with 9,166, of which 7,500 is fairshare.
  2. Why bob led. Fair Tree compares teams first: teamb had used less than teama (EffectvUsage 0.31 against 0.69 in sshare), so bob ranked 3 of the 4 users (root, alice, carol, bob), a factor of 0.75: 7,500 points; alice got 0.25 (2,500) and carol 0.5 (5,000).
  3. Bob's own job keeps running. His 12-GPU job 81 charges teamb 15 billing units per second (12 GPUs at 1.0 plus 12 CPUs at 0.25). 51 s later teamb's raw usage is 1,078 against teama's 724, and EffectvUsage reads 0.60 against 0.40.
  4. Fair Tree re-ranks. Bob drops to rank 1 (0.25: 2,500 points); alice rises to 0.5 (5,000) and carol, who ran nothing, to 0.75 (7,500), moving with her team. That swing of 5,000 points dwarfs every other factor: age added 83 to 87 points.
  5. 05:38:58: the queue re-sorted. Job 95 falls from first to last of the eleven, at 4,250 (in squeue only the two held jobs, at 0, sit below it); carol's job 93 leads at 9,083 but still cannot run (AssocGrpGRES): priority and limits are separate questions.

Each column is one job's priority as sprio -l printed it: the coloured block is its fairshare points (alice blue, carol teal, bob purple), the white block the other factors, less any nice penalty; job 89's red glass top is its nice penalty, the points it gave up. Held jobs (priority 0) and jobs not yet eligible are left out. Back row: each team's EffectvUsage from sshare. Per-job sums are in the calculator below. measured

priority = Wage·age + Wfs·fairshare + Wsize·jobsize + Wpart·partition + Wqos·qos + Σ Wtres·tres − nice
age
time eligible (since AccrueTime) over PriorityMaxAge, capped at 1. A job held by a dependency or a begin time does not accrue (jobs 84 and 85 showed AccrueTime=Unknown).
fairshare
with Fair Tree (the default), the user's rank in the account tree divided by the number of users: heavy recent use, decayed with PriorityDecayHalfLife, means a low factor. The root's Scheduling lab has a Fair Tree calculator.
jobsize
by default favours large jobs: (nodes / cluster nodes + CPUs / cluster CPUs) / 2.
partition
the partition's PriorityJobFactor over the largest one.
qos
the QOS's priority over the largest QOS priority.
tres
each TRES the job asks for over the partition's total, with its own weight (PriorityWeightTRES=GRES/gpu=500).
nice
subtracted as is (--nice=1500); users may only lower their own priority.

Two things that surprise people. sprio shows factors as of the last recalculation, not now: at 05:38:58 the age factor of jobs eligible since 05:37:48 read 0.0867, which is 52 s over 600, so they were computed at about 05:38:40 (one PriorityCalcPeriod after the previous one). And the printed parts need not add up: job 82's parts were 86.67 + 5,000 + 500 + 1,000 + 333.33 = 6,920.0, printed 6,920, while sprio -l rounds each part (87, 333). Defaults: PriorityDecayHalfLife 7 days and PriorityCalcPeriod 5 minutes (); this cluster uses 10 minutes and 1 minute so a lab can watch them move. Most sites make fairshare dominant, age stops starvation, and QOS gives fast lanes such as debug.

Recompute any row: the calculator lands on sprio for all 22 rows

The formula as Slurm 24.11.5 computes it (set_priority_factors() and _get_priority_internal() in priority_multifactor.c): factors times weights, summed as doubles in the source's order, minus nice, truncated. Defaults reproduce every sprio row of the gallery run, independently (src/scripts/recompute.py does the same in Python). Predict what doubling the fairshare weight does to job 95's rank at 05:38:58, then change it.

All 22 rows: calculator against sprio, and the one that needs Slurm's arithmetic (measured)
timejobuserinputscalculatorsprio

Inputs per row: the age and fairshare factors as sprio -n printed them (7 decimals; age as seconds = factor × 600), requested nodes, CPUs and GPUs from scontrol show job (ReqTRES), partition, QOS and nice. Click a row to load it. Fairshare is an input here: Fair Tree's rank of the user among all users (here 4: root, alice, carol, bob), which depends on every account's decayed usage. The lab cluster's size: 3 nodes, 12 CPUs, 12 fake GPUs; partition factors batch 1.0 (PriorityJobFactor 2), sllow and urgent 0.5; QOS factors normal 0, sl-small 0.2, sl-high 1.0.

Truncation, not rounding: job 90 sums to 8,584.999... and prints 8584
Source: the sum, then truncation to an integer, and 0 reserved for held jobs

The factors are computed in set_priority_factors(): age , job size , partition , QOS , TRES .

8. Preemption and requeue: taking nodes back

The cluster is full of long training jobs and an urgent job arrives (an evaluation before a deadline, a team whose guaranteed share others are using). Preemption lets the scheduler stop running jobs to make room; the same requeue machinery serves time limits.

SettingChoices
PreemptType: who may preempt whompreempt/partition_prio: a job in a partition with a strictly higher PriorityTier preempts jobs of lower tiers (this cluster: urgent tier 10 over batch tier 1). preempt/qos: each QOS lists the QOS it may preempt (sacctmgr modify qos high set preempt=scavenger). preempt/none.
PreemptMode: what happens to the victimCANCEL (killed), REQUEUE (killed and put back in the queue, needs --requeue; otherwise cancelled), SUSPEND (paused in memory; needs GANG at cluster level, and keeps GPU memory occupied, so it is rarely practical for GPU jobs), GANG (time slicing on the same resources), OFF (preemption docs).
GraceTimethe victim gets SIGCONT and SIGTERM at once and SIGKILL only after GraceTime (default 0): the window to write a checkpoint.

For training the usual choice is REQUEUE with a GraceTime long enough to checkpoint, with low-priority work in a preemptible QOS or partition. The root's Scheduling lab preempted bob's 12-GPU batch job with a 4-GPU urgent job on this cluster: preempted JobId=39 has been requeued to reclaim resources for JobId=40, the urgent job was allocated 0.6 s after submission, and the victim could not restart for 121 s. GPU-hours lost per preemption are the time since the last checkpoint times the GPUs, the trade-off the root's Failure lab turns into a checkpoint interval.

Two lessons for a checkpoint budget. The signal "may be sent up to 60 seconds earlier than specified" because of how Slurm resolves events (sbatch --signal), so ask for more warning than a save takes, plus a minute. And a requeued job's begin time is pushed past the job credential's lifetime (120 s by default) plus 1 s, so the old run's credentials and I/O are gone before the new run starts: budget two minutes of dead time per requeue, for preemption and for time limits alike. SLURM_RESTART_COUNT tells the script it is a restart; the running example instead finds its latest checkpoint pointer and resumes from it. A 30-day run on a cluster whose maximum job time is 2 days is a chain of such hops (or of afterany jobs, section 9).

The script, its output, sacct -D, and the tier test in the source (measured and source)



Job 128: src/scripts/sl_sig.sbatch, its output, and sacct -D (both runs of the same job id). A job owner may scontrol requeue their own job.

In partition_prio, a strictly higher tier is the test

Checkpoint before the limit, then two minutes of dead time: job 128 measured

--time=1 --signal=B:USR1@25 --requeue: Slurm should signal the batch shell 25 s before the 60 s limit; the script traps SIGUSR1, saves, and runs scontrol requeue; the next start resumes. The signal came 12 s after the start, not 35 s; the requeued job became eligible at 05:44:53, 121 s after the requeue, and finished from its checkpoint. 16 Oct 2026, sacct -D.

9. Arrays, dependencies and heterogeneous jobs: workflows inside Slurm

Real work is rarely one job: a sweep is 50 nearly identical jobs; a pipeline is "tokenise, then train, then evaluate, and clean up if training fails"; an RL setup wants a CPU-only controller beside GPU workers, started together. All three tools were run here at once:

sbatch --array=0-5%2 ...                          # 6 tasks, at most 2 running at a time
sbatch -J sl-prep ...                              # job 103
sbatch -J sl-train --dependency=afterok:103 ...     # 106: only if prep exits 0
sbatch -J sl-eval  --dependency=afterok:106 ...     # 107
sbatch -J sl-fail --wrap 'sleep 5; exit 3'         # 108: fails on purpose
sbatch -J sl-clean  --dependency=afternotok:108 ... # 109: only if 108 fails
sbatch -J sl-report --dependency=afterok:108 ...    # 110: only if 108 succeeds
sbatch -J sl-single --dependency=singleton ...      # 111 and 112: same name, one at a time
  • Arrays. One submission, one job id (102), tasks 102_0 to 102_5, each with SLURM_ARRAY_TASK_ID set (the script picks its hyperparameters or shard from it). %2 throttles: tasks 2 to 5 pended with reason JobArrayTaskLimit and started in pairs. Until a task starts, the pending tasks are one record in the controller, which is why a 1,000-task array costs the scheduler far less than 1,000 jobs; the default MaxArraySize is 1001 (), so --array=0-1000 is the largest by default.
  • Dependencies. sl-train became eligible the second sl-prep ended (+10 s), sl-eval when sl-train ended; afternotok ran the cleanup because 108 exited 3. sl-report, waiting on afterok:108, can never run, and Slurm says so but leaves it queued (DependencyNeverSatisfied):
    
    Without --kill-on-invalid-dep=yes (or the cluster-wide kill_invalid_depend) such jobs sit in the queue forever. singleton held the second sl-single until the first ended. The types: after, afterany, afterok, afternotok, aftercorr (task by task between two arrays), singleton (sbatch --dependency).
  • Heterogeneous jobs. One job with differently shaped components, allocated together (all or none, so the gang rule still holds) and launched with srun --het-group: job 116's component 116+0 got one CPU on c3 and no GPU, component 116+1 two GPU nodes, and backfill started both together.

When to use what. Sweeps of small runs: an array with a throttle. A pipeline: dependencies, or an outside workflow engine (Airflow, Flyte, Metaflow submit jobs and watch them; ML platforms and workflows). A long run cut into time-limited pieces: one job that requeues itself (section 8) or a chain of afterany jobs that each resume from the latest checkpoint.

The heterogeneous job: script, output, sacct (measured)



Job 116, 16 Oct 2026. sdiag counted "2 heterogeneous job components" started by backfill.

Eligible is not started: what sacct recorded measured

Thin grey: submitted, not yet eligible (a dependency or the array throttle). Bar: running, on the node shown. Every job asks for 1 fake GPU except sl-train (4). 16 Oct 2026, one-second resolution; seconds from submission.

10. Reservations: holding nodes for a time or a team

Some capacity must be guaranteed in advance: a maintenance window, a week of 512 GPUs promised to one team for a big run, a demo. A reservation is a named block of nodes (or cores) for a time window, usable only by the users or accounts it names (scontrol create reservation, by an administrator). A maintenance window on all three nodes, starting in 3 minutes for 5 minutes, then three jobs measured:

The 2-minute job fitted before the window and ran; the 4- and 10-minute jobs could not finish before it and pended with ReqNodeNotAvail, Reserved for maintenance, planned for 05:47:57, its end. This is the most common surprise before a maintenance: ask for less time, or wait. After scontrol delete ReservationName=sl_maint the 10-minute job started at once. The source sets that reason when a job's time window overlaps a MAINT reservation .

A team reservation, node c3 for alice for 10 minutes: alice's job naming --reservation=sl_team ran on c3, her job without it on c1; bob's 3-node job pended with ReqNodeNotAvail, May be reserved for other job and his 2-node job with Resources. Only a job that names the reservation can use it. Flags change the rules: FLEX lets a job use nodes inside and outside, MAINT marks the time as maintenance in accounting, IGNORE_JOBS creates it even if running jobs overlap. For a training team the useful pattern is a recurring or long reservation on a block of nodes in one network domain, so a large job never waits behind fragmentation.

Both reservations as squeue printed them (measured)
$ squeue                                   # 8 s after the maintenance reservation
JOBID         NAME   USER ST PRIORITY NODES CPUS NODELIST(REASON)
  118    sl-r-long  alice PD     6833     2    8 (ReqNodeNotAvail, Reserved for maintenance)   # --time=10
  120     sl-r-mid    bob PD     4000     1    4 (ReqNodeNotAvail, Reserved for maintenance)   # --time=4
  119   sl-r-short  alice  R     6500     1    4 c1                                            # --time=2
$ squeue --start
  118    sl-r-long PD  2026-10-16T05:47:57 (ReqNodeNotAvail, Reserved for maintenance)
  120     sl-r-mid PD  2026-10-16T05:47:57 (ReqNodeNotAvail, Reserved for maintenance)
$ scontrol delete ReservationName=sl_maint ; squeue     # 6 s later
  120     sl-r-mid    bob PD     4000     1    4 (Resources)
  118    sl-r-long  alice  R     6833     2    8 c[2-3]
  119   sl-r-short  alice  R     6500     1    4 c1
$ scontrol create reservation ReservationName=sl_team StartTime=now Duration=10 Nodes=c3 Users=alice
$ squeue
  121   sl-t-bob12    bob PD     4666     3   12 (ReqNodeNotAvail, May be reserved for other job)
  122    sl-t-bob8    bob PD     4333     2    8 (Resources)
  123    sl-t-resv  alice  R     6500     1    4 c3     # --reservation=sl_team
  124   sl-t-nores  alice  R     6500     1    4 c1     # no reservation: ordinary nodes

Free nodes, and a job that will not start: its time limit crosses the window

scontrol create reservation ReservationName=sl_maint StartTime=now+3minutes Duration=5 Nodes=ALL Flags=MAINT,IGNORE_JOBS Users=root, window 05:42:57 to 05:47:57; three jobs submitted at 05:39:57 (src/runs/raw1/resv.txt). Bars are each job's time limit from submission.

11. Accounting: what ran, and what it used

The controller forgets finished jobs after MinJobAge (300 s by default, ; 600 s on this cluster); slurmdbd keeps them.

  • sacct: one row per job and per step, any field (AllocTRES, Elapsed, State, ExitCode, NodeList, Reason, Eligible). -X drops the steps, -D shows every requeued run, -P gives pipe-separated output. A job's GPU-hours are gres/gpu in AllocTRES times Elapsed. Cancelled pending jobs have empty AllocTRES: they never held anything.
  • sreport: summaries (cluster utilisation, top users) from rollups the database computes hourly. Asked for this page's last few minutes it printed headers and no rows measured: use sacct for recent jobs.
  • sstat: live usage of a running step. It needs the job accounting plugin to read real per-process numbers; in these containers without cgroups it printed nonsense (AveCPU 213503982+, no MaxRSS), so it is not used here.
  • sacctmgr: the database's users, accounts, QOS and limits (section 5).
sacct -X over this page's session (measured)

16 Oct 2026, lines selected.

12. Containers on Slurm described, not run here

A training job needs an exact stack (CUDA, NCCL, PyTorch, your code) on nodes that share one OS image, and nobody gets root. The common answer on GPU clusters is Pyxis with enroot (NVIDIA): Pyxis is "a SPANK plugin for the Slurm Workload Manager" (SPANK: Slurm's plugin interface for job options) that adds --container-image, --container-mounts and --container-name to srun, so srun --container-image=nvcr.io#nvidia/pytorch:<tag> --container-mounts=/data:/data python train.py runs every rank in the image; enroot imports a Docker image into a squashfs file and runs it without root, and pyxis requires enroot 3.1.0 or later (pyxis README). Not run here because this cluster is itself made of containers; what matters (image pull time on thousands of nodes, squashfs caching on local NVMe, the driver binding) needs real nodes.

The other ways: Apptainer, Slurm's OCI support, plain Docker
WayHowNotes
Apptainer (formerly Singularity)srun apptainer exec --nv image.sif python train.pyone-file images (.sif), run as the user; --nv exposes the host's GPU devices and binds in its CUDA libraries (Apptainer GPU docs).
Slurm's own OCI supportsrun --container=/path/to/bundle ..., configured by oci.conf (runc, crun, ...); scrun lets rootless Docker or Podman run jobs (Slurm 23.02 and later)"The bundle must already exist on the requested path on the execution node" (containers docs).
plain Dockernoneeds a root daemon; the Slurm docs list the security options and networking it must give up to be used through scrun.

The lab nodes' image already contains the running example and torch 2.14.1, so nesting a runtime inside would show nothing a real GPU node does.

Slurm on Kubernetes: Slinky and SUNK (described, not run here)

Organisations that want one GPU pool for batch training (driven with sbatch, fairshare and backfill) and long-running services that Kubernetes runs well can run Slurm inside Kubernetes rather than split the GPUs between two clusters, one idle while the other queues.

  • Slinky (SchedMD's own): a Kubernetes operator that "contains a Kubernetes operator to deploy and manage certain components of Slurm clusters". Workers are NodeSets, "A set of homogeneous Slurm workers (compute nodes)", run as a StatefulSet or a DaemonSet of slurmd pods, each pod's status reflecting its Slurm node state; the controller is a pod too, with high availability through a ReadWriteMany volume. Its compatibility table lists releases 1.0 to 1.3, each needing Slurm 25.11 or later (slurm-operator README); the latest release when this page was written was v1.2.3 (30 September 2026, root's Tool map). SchedMD open-sourced it in November 2024 (Apache-2.0) and reached 1.0 in late 2025; a second Slinky project, slurm-bridge, goes the other way and lets Slurm be the scheduler for Kubernetes pods so both kinds of work share one GPU pool (Slinky docs). Not run on the topic's kind cluster: it needs Slurm 25.11+ images and more memory than the topic's budget.
  • SUNK (CoreWeave): "Each Slurm compute node is a Pod running slurmd, placed one-to-one on a Kubernetes Node"; a SUNK Pod Scheduler places Kubernetes pods "through Slurm's own scheduling logic, on the same Nodes as Slurm jobs", and a Syncer "mirrors state between Slurm nodes and their Pods in both directions" (SUNK docs, vendor). A CoreWeave product since 2023 with no public repository: Slurm accounting in MySQL, node lifecycle tied to CoreWeave's node health checks, available only on CoreWeave Kubernetes Service.
  • Which: Slinky on any Kubernetes cluster, SUNK when renting from CoreWeave; neither if researchers are content with Kubernetes-native jobs.
  • Managed Slurm in clouds: AWS SageMaker HyperPod launched with Slurm in November 2023 (root's Tool map).

What you get, and what it costs. Slurm's semantics stay intact (all-or-nothing allocations, fairshare, backfill) while Kubernetes handles node lifecycle, images, monitoring and the services beside the jobs. The cost is two control planes that must agree about every node, a slurmd that lives in a pod (its cgroups, devices and network are whatever the pod is given), and failure modes from both. Choosing between Slurm, Kubernetes with Kueue, and Ray is the root's comparison; Kubernetes for ML owns the Kubernetes side.

13. A multi-node training job, line by line

The job file every Slurm run of this topic used (src/data/slurm/train.sbatch in the root), with what each line does:


It gives the same global loss as on Kubernetes and Ray, 2.2638769149780273 at step 200, in both of this page's runs. For a real cluster the same file needs five more things, each a lesson of a section above:

  1. A realistic time limit and a signal before it: --time= what the run needs plus a margin, --signal=B:USR1@300 and a trap that checkpoints (section 8); long runs are chains of such jobs, and backfill can only help a job whose limit is honest (section 6).
  2. Whole nodes: --exclusive, --gpus-per-node=8, --mem=0, so no other job shares the node's network cards or memory bandwidth, and nothing is stranded (section 3).
  3. A health check before training: in the site's prolog or as the first step (srun --ntasks-per-node=1 check_gpus.sh), so a bad node fails the job in seconds rather than hanging NCCL; the root's Failure lab built a HealthCheckProgram that drains its node.
  4. Topology: --switches=1@00:30:00 or a block, where the site models it (section 3).
  5. Launcher settings: NCCL and rendezvous variables and timeouts, owned by Launching distributed training.

Depth

Checks before blaming the cluster (the mistakes that each section's evidence shows)
  • (Priority) for hours with idle GPUs: squeue --start and sprio for the jobs ahead in the same partition; whether the idle GPUs come with free CPUs and memory (scontrol show node, AllocTRES); the job's time limit against the gap before the next reservation, maintenance included; overlapping partitions; limits on its QOS or account (a limit reason would name them); fairshare (sshare).
  • Is a job fenced in? scontrol show config | grep -i -E 'TaskPlugin|ProctrackType' and cgroup.conf: without task/cgroup and ConstrainDevices=yes, one user's job can slow another's on a shared node.
  • Test configuration changes on a copy first: a node declared with more than it has goes out of service at the next registration (section 1).
Design rehearsal: a 1,000-GPU lab shared by three teams (optional)

125 nodes of 8 GPUs; research jobs, production training runs and evaluation.

One controller with a backup on a second host and slurmdbd on its own host; configless nodes; cgroups with device and memory confinement; GPUs per node as GRES with NVML autodetection; a health-check prolog and HealthCheckProgram that drain bad nodes. Partitions: one main partition of all nodes (whole-node jobs, --exclusive default for multi-node), a small interactive or debug partition, and topology modelled (blocks or switches) so big jobs stay in one network domain. Accounts per team with fairshare shares matching what each funds, Fair Tree, decay half-life of a week; QOS normal, high (production runs, limited GPUs per team, can preempt), debug (1 node, 1 hour, high priority) and scavenger (any idle GPUs, preemptible with REQUEUE and a GraceTime of a few minutes). Reservations for a production run that needs 512 GPUs for a week, and for maintenance. Backfill on, with bf_max_job_user. Accounting in GPU-hours per team, reported weekly.

Trade-offs to say: whole-node allocation wastes capacity on small jobs (hence the shared debug partition), preemption costs the scavenger jobs their work since the last checkpoint, and strict fairshare can make a team with one huge run wait behind many small jobs of others (hence a reservation or high QOS for planned runs).

And why Slurm needs no gang-scheduling add-on while Kubernetes does: a Slurm job is one allocation, all nodes or none, before any process starts; Kubernetes' default scheduler places pods one at a time and knows nothing of the job they belong to, so two half-placed jobs can deadlock without Kueue, Volcano or a coscheduling plugin (the root's Scheduling lab reproduces it).

Every command output on this page was produced on the topic's lab cluster on 16 October 2026 (Slurm 24.11.5, Debian 13 package, in Docker Desktop on an Apple M1 Pro, shared machine; fake count-only GPUs). Scripts in src/scripts/, scrubbed raw outputs in src/runs/, source extracts in src/inputs/. The cluster's configuration was changed only for these runs and restored from the root's src/data/slurm/slurm.conf after each.