Slurm Commands

Basic Commands

The ARC managed HPC clusters use a batch manager called Slurm. Extensive documentation for Slurm can be found at http://slurm.schedmd.com/slurm.html

Some of the most basic and useful Slurm commands are:

sinfo
squeue
sbatch
scancel

To see the full documentation for any of these commands (e.g. sinfo), type:

man sinfo

You can run the command `sinfo` to see the available queues and compute resources.

All jobs must be run through the batch manager. Any jobs found running on the compute nodes outside of the queueing system will be killed.

Once you have a job submitted, you can check the status with the command:

squeue

To kill a submitted job, type:

scancel JOBID

Where the JOBID can be obtained from the squeue command.

 

Resource Requests

Resource requests using Slurm are the most important part of your job submission.

You will only get the resources you ask for, including number of cores, memory, and number of GPUs.

For example, if you only request one CPU core, but your job spawns four threads, all of these threads will be constrained to a single core.

Prior to submitting your job, it is extremely important you know exactly what resources you need, and make the analogous request.

Below are the most relevant sbatch or batch script flags to use for nodes/CPU/RAM/GPU/walltime requests.

Number of nodes:

-N NNODES

where NNODES is the number of nodes requested

 

Number of cores per node:

-n NCPUS

where NCPUS is the number of cores per node requested

 

Amount of memory in MB:

--mem MB_PER_NODE

where MB_PER_NODE is the amount of memory required per node. Default units are in MB. This can be modified using [K|M|G|T] to ask for KB|MB|GB|TB of RAM.

The following would request 64 GB or RAM per node for the job:

--mem 64G

 

Number of GPUs:

--gres=gpu:NGPU

where NGPU is the number of GPUs requested

 

Type of GPU:

-C GPU_TYPE

where GPU_TYPE is the NVIDIA model number (e.g. K20, K40, K80)

 

Walltime:

-t HH:MM:SS

where HH:MM:SS (hours:minutes:seconds) is the amount of wall time your job will be allocated

Batch Job Submissions

Multiple jobs, or a single job script that performs many functions, through the use of a batch script.

Instead of passing each resource flag, the requests would go at the top of the script preceded by #SBATCH.


#!/bin/bash
#SBATCH -N 1
#SBATCH -n 4
#SBATCH -p compute
#SBATCH -o gompbot.out
#SBATCH -t 1:00:00

srun -l gompbot.x
srun -l /bin/pwd

The script above contained in a file job.sh can be submitted to the queue using the sbatch command:

sbatch job.sh

Important: Options supplied on the command line to the sbatch command will override any options specified within the script.

Last Updated on February 13, 2018