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 PBS_ are described in the online manual page for qsub (“man qsub”).

Environment Variable Description Comments
$TMPDIR The absolute path and name of the temporary directory created for this job on the local file system of each node Access to local files is much faster than access to shared file systems. You should copy your files to $TMPDIR and work locally whenever possible. This directory is deleted when your job ends.
$PFSDIR   The absolute path and name of the temporary directory created for this job on the parallel file system Use the parallel file system rather than your home or project directory for heavy I/O if you can’t use $TMPDIR. This directory is deleted when your job ends.
$PBS_O_WORKDIR The absolute path of the directory from which the batch script was started Your batch job begins execution in your home directory even if you submit the job from another directory.
$PBS_NODEFILE The absolute path and name of the file containing the list of nodes and processors assigned to the job Sometimes used in a batch script to determine the number of nodes and/or processors requested.
$PBS_GPUFILE The absolute path and name of the file containing the list of gpus assigned to the job Oakley only. Sometimes used to determine which GPU should be used if only one was requested.
$PBS_ARRAYID Unique identifier assigned to each member of a job array Used with qsub -t. See the discussion of job arrays elsewhere in this document.
$PBS_JOBID The job identifier assigned to the job by the batch system For example, 123456. May be used as part of a directory name, for example.
$PBS_JOBNAME The job name supplied by the user The job name may be assigned in the script using the -N header.

 

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.