PBS Examples

You may use the following PBS batch script as a template. Lines that begin with #PBS are parsed to define PBS options, they're not just comments. 

There are a few key syntax changes in PBS Pro version 8.  Please read the PBS Professional 8.0 User Guide for more information.
In particular, where you previously would have written -lnodes=4:ppn=2 to select 4 nodes with 2 processes per node, you must now now must write -lselect=4:ncpus=2:mpiprocs=2.

#!/bin/sh
### Set the job name
#PBS -N myprogram

### Declare myprogram non-rerunable
#PBS -r n

### Specifiy destinations for your myprogram's output
### These prevent file copy errors; it uses simple cp to copy to the NFS filesystem on localhost
### Replace $USER with your username after creating your directory in /work.
#PBS -e localhost:/work/$USER/test.err
#PBS -o localhost:/work/$USER/test.log

### Similar syntax words for staging files.
### #PBS -W stagein=/scratch/file.in@localhost:/full/file.in
### #PBS -W stageout=/scratch/file.out@localhost:/full/file.out

### Have PBS mail you results
#PBS -m ae

### Set the queue to "workq" or "bigmem", the only two available queues. 
### "bigmem"; is a two node, four processor cluster, where each machine has 8GB of memory.
#PBS -q workq

### Specify the number of cpus for your job.  This example will run on 16 cpus 
### using 8 nodes with 2 processes per node.  Set this to a max of 2 and 2 if you 
### are using the "bigmem" queue.
### OBSOLETE SYNTAX -> PBS -l nodes=8:ppn=2 <- OBSOLETE SYNTAX
#PBS -l select=8:ncpus=2:mpiprocs=2
### There are several CITRIS specific boolean options to be aware of to ensure 
### your software runs on the nodes you intend. They are:
###
### cpu900
### cpu1300
### gm
### gm_pci64b
### gm_pcixd
###
### For example, to run on 2 processes on each of 2 nodes with Myrinet PCIXD cards you write
### #PBS -l select=2:ncpus=2:mpiprocs=2:gm_pcixd=True
###
### Or for 1 process on each of 4 1.3GHz nodes when you don't need GM
### #PBS -l select=4:cpu1300=True:gm=False

### Switch to the working directory; by default PBS launches processes from your home directory.
### Jobs should only be run from /home, /project, or /work; PBS returns results via NFS.
echo Working directory is $PBS_O_WORKDIR
cd $PBS_O_WORKDIR 

echo Running on host `hostname`
echo Time is `date`
echo Directory is `pwd`
echo This jobs runs on the following processors:
echo `cat $PBS_NODEFILE`
# Define number of processors
NPROCS=`wc -l < $PBS_NODEFILE`
echo This job has allocated $NPROCS cpus
# Use gexec to run a program on the assigned processors.  $GEXEC_SVRS is automatically defined for you.
gexec -n 0 myprogram

### Alternatively, uncomment to run a parallel MPI executable.
### #mpirun -v -machinefile $PBS_NODEFILE -np $NPROCS mympiprogram


UC Berkeley Clustered Computing - Last modified on 16-Feb-2007 16:38:41 -0800