diff --git a/docs.it4i/general/slurm-job-submission-and-execution.md b/docs.it4i/general/slurm-job-submission-and-execution.md index 0db4ec9c245152f3e1d457358a3d494f03665c37..f260135ef0ecd429b0318a5b3a8b49b0a76de34d 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