Describe InfolabClusterComputeHowtoMpi here.
Here is an example of a bit more complex script to run an MPI job (copied from http://csc.cnsi.ucsb.edu/docs/running-jobs-torque):
#PBS -l nodes=2:ppn=4
# Make sure that we are in the same subdirectory as where the qsub command
# is issued.
cd $PBS_O_WORKDIR
# make a list of allocated nodes(cores)
cat $PBS_NODEFILE > nodes
# How many cores total do we have?
NO_OF_CORES=`cat $PBS_NODEFILE | egrep -v '^#'\|'^$' | wc -l | awk '{print $1}'`
NODE_LIST=`cat $PBS_NODEFILE `
# Just for kicks, see which nodes we got.
echo $NODE_LIST
# Run the executable. *DO NOT PUT* a '&' at the end!!
mpirun -np $NO_OF_CORES -machinefile nodes ./pi3 >& log
Infolab wiki