Slurm
SLURM (Simple Linux Utility for Resource Management) [1] [5] is a powerful and flexible workload manager, designed for distributed computing environments. It is an open-source, highly-scalable system that provides advanced job scheduling, efficient job submission, and comprehensive system monitoring capabilities. SLURM allows users to manage computing resources efficiently, enabling more efficient and cost-effective research and data analysis. Overall, SLURM provides a highly efficient and flexible resource management solution for distributed computing environments. Its features make it an excellent choice for researchers and scientists looking to optimize their computing resources, streamline their workflows, and enhance their productivity.
Usual commands:
Purpose | Command |
---|---|
To check what queues (partitions) are available | sinfo |
To submit job | sbatch |
To view the queue status | squeue |
To view the queue status of your job | squeue -u $USER |
To cancel a running or pending job | scancel JOBID |
To view detailed information of your job | scontrol show job JOBID |
To View resource accounting information for finished and running jobs | sacct |
To View resource accounting information for running jobs | sstat |
Sample script
1 |
|
You have to module what you need (compiler and correspoinding libraries)[2].
Upon job completion, the standard output will be stored in the job submission directory under the filename slurm-
1 |
|
If the time limit is not specified in the submit script, SLURM will assign the default run time, 3 days. This means the job will be terminated by SLURM in 72 hrs. If the memory limit is not requested, SLURM will assign the default 16 GB. The maximum allowed memory per node is 128 GB. To see how much RAM per node your job is using, you can run commands sacct or sstat to query MaxRSS for the job on the node.
Query job information
1 |
|
One more for check historical jobs, 1
2
3alias sacct_job='sacct --format="JobId,JobName%50,Partition,Nodelist,Account,AllocCPUS,State,Submit,Start,End,Elapsed"'
sacct_job --starttime=2023-05-01
seff
The Slurm job efficiency report (seff)[3]
Summary: seff takes a jobid and reports on the efficiency of that job's cpu and memory utilization. The rpm/tarball comes with an 'smail' utility that allows for Slurm end-of-job emails to include a seff report. This allows users to become aware if they are wasting resources. 1
2# This script is roughtly equivalent to:
# sacct -P -n -a --format JobID,User,Group,State,Cluster,AllocCPUS,REQMEM,TotalCPU,Elapsed,MaxRSS,ExitCode,NNodes,NTasks -j <job_id>
or copy from github SchedMd slurm seff
ulimit -s unlimited
1 |
|
SLURM Job Dependencies
You may submit jobs that runs depending on status of the previously submitted jobs or schedule a bunch of jobs to run one after the other.[4] 1
2
3
4
5
6# Format is
$ sbatch --dependency=type:job_id jobfile
$ sbatch --dependency=type:job_id,job_id,job_id jobfile # requires more than one job to be completed
jobID=$(sbatch first_job.sh)
sbatch --dependency=afterok:${jobID} second_job.sh
Submit a job to a specific node
1 |
|
--mem-per-cpu
In this case the correct action would be to decrease the required memory by using something like #SBATCH --mem-per-cpu=3G. It is wise to request more memory than you actually need for safety. Remember that the job will fail if it runs out of memory.
However, it is important not to request an excessive amount because that would make it harder for the job scheduler to schedule the job which results in longer queue times.
Parameters for OpenMP
The OMP_STACKSIZE environment variable controls the size of the stack for threads created by the OpenMP implementation. 1
2
3# Parameters for OpenMP
export OMP_STACKSIZE=512m # the number is suffixed by B, K, M or G
export OMP_NUM_THREADS=1