Environment Variables

When a SLURM-scheduled work begins, it requires some information about its execution environment. For instance, It needs to identify the working directory and the nodes assigned to it. SLURM sends this data to the executing job through environment variables. The most common environment variables are as follows:

VARIABLE
DESCRIPTION

$SLURM_JOB_ID

The Job ID.

$SLURM_SUBMIT_DIR

The path of the job submission directory.

$SLURM_SUBMIT_HOST

The hostname of the node used for job submission.

$SLURM_JOB_NODELIST

Contains the definition (list) of the nodes that is assigned to the job.

$SLURM_GPUS

Number of GPUs requested.

$SLURM_MEM_PER_GPU

Memory per GPU.

$SLURM_MEM_PER_NODE

Memory per node. Same as --mem .

$SLURM_NTASKS

Same as --ntasks. The number of tasks.

$SLURM_NTASKS_PER_GPU

Number of tasks requested per GPU.

$SLURM_NTASKS_PER_NODE

Number of tasks requested per node.

$SLURM_NTASKS_PER_CORE

Number of tasks requested per core.

$SLURM_NPROCS

Same as --ntasks. See $SLURM_NTASKS.

$SLURM_NNODES

Total number of nodes in the job’s resource allocation.

$SLURM_TASKS_PER_NODE

Number of tasks to be initiated on each node.

$SLURM_ARRAY_JOB_ID

Job array’s master job ID number.

$SLURM_ARRAY_TASK_ID

Job array ID (index) number.

$SLURM_ARRAY_TASK_COUNT

Total number of tasks in a job array.

$SLURM_ARRAY_TASK_MAX

Job array’s maximum ID (index) number.

$SLURM_ARRAY_TASK_MIN

Job array’s minimum ID (index) number.

Visit the SLURM page on environment variables for a complete list of environment variables.