SLURM Directives Summary

SLURM directives may appear as header lines in a batch script or as options on the sbatch command line. They specify the resource requirements of your job and various other attributes. Many of the directives are discussed in more detail elsewhere in this document. The online manual page for sbatch (man sbatch) describes many of them.

SLURM header lines must come before any executable lines in your script. Their syntax is:

#SBATCH [option]

where option can be one of the options in the table below (there are others which can be found in the manual). For example, to request 4 nodes with 12 processors per node:

#SBATCH --nodes=4
#SBTACH --ntasks-per-node=40
#SBATCH --constraint=40core

The syntax for including an option on the qsub command line is:

sbatch [option]

For example, the following line submits the script myscript.job but adds the --time nodes directive:

sbatch --time=00:30:00 myscript.job
Description and examples of sbatch options
Option Description
--time=dd-hh:mm:ss

Requests the amount of time needed for the job.
Default is one hour.

--nodes=n Number of nodes to request. Default is one node.
--ntasks=m
or
--ntasks-per-node=m

Number of cores on a single node or number of tasks per requested node.
Default is a single core.

--gpus-per-node=g Number of gpus per node. Default is none.
--mem=xgb Specify the (RAM) main memory required per node.
--licenses=pkg@osc:N Request use of N licenses for package pkg.
--job-name=my_name Sets the job name, which appears in status listings and is used as the prefix in the job’s output and error log files. The job name must not contain spaces.
--mail-type=START Sets when to send mail to users when the job starts. There are other mail_type options including: END, FAIL.
--x11 Enable x11 forwarding for use of graphical applications.
--account=PEX1234 Use the specified for job resource charging.
--cluster=pitzer Explicitly enter which cluster to submit the job to.