Examples, srun

Examples, srun

You can submit programs directly to the batch system with 'srun', giving all the command on the command line, though you should normally use a jobscript and submit it with 'sbatch', for larger or more complicated jobs.

More information about parameters and job submission files can be found on the Slurm submit file design page.

Running two tasks, each on a different core.

$ srun -A <account> -n 2 my_program

Run 6 tasks distributed across 2 nodes.

$ srun -A <account> -n 6 --tasks-per-node=3 my_program

Run 8 tasks on 8 different nodes.

$ srun -A <account> -n 8 --tasks-per-node=1 my_program

Start 3 tasks and allocate 2 cores per task. 

$ srun -A <account> -n 3 -c 2 my_program

Make sure all the cores are on the same node - here 1 node and 6 cores.

$ srun -A <account> -n 6 --tasks-per-node=6 my_program

Make sure your jobs is not sharing the node with anyone - including other of your tasks - you will be charged for the entire node!

$ srun -A <account> -n 2 --tasks-per-node=1 --exclusive  my_program

If you specify more nodes than tasks, SLURM issues a warning, reallocates resources, then processes the job.

$ srun -N2 -n1 -l /bin/hostname
srun: Warning: can't run 1 processes on 2 nodes, setting nnodes to 1
0: t-cn0001.hpc2n.umu.se

The best way of avoiding this is to never use the -N option to srun, salloc or sbatch. More information about parameters and job submission files can be found on the Slurm submit file design page.

The difference between N and n

$ srun -A <account> -N2 -l /bin/hostname
0: t-cn0001.hpc2n.umu.se
1: t-cn0002.hpc2n.umu.se

$ srun -A <account> -n2 -l /bin/hostname
0: t-cn0001.hpc2n.umu.se
1: t-cn0001.hpc2n.umu.se

The -N option can give unpredictable result and should never be used. More information about parameters and job submission files can be found on the Slurm submit file design page.

salloc

Allocating a single node, all of it, for 30 minutes.

$ salloc -A <account> -N1 --exclusive --time=00:30:00

sbatch

Running a batch job (you could give the account in the job submission file instead)

$ sbatch -A <account> <mysubmissionfile.sbatch>
Updated: 2017-04-24, 16:54