|
|
# SLURM commands
|
|
|
There is a lot of information available on the [SLURM website](https://slurm.schedmd.com/) or by using the ```man``` command.
|
|
|
The most common commands are:
|
|
|
* [srun](https://slurm.schedmd.com/srun.html)
|
|
|
* [sbatch](https://slurm.schedmd.com/sbatch.html)
|
|
|
* salloc
|
|
|
* [squeue](https://slurm.schedmd.com/squeue.html)
|
|
|
* [sstat](https://slurm.schedmd.com/sstat.html)
|
|
|
* [sacct](https://slurm.schedmd.com/sacct.html)
|
|
|
* scontrol
|
|
|
* sview
|
|
|
* sdiag
|
|
|
|
|
|
## Interactive Session
|
|
|
To start an interactive job issue the command:
|
|
|
```
|
|
|
srun <resources> --pty /bin/bash
|
|
|
```
|
|
|
### resources
|
|
|
The resources are optional, if you need more then the default you should set them.
|
|
|
The default resources you get: 1 core, 2GB memory and 1 hour run time
|
|
|
* --time=
|
|
|
* Acceptable time formats include "minutes", "minutes:seconds", "hours:minutes:seconds", "days-hours", "days-hours:minutes" and "days-hours:minutes:seconds".
|
|
|
* --mem=
|
|
|
* Specify the real memory required per node (OGS uses mem/core). Different units can be specified using the suffix [K|M|G|T]
|
|
|
* --ntasks-per-node=
|
|
|
* Request number of cores per node
|
|
|
To submit a singe node job with 2 cores and 4GB memory and 120 minutes run time :
|
|
|
```
|
|
|
srun --ntasks=1 --cpus-per-task=2 --mem=4gb -t 90 --pty /bin/bash
|
|
|
or
|
|
|
srun --ntasks-per-node=2 --mem=4gb -t 90 --pty /bin/bash
|
|
|
```
|
|
|
## Submit a Job
|
|
|
To submit a job to the cluster issue the command :
|
|
|
```
|
|
|
sbatch <resources> <script Name>
|
|
|
```
|
|
|
The resources are the same as the interactive session, for more resources options please read the manual.
|
|
|
|
|
|
#Check status of the queue
|
|
|
The command to issue is
|
|
|
```
|
|
|
squeue
|
|
|
```
|
|
|
For a more informative output you can specify an output format like :
|
|
|
```
|
|
|
squeue -o "%.10A %.18u %.3t %.5C %.20S %.5D %.10a %.10M %.9P"
|
|
|
```
|
|
|
For a full list of all the options please read the [squeue manual](https://slurm.schedmd.com/squeue.html).
|
|
|
|
|
|
# Accounting for running jobs
|
|
|
The default command to use is:
|
|
|
```
|
|
|
sstat
|
|
|
```
|
|
|
Note : sstat -j <jobid> can only be used on jobs submitted with srun.
|
|
|
For sbatch submitted jobs use <jobid>.batch
|
|
|
To view your memory consumption for a sbatch job use:
|
|
|
```
|
|
|
sstat -j <JobID>.batch -o maxrss
|
|
|
```
|
|
|
To view all the available options you can display with -o option use the command:
|
|
|
```
|
|
|
sstat -e
|
|
|
```
|
|
|
Show running or completed job utilization from the accounting information with full details.
|
|
|
```
|
|
|
sacct -j <JobID> -l
|
|
|
``` |