Batch Scripts

Although users can run jobs directly on compute nodes with srun <arguments> <executable>, the preferred method is use of a batch script.

Currently, SLURM batch scripts do not recognize most of the SLURM arguments. Therefore, it is recommended that users pass the SLURM arguments to SLURM outside the batch script.

For example, a script named batch.slurm will do the following:

batch.slurm
#!/bin/csh
srun hostname
srun a.out

submitted with

srun -n16 -J jobname -t 120 -b batch.slurm

will run the script batch.slurm on 16 processors with a wall time of 120 minutes. If the job does not complete and exit in 120 minutes, the scheduler will kill the job. The default wall time and maximum wall time are both 12 hours. If a wall time is not specified, the job will be given a 12-hour wall time.

The same script (batch.slurm) submitted with

srun -N4 -n4 -o job.out -e job.err -b batch.slurm

will run the script batch.slurm on four nodes using one processor per node. The job’s standard output will be placed in the file named job.out. The job’s standard error will be placed in the file named job.err. Because a wall time is not specified, the job will be given the default 12-hour wall time.

To prevent sharing of a single node’s resources between jobs, the scheduler will always allocate an entire node.