Automated, reproducible multi-node SLURM cluster for local HPC learning and testing, provisioned on Vagrant + VirtualBox virtual machines.
[TOC]
SLURM Simulator brings up a small SLURM (Simple Linux Utility for Resource Management) workload-manager cluster on your own machine using Vagrant-managed Ubuntu VMs. A single config.sh file drives shell scripts that install SLURM and MUNGE, generate slurm.conf, slurmdbd.conf, and /etc/hosts, and start the controller and worker daemons — giving you a working HPC scheduler sandbox without physical hardware.
- What is this? A Vagrant-based provisioning setup that builds a real SLURM cluster (controller + worker nodes) inside local virtual machines.
- Who is it for? Students, HPC administrators, and developers who want to learn SLURM, test job scripts, or experiment with scheduler and accounting configuration on a laptop.
- What does it solve? It removes the manual, error-prone steps of installing and configuring SLURM by hand, and it needs no access to a production cluster.
- When to use it: learning SLURM, practicing
sbatch/srun/squeue/sacct, or testingslurm.confchanges before applying them to a real cluster. - When NOT to use it: it is a local sandbox — not a production HPC deployment, and not a discrete-event scheduler simulator.
- One-command cluster bring-up with
vagrant up. - Central
config.shfor node names, IPs, CPUs, and memory. - Automatic generation of
slurm.conf,slurmdbd.conf, and/etc/hosts. - MUNGE authentication configured automatically.
- Job accounting via
slurmdbd+ MySQL (sacct). - Example
sbatchjob scripts underjobs/.
| Path | Purpose |
|---|---|
slurm_ex1/ |
Single-controller example with the full auto-configuration scripts |
slurm_ex2_3_nodes/ |
Three-node cluster example |
slurm_template/ |
Reusable template for building your own cluster |
*/slurm_config/ |
config.sh plus generators for slurm.conf, slurmdbd.conf, and hosts |
*/jobs/ |
Sample sbatch batch job scripts |
Requirements: Vagrant and VirtualBox. The VMs run Ubuntu 22.04 (jammy).
git clone https://github.com/MSKazemi/SLURM_Simulator.git
cd SLURM_Simulator/slurm_ex1
# Edit slurm_config/config.sh to set node names, IPs, CPUs, and memory
vagrant up # provisions the VM and installs + configures SLURM
vagrant ssh # log into the controller node
sinfo # view cluster / partition state
sbatch jobs/job1.sh # submit an example job
squeue # check the queueThe manual, step-by-step reference below documents each command the automation runs, so you can also install and configure SLURM by hand.
MUNGE (MUNGE Uid 'N' Gid Emporium) is an authentication service used by SLURM for secure communication between nodes.
sudo apt update
sudo apt install -y munge libmunge-dev libmunge2sudo /usr/sbin/create-munge-key
sudo /usr/sbin/create-munge-key -f
sudo chown munge: /etc/munge/munge.key
sudo chmod 400 /etc/munge/munge.keysudo dd if=/dev/urandom bs=1 count=1024 > /etc/munge/munge.key
sudo chown -R munge: /etc/munge
sudo chmod 0700 /etc/munge
sudo chown munge: /etc/munge/munge.key
sudo chown munge:munge /etc/munge/munge.key
sudo chmod 400 /etc/munge/munge.keysudo bash -c 'dd if=/dev/urandom bs=1 count=1024 > /etc/munge/munge.key'
sudo chown -R munge: /etc/munge
sudo chmod 0700 /etc/munge
sudo chmod 0400 /etc/munge/munge.keysudo systemctl start munge
sudo systemctl enable munge
sudo systemctl status mungesudo mkdir -p /var/log/munge
sudo chown -R munge: /var/log/munge
sudo chmod 0755 /var/log/munge
sudo mkdir -p /var/run/munge
sudo chown -R munge: /var/run/munge
sudo chmod 0755 /var/run/mungedpkg -l | grep mungesudo apt install -y slurm-wlm127.0.0.1 localhost
192.168.56.10 sl1
127.0.0.1 Node1
127.0.0.1 Node2
127.0.0.1 Node3
127.0.0.1 Node4
/etc/slurm-llnl/slurm.conf
/etc/slurm/slurm.conf
sudo chown slurm: /etc/slurm-llnl/slurm.conf
sudo chmod 644 /etc/slurm-llnl/slurm.confsudo systemctl start slurmctld
sudo systemctl enable slurmctld
sudo systemctl start slurmd
sudo systemctl enable slurmd
sudo systemctl status slurmctld
sudo systemctl status slurmdVerfiy the SLURM installation Configuration
ps aux | grep slurmid slurm
sudo useradd -m -s /bin/bash -u <UID> -g <GID> slurmsinfo
squeue
sinfo -N
sinfo -l
sinfo -p debug
sinfo -N -l
sinfo -N -l -o "%N %c %m %d %f %G %z"
sinfo -N -l -o "%N %c %m %d %f %G %z" | grep Node
sinfo -N -l -o "%N %c %m %d %f %G %z" | grep Node | awk '{print $1}'
sinfo -N -l -o "%N %c %m %d %f %G %z" | grep Node | awk '{print $2}'
squeue -u slurm --start -l -o "%A %j %u %T %M %D %C %R %S"
squeue -u slurm --start -l -o "%A %j %u %T %M %D %C %R %S" | grep PENDING
squeue -u slurm --start -l -o "%A %j %u %T %M %D %C %R %S" | grep RUNNING
squeue -u slurm --start -l -o "%A %j %u %T %M %D %C %R %S" | grep COMPLETED
srun --nodes=1 --ntasks=1 --partition=debug --time=00:01:00 --wait=0 --pty /bin/bash
scancel <job_id>
scancel -u <username>
scancel --state=PENDING
scancel --state=RUNNING
scancel --state=COMPLETED
scontrol reconfigure
scontrol update NodeName=Node[1-10] State=IDLE
scontrol show job <job_id>
scontrol show partition
scontrol show nodes
scontrol show config
scontrol show state
scontrol show licenses
scontrol show topology
scontrol show switches
scontrol show network
scontrol show job <job_id>
scontrol show job <job_id> | grep NodeList
scontrol show job <job_id> | grep JobStatesudo mkdir -p /var/log/
sudo touch /var/log/slurmctld.log
sudo chown slurm: /var/log/slurmctld.logsudo tail -f /var/log/slurmctld.log
sudo tail -f /var/log/slurmd.logsudo scontrol create NodeName=Node1 CPUs=1 RealMemory=1048 State=IDLEsudo apt-get install slurmdbd
sudo systemctl start slurmdbd
sudo systemctl enable slurmdbd
sudo systemctl status slurmdbdsudo apt update
sudo apt install mysql-serverslurmdbd.conf
/etc/slurm-llnl/slurmdbd.conf
sudo systemctl start mysql
sudo systemctl enable mysqlDatabase name: slurm_acct_db
sudo mysql -u root -pIf this is the first time you’re setting up SLURM accounting, you need to initialize the database schema. SLURM provides a script, slurmdbd.sql, that can be used to create the necessary tables. your_db_password: 123456
CREATE DATABASE slurm_acct_db;
CREATE USER 'slurm'@'localhost' IDENTIFIED BY '<your_db_password>';
GRANT ALL PRIVILEGES ON slurm_acct_db.* TO 'slurm'@'localhost';
FLUSH PRIVILEGES;
EXIT;Then, load the schema into the database:
mysql -u <your_user> -p slurm_acct_db < /usr/share/doc/slurmdbd/slurmdbd.sql/etc/slurm/slurm.conf
/etc/slurm/slurmdbd.conf
DbdHost=localhost
DbdPort=6819
StorageHost=localhost
StorageType=accounting_storage/mysql
StorageUser=slurm
StoragePass=<your_db_password>ALTER USER 'slurm'@'localhost' IDENTIFIED BY 'new_password';
FLUSH PRIVILEGES;
EXIT;sudo nano /etc/slurm/slurmdbd.confsudo systemctl start slurmdbd
sudo systemctl enable slurmdbd
sudo systemctl status slurmdbd
sudo systemctl restart slurmdbd
sudo systemctl restart slurmctld
sudo tail -f /var/log/slurmdbd.log
sudo tail -f /var/log/slurmctld.log
sudo tail -f /var/log/slurm/slurmctld.log
sacct --starttime=2023-09-01 --endtime=2023-09-25
sacct --state=COMPLETED
sacct -o JobID,JobName,Partition,Account,AllocCPUS,State,ExitCode,Submit,Start,End,Elapsed,MaxRSS
sacct -o JobID,JobName,Partition,Account,AllocCPUS,State,ExitCode,Submit,Start,End,Elapsed,MaxRSS,NodeList
sacct -o JobID,JobName,Partition,Account,AllocCPUS,State,ExitCode,Submit,Start,End,Elapsed,MaxRSS,NodeList
sacct -o JobID,JobName,Partition,Account,AllocCPUS,State,ExitCode,Submit,Start,End,Elapsed,MaxRSS,NodeList,AllocNodes,CPUTime,ReqNodes
sacct --format=JobID,JobName,Partition,State,AllocCPUS,Start,End,Elapsed,ExitCode
sacct --format=JobID,JobName,Partition,State,AllocCPUS,MaxRSS,MaxVMSize,Elapsed,ExitCode
slurmd is Running as slurm
ps aux | grep slurmctld
ps aux | grep slurmdbd
ps aux | grep slurmdsudo systemctl status slurmctld
sudo systemctl status slurmdbd
sudo systemctl status slurmd
sudo systemctl restart slurmctld
sudo systemctl restart slurmdbd
sudo systemctl restart slurmd
sudo systemctl restart munged
sudo systemctl restart slurmdbd
sudo systemctl restart slurmctld
sudo systemctl restart slurmd
sudo systemctl start munged
sudo systemctl enable munged
sudo systemctl status munged
sudo systemctl restart slurmdbd
sudo systemctl restart slurmctld
sudo systemctl restart slurmd
sudo systemctl daemon-reload
sudo systemctl restart slurmd
sudo systemctl daemon-reload
sudo systemctl restart slurmdecho "hostname" | sbatchThe materials in this repository are made available without warranties to the extent permitted by applicable law. Please read the Disclaimer and Responsible-Use Notice before relying on or deploying them. This notice does not change any existing software license or limit rights that cannot legally be waived.