#!/bin/bash 
# 
# --- the only items that change are marked with *** 
# --------------------------------------------------

# --- the name of this job ***
#PBS -N ACT1-130110-5 

# --- Mail options, mail on execution("b") 
#PBS -m e 
#PBS -M mtillack@ucsd.edu 

# --- run the job on 'n' nodes with 'y' processors per node (ppn) 
#PBS -l nodes=1:ppn=1 

# --- specify the memory required per node (in mb or gb) 
#PBS -l mem=1gb 

# --- specify the period of time the job will run in the format 
#PBS -l walltime=72:00:00 

# --- (optional) submit this job to a special queue. 
##PBS -q kruskal 

# --- do not rerun this job if it fails 
#PBS -r n 

# --- export all my environment variables to the job 
#PBS -V 

# --- combine both output and error streams into one file with the 
#     job name and id as the default file name 
#PBS -j oe 

# --- Log 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" 

# --- count the number of processors allocated to this run  
NPROCS=`wc -l < $PBS_NODEFILE` 
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 "-----------------------" 
echo The working directory is $PBS_O_WORKDIR  

## --- the path of your executable ***
EXEPATH="/p/aries/ACT1-130110/scripts/runaries05.sh &" 

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

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

# --- Run the program 
cd $PBS_O_WORKDIR 
echo -n 'Started job at : ' ; date 
$EXEPATH $ARGS 
echo -n 'Ended job at  : ' ; date 
echo " "  
exit 
