SLURM
Worker Daemons
Job Scheduling
High-Performance Computing
Cluster Management

Running multiple worker daemons SLURM

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Using SLURM (Simple Linux Utility for Resource Management), a powerful open-source workload manager, to orchestrate and manage multiple worker daemons across a distributed computing environment is highly effective for large computations and resource management. This guide describes the process of running multiple worker daemons under SLURM, including relevant technical explanations and examples.

Overview of SLURM

SLURM is a highly scalable and configurable workload manager used primarily on Linux clusters to efficiently distribute jobs among nodes. It supports running under MPI (Message Passing Interface) and allows for complex job scheduling, resource allocation, and efficient job management.

Configuration of SLURM for Worker Daemons

To begin, you must ensure your SLURM configuration is set up to handle daemon processes correctly. This usually involves setting up your slurm.conf file correctly and ensuring nodes are defined properly to handle the types of jobs your daemons will perform.

bash
# Example slurm.conf snippet
NodeName=worker[1-10] CPUs=4 State=UNKNOWN
PartitionName=debug Nodes=worker[1-10] Default=YES MaxTime=24:00:00 State=UP

Running Multiple Worker Daemons

The execution of multiple worker daemons involves creating a SLURM batch script or using srun directly. Here's what these approaches typically look like:

Batch Script Method

  1. Create a Batch Script: A typical SLURM batch script to launch worker daemons might look like:
bash
1#!/bin/bash
2#SBATCH --job-name=daemon_job
3#SBATCH --output=daemon_out_%j.txt
4#SBATCH --error=daemon_err_%j.txt
5#SBATCH --ntasks=10
6#SBATCH --time=10:00:00
7#SBATCH --mem-per-cpu=1000
8
9srun --multi-prog daemon.config
  1. Configure Multi-Prog Options: The daemon.config mentioned in the srun command above should contain mappings of tasks to commands, allowing different nodes to run different commands or parameters:
 
0-4 daemon_executable --option1
5-9 daemon_executable --option2

Direct srun Method

Alternatively, you can launch daemons directly using srun:

bash
srun -N 10 -n 10 --pty daemon_executable &

Here -N specifies the number of nodes, -n specifies the number of tasks, and --pty runs the job in a new pseudo-terminal.

Monitoring and Managing Daemons

SLURM provides several tools for monitoring and managing daemon processes:

  • squeue: View job queue status.
  • scancel: Terminate jobs.
  • sacct: Report job accounting data.

Summary Table

FeatureDescriptionSLURM CommandNotes
Job SubmissionSubmit jobs to SLURM for scheduling.sbatch, srunUse sbatch for scripts, srun for direct submission
Job MonitoringMonitor the status of running jobs.squeue, sacctsqueue for current status, sacct for historical
Resource ManagementAllocate resources efficiently.sallocManages interactive job sessions
Daemon ConfigurationConfig tasks and options for daemons.Multi-prog configUse config file for complex job task distribution

Best Practices and Tips

  • Scalability: Design daemon tasks to scale across multiple nodes effectively.
  • Logging and Debugging: Ensure each daemon has adequate logging to troubleshoot issues.
  • Resource Allocation: Monitor and adjust resource allocations based on daemon behavior to optimize cluster usage.

In summary, running multiple worker daemons in a SLURM environment necessitates careful planning around configuration, job submission, and monitoring. Using the tools provided by SLURM, along with best practices for distributed computing, can greatly enhance the efficiency and effectiveness of your computing resources.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.