Skip to content
VLASIFY™
TutorialHPC, GPU & Linux

Slurm installation and configuration: a working first cluster

Updated · Scientifically reviewed by Dinkar Mishra, PhD on

Short answer

Install Munge and the Slurm packages on every node, copy the same Munge key and slurm.conf to all of them, start munge, then slurmctld on the controller and slurmd on compute nodes. Generate each node's hardware line with slurmd -C, define partitions in slurm.conf, enable cgroups to confine jobs, configure GRES for GPUs, and add slurmdbd if you need accounting. Test with sinfo and srun before giving users access.

Who this is for

System administrators and research software engineers setting up Slurm on a small cluster or a multi-GPU workstation.

Software

Slurm ≥ 23.02 (distribution packages or SchedMD source)Munge 0.5.xUbuntu / Rocky Linux current LTS

Prerequisites

  • Linux on all nodes with consistent hostnames (resolvable via DNS or /etc/hosts), synchronised clocks (chrony) and identical user IDs (central identity is best).
  • Root access, and the network ports between nodes open (by default 6817 for slurmctld and 6818 for slurmd).
  • Decide which node runs the controller (slurmctld). On a small cluster this is the head node.

Step 1: Munge authentication (all nodes)

sudo apt install munge                      # Rocky/Alma: sudo dnf install munge
# On the controller only: create a key, then copy it to every node
sudo /usr/sbin/mungekey --create --force    # older Munge versions: /usr/sbin/create-munge-key
sudo systemctl enable --now munge
munge -n | unmunge                          # local test: STATUS: Success (0)

Copy /etc/munge/munge.key to all nodes (owner munge, mode 0400), restart munge, and test across nodes with munge -n | ssh node01 unmunge.

Step 2: install Slurm

# Ubuntu: controller
sudo apt install slurmctld
# Ubuntu: compute nodes (and the controller if it also runs jobs)
sudo apt install slurmd slurm-client

On Rocky or Alma Linux, use packages from EPEL or OpenHPC, or build RPMs from the SchedMD tarball.

Step 3: write slurm.conf

On each compute node, print its hardware description and paste it into slurm.conf:

slurmd -C
# NodeName=node01 CPUs=64 Boards=1 SocketsPerBoard=2 CoresPerSocket=16 ThreadsPerCore=2 RealMemory=257000

A minimal configuration (identical on every node, typically /etc/slurm/slurm.conf):

ClusterName=labcluster
SlurmctldHost=head01
ProctrackType=proctrack/cgroup
TaskPlugin=task/cgroup,task/affinity
SelectType=select/cons_tres
SelectTypeParameters=CR_Core_Memory
ReturnToService=2
SlurmctldLogFile=/var/log/slurm/slurmctld.log
SlurmdLogFile=/var/log/slurm/slurmd.log
GresTypes=gpu

NodeName=node[01-04] CPUs=64 Sockets=2 CoresPerSocket=16 ThreadsPerCore=2 RealMemory=250000 State=UNKNOWN
NodeName=gpu01 CPUs=64 Sockets=2 CoresPerSocket=16 ThreadsPerCore=2 RealMemory=500000 Gres=gpu:4 State=UNKNOWN

PartitionName=compute Nodes=node[01-04] Default=YES MaxTime=2-00:00:00 State=UP
PartitionName=gpu Nodes=gpu01 MaxTime=1-00:00:00 State=UP
PartitionName=debug Nodes=node01 MaxTime=00:30:00 State=UP

Set RealMemory slightly below the physical memory, leaving room for the operating system. The official configurator generates a fuller file.

Step 4: cgroups and GPUs

/etc/slurm/cgroup.conf confines jobs to the cores, memory and devices they requested:

ConstrainCores=yes
ConstrainRAMSpace=yes
ConstrainDevices=yes

On GPU nodes, /etc/slurm/gres.conf:

AutoDetect=nvml

AutoDetect=nvml requires Slurm built with NVML support. Otherwise list devices explicitly, for example Name=gpu File=/dev/nvidia[0-3].

Step 5: start the daemons

sudo systemctl enable --now slurmctld       # controller
sudo systemctl enable --now slurmd          # every compute node

Step 6 (optional): accounting

Install slurmdbd with MariaDB or MySQL, set AccountingStorageType=accounting_storage/slurmdbd in slurm.conf, then create the cluster, accounts and users:

sudo sacctmgr add cluster labcluster
sudo sacctmgr add account physics Description="Plasma group"
sudo sacctmgr add user alice Account=physics

Verify

sinfo                                        # nodes idle, partitions up
srun -N 4 -p compute hostname                # one line per compute node
srun -p gpu --gres=gpu:1 nvidia-smi -L       # shows exactly one GPU
sbatch --wrap="sleep 60" && squeue           # batch path works

Then submit a real multi-node MPI job; see how to submit a Slurm job.

Troubleshooting

  • sinfo shows nodes down/drain: sinfo -R gives the reason. Typical causes: declared CPUs or memory exceed the real values, slurm.conf differs between nodes, Munge failures (journalctl -u munge), or clock skew.
  • “Unable to contact slurm controller”: firewall, wrong SlurmctldHost, or slurmctld not running (journalctl -u slurmctld).
  • Jobs use more memory or cores than requested: cgroup confinement is not active. Check cgroup.conf, TaskPlugin and ProctrackType, then restart the daemons.

Assumptions and limitations

  • Package names and paths follow current Ubuntu and RHEL-family conventions. Older releases used /etc/slurm-llnl.
  • The configuration shown is a minimal starting point. Production clusters also need backups of the controller state, high availability decisions, QOS and fair-share policies, and a tested upgrade process.
  • Always read the release notes when upgrading Slurm. Mixing incompatible daemon versions breaks the cluster.

Frequently asked questions

Can I run Slurm on a single workstation?+

Yes. Controller and compute daemon can run on the same machine. This is a convenient way to queue jobs on a shared multi-GPU workstation so that users do not overload it.

Do I need the accounting database (slurmdbd)?+

Not to run jobs. You need it for job history (sacct across restarts), usage reports, fair-share scheduling and per-account limits. Most shared clusters want it.

Should I use distribution packages or build from source?+

Distribution packages are simplest and receive security updates. Building from SchedMD source gives the latest release and features. All nodes must run compatible versions; check the Slurm upgrade rules before mixing versions.

Why do nodes show as DOWN after I start slurmd?+

Usually the hardware in slurm.conf does not match the node (fewer CPUs or less memory than declared), Munge authentication fails, or clocks differ. Check slurmd logs and sinfo -R, fix the cause, then return the node with scontrol update NodeName=node01 State=RESUME.

References

  1. Slurm quick start administrator guide · SchedMD
  2. slurm.conf manual · SchedMD
  3. Slurm configuration tool · SchedMD
  4. Generic resource (GRES) scheduling · SchedMD
  5. Accounting and resource limits · SchedMD

Want this set up and verified for you?

We install, configure and validate scientific software on your workstation, cluster or cloud, and train your team to run it.

Services listed on this page are available today. Products marked “early access” or “in development” on our platform page are not yet generally available.

Spotted an error or an outdated command? Tell us. We correct verified issues promptly.

Related guides

How Vlasify can help

Get a Quote