#!/bin/bash
#SBATCH -J psp1th02aR
#SBATCH -N 63
#SBATCH --ntasks-per-node 48
#SBATCH -t 48:00:00
#SBATCH -o job.out
#SBATCH -e job.err
#SBATCH -p skx-normal                     # development, normal
#SBATCH --mail-user=cdowns@predsci.com
#SBATCH --mail-type=begin                  # email me when the job starts
#SBATCH --mail-type=end                    # email me when the job finishes

runid=$SLURM_JOB_NAME
root_disk=$SCRATCH

sourcedir=$HOME/mas/runs/$runid
rundir_root=${root_disk}/mas/runs

if [[ ! -d ${rundir_root} ]]; then
  mkdir $rundir_root
fi

if [[ ! -d ${rundir_root}/${runid} ]]; then
  mkdir $rundir_root/$runid
fi

cd $rundir_root/$runid
\cp $sourcedir/* .

#export DEBUG_CACHE_BINARY=1
#cache_binary $PWD ./mas

ibrun ./mas -timer mpi -wc_limit 48:00:00 -wc_res 20:00 $runid >& $runid.log

