Submitting Interactive Jobs with srun
srun is a command-line tool used for submitting jobs to the Slurm workload manager, offering a wide range of options for customizing job submission, and essentially letting you run parallel jobs on a cluster managed by Slurm.
You can find more information about Slurm here
srun examples
The basic syntax for using srun is as follows:
srun [options] command
where command is the command or script to be executed.
When using
srunat Arjuna, you may getsrun: error: spank: x11.so: Plugin file not found. You may disregard this error message
To start an interactive job requesting one node, 2GB of memory, for 30 minutes, on the cpu partition, type:
srun --partition=cpu --nodes=1 --mem=2G --time=30 --pty bash
The option
--ptyhere is required to start an interactive job.
If you want, you can get a notification by email when the interactive environment is ready. If your email address is
srun --partition=cpu --ntasks=1 --nodes=1 --mem=1G --time=2 --mail-type=BEGIN --mail-user=AndrewID@andrew.cmu.edu --pty bash
You can also submit a job using srun. To run a Python script named my_script.py, using 1 node, 1GB memory, 1 minute, redirecting stdout to ‘out’, redirect stderr to ‘error’, on the debug partition, type:
srun --partition=debug --node=1 --mem=1G --time=1 --output=out --error=error python my_script.py
--outand--errorare incompatible with--pty.
Options
srun provides a wide range of options for customizing job submission. Some of the most commonly used are shown above as examples. You can get further instruction on these options by typing the following:
srun -h