### NAS Parallel Benchmark (http://www.nas.nasa.gov/publications/npb.html) is a
### small set of benchmarks that was intended for use when evaluating
### supercomputers. They are all computational kernels. In this configuration,
### the workload is parallelised on a single machine using MPICH.

# List of monitors
export RUN_MONITOR=yes
export MONITORS_ALWAYS=
export MONITORS_GZIP="proc-vmstat mpstat turbostat"
export MONITORS_WITH_LATENCY="vmstat"
export MONITOR_UPDATE_FREQUENCY=10

# NAS Parallel Benchmark
export NAS_MPICH_VERSION=mpich
export NAS_MPICH_PATH=/usr/$MMTESTS_LIBDIR/mpi/gcc/$NAS_MPICH_VERSION/bin
export NAS_MPICH_LIBPATH=/usr/$MMTESTS_LIBDIR/mpi/gcc/$NAS_MPICH_VERSION/$MMTESTS_LIBDIR
export NAS_CLASS=`nas-class.sh`
export NAS_USE_CMA=no
export NAS_MAX_CPUS=$NUMCPUS
export NAS_ITERATIONS=3

if [ "$NAS_MAX_CPUS" -lt 4 ]; then
	echo "ERROR: Too few CPUs ($NAS_MAX_CPUS) to parallelise loads requiring a square number of helpers"
	exit -1
fi

# Set additional mpi options if required
#grep -q " ht " /proc/cpuinfo
#if [ $? -eq 0 ]; then
#	if [ $NAS_MAX_CPUS -gt $((NUMCPUS/2)) ]; then
#		echo WARNING: Setting use-hwthread-cpus because HT siblings must be used
#		NAS_MPICH_OPTS+=" --use-hwthread-cpus"
#	fi
#fi
#if [ "`whoami`" = "root" ]; then
#	NAS_MPICH_OPTS+=" --allow-run-as-root"
#fi
#export NAS_MPICH_OPTS

# Select tests based on class
case $NAS_CLASS in
C)
	export MMTESTS="nas-mpich-bt nas-mpich-cg nas-mpich-ep nas-mpich-ft nas-mpich-is nas-mpich-lu nas-mpich-mg nas-mpich-sp"
	;;
D)
	export MMTESTS="nas-mpich-bt nas-mpich-cg nas-mpich-ep              nas-mpich-is nas-mpich-lu nas-mpich-mg nas-mpich-sp"
	;;
*)
	die "Unrecognised class $NAS_CLASS"
esac

export SLURM_ENV_SETUP=no
