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