HPC Grid Tutorial: $PBS_NODEFILE Environment Variable

$PBS_NODEFILE is a variable containing the file name such as /var/spool/PBS/aux/656205.vpbs3 that contains the list of nodes. The file will contain one node name per line for each core assigned to the job. 

1. In this example, we start a multinode interactive job. Type: qsub -I -q wsuq -l nodes=2:ppn=4


2. To find the value of the variable $PBS_NODEFILE. Type: echo $PBS_NODEFILE

The result is /var/spool/PBS/aux/656205.vpbs3. 

3. Show the contents of the $PBS_NODEFILE. Type: cat $PBS_NODEFILE

It defaults to grouping by cores per node. 

4. You can create a node list irrespective of cores per node. This can be piped to a new file location for use with some programs that get confused when the same node name appears multiple times. 

Type: cat $PBS_NODEFILE | sort -u

5. Rearrange grouping by nodes instead of grouping by cores per node.

Type: for i in 'seq 1 ${NCPUS}'; do cat $PBS_NODEFILE | sort -u; done

6. Randomize the list.

Type: for i in `cat $PBS_NODEFILE`; do echo "$RANDOM $i"; done | sort | sed -r 's/^[0-9]+ //'