... | ... | @@ -673,6 +673,42 @@ SLURM_JOB_NAME: hello.sh |
|
|
SLURM_JOBID: 282
|
|
|
```
|
|
|
|
|
|
### sbatch
|
|
|
|
|
|
The normal and correct way to submit a job is with a slurm batch file.
|
|
|
This is a normal bash script with special directives for slurm.
|
|
|
|
|
|
In SBATCH lines, “#SBATCH” is used to submit options. The various meanings of lines starting with “#” are:
|
|
|
|
|
|
| Line starts with | Treated as |
|
|
|
| --- | --- |
|
|
|
|# | Comment in shell and Slurm |
|
|
|
|#SBATCH | Comment in shell, option in Slurm |
|
|
|
|# SBATCH | Comment in shell and Slurm |
|
|
|
|
|
|
Options, sometimes called “directives”, can be set in the job script file using this line format for each option:
|
|
|
|
|
|
```
|
|
|
#SBATCH {option} {parameter}
|
|
|
```
|
|
|
|
|
|
| Directive Description | Specified As |
|
|
|
| --- | --- |
|
|
|
| Name the job <jobname> | #SBATCH -J <jobname> |
|
|
|
| Request at least <minnodes> nodes | #SBATCH -N <minnodes> |
|
|
|
| Request <minnodes> to <maxnodes> nodes | #SBATCH -N <minnodes>-<maxnodes> |
|
|
|
| Request at least <MB> amount of temporary disk space | #SBATCH --tmp <MB> |
|
|
|
| Run the job for a time of <walltime> | #SBATCH -t <walltime> |
|
|
|
| Run the job at <time> | #SBATCH --begin <time> |
|
|
|
| Set the working directory to <directorypath> | #SBATCH -D <directorypath> |
|
|
|
| Set error log name to <jobname.err>* | #SBATCH -e <jobname.err> |
|
|
|
| Set output log name to <jobname.log>* | #SBATCH -o <jobname.log> |
|
|
|
| Mail <user@address> | #SBATCH --mail-user <user@address> |
|
|
|
| Mail on any event | #SBATCH --mail-type=ALL |
|
|
|
| Mail on job end | #SBATCH --mail-type=END |
|
|
|
| Run job in partition | #SBATCH -p <destination> |
|
|
|
| Run job using GPU with ID <number> | #SBATCH --gres=gpu:<number> |
|
|
|
|
|
|
### Submitting jobs
|
|
|
|
|
|
```
|
... | ... | @@ -727,7 +763,7 @@ ldd ./IMB-MPI1 |
|
|
# SBATCH --ntasks-per-node=16
|
|
|
# SBATCH --ntasks-per-node=6
|
|
|
# SBATCH -n 32
|
|
|
# $SBATCH --exclusive
|
|
|
# SBATCH --exclusive
|
|
|
#SBATCH --time=00:30:00
|
|
|
#SBATCH --error=job.%J.err
|
|
|
#SBATCH --output=job.%J.out
|
... | ... | |