Attention
GPU users: GPU nodes run EL9, while this documentation still reflects the EL7 software stack.
Run module avail on an EL9 login node, or within an interactive session on the relevant GPU type, to see the software available.
The documentation will be updated once all nodes have migrated to EL9.
srun
srun is the SLURM command used to launch tasks within a job allocation. It can be used in both batch scripts and on the command line to:
- Start one or more job ‘steps’ in a batch job (a step can request and use some or all of the resources allocated to the job; steps can run sequentially or in parallel)
useful for analysing performance across multiple stages of a workflow
- Launch MPI or multi-task jobs
(e.g. with
--ntasks> 1)where multiple processes need to be started across CPUs or nodes
- Run an interactive job
for example,
srun --pty bash -i
Documentation
Run man srun on the system for full details.
Usage
To launch an interactive shell:
srun --pty bash -i
To run a non-interactive job directly:
srun --export=ALL --time=00:10:00 --mem=1G python3 my_script.py 100000000
In a batch script:
#SBATCH --ntasks=4
srun --export=ALL ./my_parallel_app
For simple, single-task jobs, srun is optional in batch scripts — your command can be run directly.
See the interactive and batch submission guide for more examples.