Skip to main content

PBS/TORQUE

Portable Batch System (PBS) is a computer software which performs job (a unit of work or unit of execution) scheduling in a HPC center, often used in conjunction with UNIX cluster environment. Currently available versions are OpenPBS, TORQUE, PBS professional etc.

Terascale Open-source Resource and QUEue manager (Torque) is a job scheduler. Jobs can be run interactively from a command line or scheduled by a non-interactive job scheduler, then controlled (suspending, resuming, or terminating of a job) through automatic or manual job controller.

At CARC all supercomputer batch jobs are submitted through the machine’s head node via the PBS/Torque resource manager, and are scheduled through the Maui scheduler.

Example PBS Scripts

All parallel supercomputers and clusters at the Center for Advanced Research Computing use the Portable Batch System (PBS) for job submission. Below are three example scripts.

PBS Hello World:

This example uses the “bash” shell to print a simple “Hello World” message. Note that it specifies the shell with the “-S” option. If you do not specify a shell using the “-S” option (either inside the PBS script or as an argument to qsub), then your default shell will be used.

## Introductory Example
## Copyright (c) 2018 The Center for Advanced Research Computing
## at The University of New Mexico
#PBS -lnodes=1:ppn=4
#PBS -lwalltime=1:00
## Specify the shell to be tcsh
#PBS -S /bin/bash
# print out a hello message
# indicating the host this is running on
export THIS_HOST=`hostname`
echo Hello World from host $THIS_HOST

Note that the “ppn” value must always be less than or equal to the number of physical cores available on each node of the system on which you are running. For example, on the wheeler supercomputer, ppn should be <=8. For more related informations see Systems specifications.

Multi-processor example script:

This example uses the “tcsh” shell.

## Introductory Example
## Copyright (c) 2018
## The Center for Advanced Research Computing
## at The University of New Mexico
#PBS -lnodes=1:ppn=2
#PBS -lwalltime=1:00
## Specify the shell to be tcsh
#PBS -S /bin/tcsh
# load the environment module to use OpenMPI built with the GNU compilers
module load openmpi/gnu
# print out a hello message from each of the processors on this host
# indicating the host this is running on
setenv THIS_HOST=`hostname`
mpirun -np 4 -machinefile $PBS_NODEFILE /bin/sh \-c \
'echo Hello World from process \$MXMPI_ID of \$MXMPI_NP on host $THIS_HOST'
echo Hello World from host `hostname`

Multi-node example script:

## Introductory Example
## Copyright (c) 2018
## The Center for Advanced Research Computing
## at The University of New Mexico
#PBS -lnodes=4:ppn=2
#PBS -lwalltime=1:00
## Specify the shell to be tcsh
#PBS -S /bin/tcsh
# load the environment module to use OpenMPI built with the GNU compilers
module load openmpi/gnu
# print out a hello message from each of the processors on this host
# indicating the host this is running on
mpirun -np 16 -machinefile $PBS_NODEFILE /bin/sh \-c \
'echo Hello World from process \$MXMPI_ID of \$MXMPI_NP on host `hostname`'