#!/bin/bash
#PBS -N nemogyre
#PBS -l mppwidth=6
#PBS -l mppnppn=6
#PBS -l walltime=00:20:00
#PBS -j oe
#PBS -A c01-hec
#PBS -m n

export TMPDIR=/work/c01/c01/arp28/tmp

cd $PBS_O_WORKDIR

#export PAT_RT_SUMMARY=0

export NPROC=`qstat -f $PBS_JOBID | awk '/mppwidth/ {print $3}'`
export NTASK=`qstat -f $PBS_JOBID | awk '/mppnppn/  {print $3}'`
export NLSPATH=/work/c01/c01/arp28/NEMOBENCH/Exp_modipsl/lib.cat

# Instruct os to not use any 'non' heap memory-mapping regions - eliminates
# system calls to mmap.
export MALLOC_MMAP_MAX_=0
# NEMO R2 config. typically uses ~330MB/node on 4 PEs so use 400 MB below
#export MALLOC_TRIM_THRESHOLD_=419430400
# is typically ~189 MB on 16 PEs so use 200 MB:
#export MALLOC_TRIM_THRESHOLD_=209715200
ulimit -c unlimited
ulimit -a
pwd
date
rm GYRE_*.nc
aprun -n 6 -N 6 ../BLD/bin/nemo.exe
date
rm GYRE_*.nc
