SLURM Environmental Variables

From UFRC
Jump to navigation Jump to search

Slurm passes configuration data to jobs via environmental variables. The following is a list of commonly used variables that are set by Slurm for each job

Slurm Job Environment Variables
Slurm Variable Name Description
$SLURM_CPUS_ON_NODE Number of cores/node
$SLURM_CPUS_PER_TASK Number of cores per task. I.e., the value given to the -cpus-per-task or -c sbatch options. Not set unless one of those options given.
$SLURM_JOB_ID Job ID
$SLURM_JOBID Deprecated. Same as SLURM_JOB_ID
$SLURM_JOB_NAME Job Name
$SLURM_JOB_NODELIST Nodes assigned to job
$SLURM_JOB_NUM_NODES Number of nodes allocated to job
$SLURM_LOCALID Index to core running on within node
$SLURM_NODEID Index to node running on relative to nodes assigned to job
$SLURM_NTASKS Total number of cores for job
$SLURM_PROCID Index of task relative to job
$SLURM_SUBMIT_DIR Submit Directory
$SLURM_SUBMIT_HOST Host submitted from
$SLURM_TASKS_PER_NODE This gives a comma-delimited list of integers representing the task per the node, using the same ordering as in SLURM_JOB_NODELIST. If consecutive nodes have the same task count, the integer will be followed by '(xN)', so the example value is for 2 tasks on the first three nodes and 1 task on the fourth node.