Template PBS script.
#!/bin/csh
#
# file: pbs.template
#
# purpose: template for PBS (Portable Batch System) script
#
# remarks: a line beginning with # is a comment;
# a line beginning with #PBS is a pbs command;
# assume (upper/lower) case to be sensitive;
#
# use: submit job with
# qsub pbs.template
#
# job name (default is name of pbs script file)
#PBS -N myjob
#
# resource limits: number of CPUs to be used
#PBS -l ncpus=25
#
# resource limits: number of nodes to be used
#PBS -l nodes=25:p4
#
# resource limits: amount of memory to be used
#PBS -l mem=256mb
#
# resource limits: max. wall clock time during which job can be running
#PBS -l walltime=2:30:00
#
# path/filename for standard output
#PBS -o mypath/my.out
#
# path/filename for standard error
#PBS -e mypath/my.err
#
# queue name, one of {dque}
# The default queue, "dque", need not be specified
#PBS -q dque
#
# files to be copied to execution server before script processing starts
# usage: -W stagein=local-filename@remotehost:remote-filename
#PBS -W [email protected]:/raid3/simon/runs/input/my.input
#
# files to be copied from execution server after script processing
# usage: -W stageout=local-filename@remotehost:remote-filename
#PBS -W [email protected]:raid3/simon/runs/output/my.outout
#
# start job only after MMDDhhmm, where M=Month, D=Day, h=hour, m=minute
# e.g., November 30th, 17:30
#PBS -a 11301730
#
# send me mail when job begins
#PBS -m b
# send me mail when job ends
#PBS -m e
# send me mail when job aborts (with an error)
#PBS -m a
# if you want more than one message, you must group flags on one line,
# otherwise, only the last flag selected executes:
#PBS -mba
#
# do not rerun this job if it fails
#PBS -r n
#
# export all my environment variables to the job
#PBS -V
#
# Using PBS - Environment Variables
# When a batch job starts execution, a number of environment variables are
# predefined, which include:
#
# Variables defined on the execution host.
# Variables exported from the submission host with
# -v (selected variables) and -V (all variables).
# Variables defined by PBS.
#
# The following reflect the environment where the user ran qsub:
# PBS_O_HOST The host where you ran the qsub command.
# PBS_O_LOGNAME Your user ID where you ran qsub.
# PBS_O_HOME Your home directory where you ran qsub.
# PBS_O_WORKDIR The working directory where you ran qsub.
#
# These reflect the environment where the job is executing:
# PBS_ENVIRONMENT Set to PBS_BATCH to indicate the job is a batch job, or
# to PBS_INTERACTIVE to indicate the job is a PBS interactive job.
# PBS_O_QUEUE The original queue you submitted to.
# PBS_QUEUE The queue the job is executing from.
# PBS_JOBID The job's PBS identifier.
# PBS_JOBNAME The job's name.
#
# ------------------------------------------------------------
# Log some interesting information
# ------------------------------------------------------------
#
echo " "
echo "-------------------"
echo "This is a $PBS_ENVIRONMENT job"
echo "This job was submitted to the queue: $PBS_QUEUE"
echo "The job's id is: $PBS_JOBID"
echo "-------------------"
echo "The master node of this job is: $PBS_O_HOST"

# --- the nodes allocated to this job are listed in the
# file $PBS_NODEFILE

# --- count the number of processors allocated to this run
# --- $NPROCS is required by mpirun.
NPROCS=`wc -l
NNODES=`uniq $PBS_NODEFILE | wc -l`

echo "This job is using $NPROCS CPU(s) on the following $NNODES node(s):"
echo "-----------------------"
uniq $PBS_NODEFILE | sort
echo "-----------------------"

# ------------------------------------------------------------
# Setup execution variables
# ------------------------------------------------------------
#
# --- define standard output and error files for the job
# default is .o and .e
##PBS -o petrel_test.out
##PBS -e petrel_test.err
# --- or combine both output and error streams into one file
#PBS -j oe

# --- PBS_O_WORKDIR is the current working directory from
# which this job was submitted using 'qsub'
echo The working directory is $PBS_O_WORKDIR
#
# --- the path of your executable
EXEPATH=""

# --- declare any program arguments
ARGS=""

# --- set the path for the correct version of mpirun
# (it depends on compiler choice)
#
# --- Portland Group Fortran90 compiler
#
MPIPATH="/usr/local/pgf90/mpich-1.2.5.2/bin/mpirun"

# --- other fortran compilers (LFF95, etc.)
MPIPATH="/usr/local/lff95/mpi/bin/mpirun"

# --- echo the command syntax
echo "The command syntax for this job is:"
echo $MPIPATH -np $NPROCS $EXEPATH $ARGS
echo " "

# ------------------------------------------------------------
# Run the program
# ------------------------------------------------------------
#
# --- 'cd' to the current working directory (by default, qsub
# starts from the home directory of the user).
# this is useful if you have input files in the working
# directory.
cd $PBS_O_WORKDIR

# --- print out the current time, then use the 'time' command
# to start the program and print useful stats
#
echo -n 'Started program at : ' ; date

time $MPIPATH -np $NPROCS $EXEPATH $ARGS

echo -n 'Ended program at : ' ; date

echo " "
exit