#!/bin/csh
# First Line must be the Shell used.  Should be node LOCAL
# Modify: qsub cpgm4.job; execute in batch on TCS; generic C source: cpgm.c
# also needs cdata input and send output to cpgm4.output using 4 processors
# These first few lines set Portable Batch System (PBS) scheduler directives.
# set h:mm:ss
#PBS -l walltime=1:00 
# set number nodes:procs: 1:1,1:4,2:16,...,nodes:procs
#PBS -l rmsnodes=1:4 
# set project-name for MCS572S03
#PBS -l rmsproject=sc70jjp 
#PBS -e cpgm4.error
#PBS -o cpgm4.output
#
# turn on echo
set echo           
#
# This job requires the program source cpgm.c and data file cdata
# copy source to local $SCRATCH
cp ${SCRATCH}/cpgm.c  .    
# copy cdata to local $SCRATCH
cp ${SCRATCH}/cdata  .    
#
# Compile the program:  compiles and links  cpgm
cc -O -lmpi -lelan -arch ev67 -o cpgm cpgm.c  
# using parallel optimization and the mpi library
#
# runs executable called cpgm 
prun -N ${RMS_NODES} -n ${RMS_PROCS} ./cpgm < cdata
# within mpprun environment and full path "./cpgm" is needed. 
# output using nprocs=4 should be in ${SCRATCH}/cpgm4.output where qsub run
#
