• National Institute for Computational Sciences is a UT/ORNL Partnership

PBS Environment Variables

  • PBS_O_WORKDIR
    • PBS sets the environment variable PBS_O_WORKDIR to the directory from which the batch job was submitted.
    • By default, a job starts in your home directory. Often, you would want to do cd $PBS_O_WORKDIR to move back to the directory you were in. The current working directory when you start aprun must be on Lustre.
    • Include the following command in your script if you want it to start in the submission directory:
cd $PBS_O_WORKDIR
  • PBS_JOBID
    • PBS sets the environment variable PBS_JOBID to the job's ID.
    • A common use for PBS_JOBID is to append the job's ID to the standard output and error file(s), such as the following:
%PBS -o scriptname.o$PBS_JOBID
  • PBS_NNODES
    • PBS sets the environment variable PBS_NNODES to the number of cores requested (not nodes). Given that Kraken has 12 cores per node, the number of nodes would be given by $PBS_NNODES/12.
    • For example, a standard MPI program is generally started with aprun -n $PBS_NNODES ./a.out. See Running Jobs.