Batch Environment Variable Summary

The batch system provides several environment variables that you may want to use in your job script. This section is a summary of the most useful of these variables. Many of them are discussed in more detail elsewhere in this document. The ones beginning with SLURM_ are described in the online manual page for sbatch (man sbatch).

Environment Variable Description
$TMPDIR The absolute path and name of the temporary directory created for this job on the local file system of each node
$PFSDIR The absolute path and name of the temporary directory created for this job on the parallel file system
$SLURM_SUBMIT_DIR The absolute path of the directory from which the batch script was started
$SLURM_GPUS_ON_NODE Number of GPUs allocated to the job on each node (works with --exclusive jobs).
$SLURM_ARRAY_JOB_ID Unique identifier assigned to each member of a job array
$SLURM_JOB_ID The job identifier assigned to the job by the batch system
$SLURM_JOB_NAME The job name supplied by the user

 

The following environment variables are often used in batch scripts but are not directly related to the batch system.

 

Environment Variable Description Comments
$OMP_NUM_THREADS The number of threads to be used in an OpenMP program See the discussion of OpenMP elsewhere in this document. Set in your script. Not all OpenMP programs use this value.
$MV2_ENABLE_AFFINITY Thread affinity option for MVAPICH2. Set this variable to 0 in your script if your program uses both MPI and multithreading. Not needed with MPI-1.
$HOME The absolute path of your home directory. Use this variable to avoid hard-coding your home directory path in your script.