#!/bin/bash
#PBS -A UJHB0015
#PBS -N nonCaseTests1
#PBS -j oe
#PBS -q regular
#PBS -l walltime=12:00:00
#PBS -l select=1:ncpus=36:mpiprocs=64:ompthreads=72

source ~/.bashrc

if [[ ! -z "$MODULE_LIST" ]]; then
    # user passed a list of modules to load as the environment variable MODULE_LIST
    module purge
    module load $MODULE_LIST
elif [[ ! -z "$MODULE_SET" ]]; then
    # user passed a module set name to load as the environment variable MODULE_SET
    module purge
    module restore $MODULE_SET
fi

if [[ ! -z "$MPT_VERSION" ]]; then
    echo "USING MPIEXEC_MPT"
    export MPICOMMAND="mpiexec_mpt omplace"
else
    echo "USING MPIRUN"
    export MPICOMMAND="mpirun"
fi

module list
hostname
export OMP_NUM_THREADS=72
export KMP_STACKSIZE=128M
export MPI_TYPE_DEPTH=32

echo ""
echo "Running Gamera Tests"
date
./gamTests > gamTests.out
date
echo "Gamera Tests Complete"
echo | tail -n 3 ./gamTests.out

echo ""
echo "Running Remix Tests"
date
./mixTests > mixTests.out
date
echo "Remix Tests Complete"
echo | tail -n 3 ./mixTests.out

echo ""
echo "Running Voltron Tests"
date
./voltTests > voltTests.out
date
echo "Voltron Tests Complete"
echo | tail -n 3 ./voltTests.out

echo ""
echo "Running Base MPI Tests"
date
${MPICOMMAND} ./baseMpiTests > baseMpiTests.out
date
echo "Base MPI Tests Complete"
echo | tail -n 3 ./baseMpiTests.out

echo ""
echo "Running Gamera MPI Tests"
date
${MPICOMMAND} ./gamMpiTests > gamMpiTests.out
date
echo "Gamera MPI Tests Complete"
echo | tail -n 3 ./gamMpiTests.out

