SLURM scripts

Creating a SLURM script

SLURM directives (header lines)

At the top of a SLURM script are several lines starting with #SBATCH.  These are SLURM directives or header lines.  The provide the job setup information used by SLURM, including resource requests, email options, and more.  The header lines may appear in any order, but the must precede any executable lines in your script.

Resource limits

Wall clock time
The walltime is the maximum time your job will be allowed to run, given in seconds or hours:minutes:seconds.  This is elapsed time.  If your job exceeds the requested time, the scheduler will kill it.

The default value for walltime depends on the queue configuration.  You can check this using queue commands.

To request 20 hours of wall clock time:

#SBATCH –time=20:00:00

If is to your advantage to come up with a good estimate of the time your job will take.  An underestimate will lead to your job being killed.  And overestimate may prevent your job from being backfilled (fit into an empty time slot).

Nodes
The nodes resource limit specifies not just the number of nodes, but the properties of those nodes.  The properties may include processors per node (ppn), the number of GPU’s per nod (gpus) and the type of node.

You must specify a number of nodes.

To request a single processor (sequential job):

#SBATCH –ntasks=1

To request one whole Intel node (on Ultron)

#SBATCH –nodes=1

Memory
The memory limit is the total amount of memory needed across all nodes.  There is no need to specify a memory limit unless your memory requires are disproportionate to the number of cores you are requesting, or you need a large amount of memory.  For parallel jobs you must multiply the memory needed per node by the number of nodes to get the correct limit; you should usually just request whole nodes based on node:ppn and omit the memory limit.

To request gGB memory:

#SBATCH

or

#SBATCH

Job Name
You can optionally give your job a meaningful name.  If you don’t supply a name, the script file name is used to generate a name.  The name may be up to 15 characters in length, no spaces.

#SBATCH -J [jobname]

Mail Options
You may choose to receive email when your job begins (b) when it ends (e) or when it is aborted by the batch system (a).  The email will be sent to the address specified.

#SBATCH

Job Log Files

By default, SLURM returns log files.  One for the standard output stream, and one for the standard error stream.

#SBATCH

File space

information coming soon…

Shell

There is rarely a need to specify a shell.  Your script will be executed using your default login sheel unless you request  different shell.

For example, if you wanted to execute under c-shell:

#SBATCH

Environment Modules Directives

**** insert environment modules instructions here ****

Executable Section

The executable section of your script comes after the header lines.  The content of this section depends entirely on what you want your  job to do.

**** insert executable instructions here ****

Examples

Simple sequential job