#!/bin/bash
#PBS -N wDashGo
#PBS -A UJHB0019
#PBS -l walltime=12:00:00
#PBS -q main
#PBS -j oe
#PBS -l select=8:ncpus=128:mpiprocs=2:ompthreads=64+3:ncpus=128:mpiprocs=1:ompthreads=128

echo "Job $PBS_JOBID started at `date` on `hostname` in directory `pwd`."

echo 'Setting up MAGE environment.'
source $KAIJUROOTDIR/scripts/setupEnvironment.sh

echo 'Loading modules.'
module --force purge
module load $MODULE_LIST
echo 'The following modules are loaded:'
module list

echo 'Setting environment variables.'
MPICOMMAND="mpiexec $KAIJUHOME/scripts/preproc/pinCpuCores.sh"
export TMPDIR=/glade/work/ewinter/mage_testing/derecho/tmp
export OMP_NUM_THREADS=128
export MPI_TYPE_DEPTH=32
export KMP_STACKSIZE=128M
echo 'The active environment variables are:'
printenv

# Run the model.
$MPICOMMAND ./voltron_mpi.x weeklyDashGo.xml > weeklyDashGo.out

echo "Job $PBS_JOBID ended at `date` on `hostname` in directory `pwd`."
