Slurm for GPU Clusters

Running GPU clusters on Slurm: GPU GRES and cgroups, topology-aware placement, partitions, QOS and fair share, preemption, node states and health checks, containers with pyxis, multi-node torchrun, and the failures you will debug.

Overview

Why Slurm

Most on-prem GPU training clusters, and most supercomputers, schedule with Slurm. It treats a node as a set of CPUs, memory and generic resources (GRES) such as GPUs, keeps a queue per partition, and starts each job only when every node it needs is free at once. For multi-node training that all-or-nothing start (gang scheduling) is exactly what you want.

Four daemons divide the work.

  • slurmctld runs on the controller, plus a backup. It owns the queue, priorities, placement and node states.
  • slurmd runs on every compute node. It starts job steps and reports health and resources.
  • slurmdbd runs on an accounting host. It keeps the usage history behind fair share, sacct and QOS limits.
  • slurmrestd is optional. It offers a REST API for portals and automation.

The controller decides where and when a job runs, and slurmd on each node enforces the allocation with cgroups. A GPU job's life takes five steps.

  • The user submits a batch script with its resource request: sbatch train.sh.
  • The slurmctld queue orders pending jobs by priority and checks QOS and account limits.
  • The controller picks nodes with free GPUs, allocating whole sets of nodes and GPUs and preferring nodes under the same switch.
  • The slurmd daemon on each node runs the prolog and puts the job in a cgroup that sees only its GPUs. The job's srun steps start with CUDA_VISIBLE_DEVICES set.
  • When the job ends, the epilog cleans up, and the accounting record in slurmdbd feeds future fair-share priority.

Interview questions

  • Configure a 32-node H100 cluster in Slurm so jobs get exactly the GPUs they ask for, on well-placed nodes.
  • Launch a 4-node, 32-GPU PyTorch job with srun and torchrun. What does the batch script look like, and what goes wrong?
  • A node shows drain with the reason "gres/gpu count reported lower than configured (7 < 8)". Walk me through it.
  • Explain how priority, fair share, QOS and preemption interact. A research team says their jobs never start; how do you find out why?
  • Write a health check for a GPU node. What does it test, and how does it interact with Slurm?
  • Jobs on one node keep failing with "Kill task failed" and the node drains. What is happening?

Sign up free to read the full topic

More AI Infrastructure topics

Start free on Cariara · Coding problems · System design studio