Skip to content
Snippets Groups Projects
Commit 64273a9b authored by Roman Sliva's avatar Roman Sliva
Browse files

Update job-scheduling.md

parent a91a6400
Branches
Tags
No related merge requests found
Pipeline #29179 failed
...@@ -25,12 +25,55 @@ $ squeue --me ...@@ -25,12 +25,55 @@ $ squeue --me
104 p01-arm interact user R 1:48 2 p01-arm[01-02] 104 p01-arm interact user R 1:48 2 p01-arm[01-02]
``` ```
Show job details Show job details for specific job
```console ```console
$ scontrol show job 104 $ scontrol -d show job JOBID
``` ```
Show job details for executing job from job session
```console
$ scontrol -d show job $SLURM_JOBID
```
## Slurm job environment variables
Slurm provides usefull information to the job via environment variables. Environment variables are available on all nodes allocated to job when accessed via Slurm supported means (srun, compatible mpirun).
See all Slurm variables
```
set |grep ^SLURM
```
Useful Slurm variables
| variable name | description | example |
| ------ | ------ | ------ |
|SLURM_JOBID| job id of the executing job| 593 |
|SLURM_JOB_NODELIST| nodes allocated to job | p03-amd[01-02] |
|SLURM_JOB_NUM_NODES| number of nodes allocated to job | 2 |
|SLURM_STEP_NODELIST| nodes allocated to job step | p03-amd01 |
|SLURM_STEP_NUM_NODES| number of nodes allocated to job | 1 |
|SLURM_JOB_PARTITION| name of the partition | p03-amd |
|SLURM_SUBMIT_DIR| submit directory | /scratch/project/open-xx-yy/work |
See [Slurm srun documentation][2] for details.
Get job nodelist
```
$ echo $SLURM_JOB_NODELIST
p03-amd[01-02]
```
Expand nodelist to list of nodes.
```
$ scontrol show hostnames $SLURM_JOB_NODELIST
p03-amd01
p03-amd02
```
## Running interactive jobs
Run interactive job Run interactive job
```console ```console
...@@ -46,6 +89,8 @@ Run interactive job, with X11 forwarding ...@@ -46,6 +89,8 @@ Run interactive job, with X11 forwarding
!!! warning !!! warning
Do not use `srun` for initiating interactive jobs, subsequent `srun`, `mpirun` invocations would block forever. Do not use `srun` for initiating interactive jobs, subsequent `srun`, `mpirun` invocations would block forever.
## Running batch jobs
Run batch job Run batch job
```console ```console
...@@ -278,3 +323,4 @@ $ scontrol -d show job $SLURM_JOBID | grep -i gres ...@@ -278,3 +323,4 @@ $ scontrol -d show job $SLURM_JOBID | grep -i gres
``` ```
[1]: https://slurm.schedmd.com/ [1]: https://slurm.schedmd.com/
[2]: https://slurm.schedmd.com/srun.html#SECTION_OUTPUT-ENVIRONMENT-VARIABLES
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment