From 1a015b6a871350b4afc5d4e98a03690248836b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Sl=C3=ADva?= <roman.sliva@vsb.cz> Date: Tue, 18 Jul 2023 15:37:19 +0200 Subject: [PATCH] Update slurm-job-submission-and-execution.md --- .../slurm-job-submission-and-execution.md | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/docs.it4i/general/slurm-job-submission-and-execution.md b/docs.it4i/general/slurm-job-submission-and-execution.md index 0db4ec9c2..f260135ef 100644 --- a/docs.it4i/general/slurm-job-submission-and-execution.md +++ b/docs.it4i/general/slurm-job-submission-and-execution.md @@ -116,13 +116,43 @@ $ cat slurm-1511.out #### Job Environment Variables -Slurm exposes useful information about job to job main process (usually shell) via environment variables. -To view all of the Slurm's environment variables, use the command: +Slurm provides useful 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). -```shell +See all Slurm variables + +``` set | grep ^SLURM ``` +### Useful Variables + +| variable name | description | example | +| ------ | ------ | ------ | +| SLURM_JOBID | job id of the executing job| 593 | +| SLURM_JOB_NODELIST | nodes allocated to the job | p03-amd[01-02] | +| SLURM_JOB_NUM_NODES | number of nodes allocated to the job | 2 | +| SLURM_STEP_NODELIST | nodes allocated to the job step | p03-amd01 | +| SLURM_STEP_NUM_NODES | number of nodes allocated to the job step | 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 +cn[10-11] +``` + +Expand nodelist to list of nodes. + +``` +$ scontrol show hostnames $SLURM_JOB_NODELIST +cn10 +cn11 +``` + #### Common Job Workflow !!! Note -- GitLab