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
man sbatch) describes many of them.
SLURM header lines must come before any executable lines in your script. Their syntax is:
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 command line is:
For example, the following line submits the script
myscript.job but adds the
--time nodes directive:
sbatch --time=00:30:00 myscript.job
Requests the amount of time needed for the job.
|--nodes=n||Number of nodes to request. Default is one node.|
Number of cores on a single node or number of tasks per requested node.
|--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.|
|--mail-user=<email>||Email address(es) separated by commas to send notifications to based on the mail type.|
|--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.|
It is also possible to create a file which tells slurm to automatically apply certain directives to jobs.
To start, create file
One option is to have the file automatically use a certain project account for job submissions. Simply add the following line to
The account can also be separated by cluster.
Or even separated to only use the defaults with the
Finally, many of the options available for the sbatch command can be set as a default, here are some examples.
# always request two cores ntasks-per-node=2 # on pitzer only, request a 2 hour time limit pitzer:time=2:00:00
--cluster=pitzeroption while on owens will not use the defaults defined for pitzer.
Using default options may make the
sinteractivecommand unusable and the interactive session requests from ondemand unusable as well.
Please contact OSC Help if there are questions.