#!/bin/bash

EXPORTPATH="/gpfs/projects/bsc32/models/NES_master"
SRCPATH="/gpfs/projects/bsc32/models/NES_master/tests"

EXE="1.1-test_read_write_projection.py"
#EXE="1.2-test_create_projection.py"
#EXE="2.1-test_spatial_join.py"
#EXE="2.2-test_create_shapefile.py"
#EXE="2.3-test_bounds.py"
#EXE="2.4-test_cell_area.py"
#EXE="3.1-test_vertical_interp.py"
#EXE="3.2-test_horiz_interp_bilinear.py"
#EXE="3.3-test_horiz_interp_conservative.py"
#EXE="4.1-test_daily_stats.py"

module purge
module load Python/3.7.4-GCCcore-8.3.0
module load netcdf4-python/1.5.3-foss-2019b-Python-3.7.4
module load cfunits/1.8-foss-2019b-Python-3.7.4
module load xarray/0.17.0-foss-2019b-Python-3.7.4
module load pandas/1.2.4-foss-2019b-Python-3.7.4
module load mpi4py/3.0.3-foss-2019b-Python-3.7.4
module load filelock/3.7.1-foss-2019b-Python-3.7.4
module load pyproj/2.5.0-foss-2019b-Python-3.7.4
module load eccodes-python/0.9.5-foss-2019b-Python-3.7.4
module load geopandas/0.10.2-foss-2019b-Python-3.7.4
module load Shapely/1.7.1-foss-2019b-Python-3.7.4

for nprocs in 1 2 4 8 16
do
    JOB_ID=`sbatch --ntasks=${nprocs} --qos=debug --exclusive --job-name=NES_${EXE}_${nprocs} --output=./log_NES-${EXE}_nord3v2_${nprocs}_%J.out --error=./log_NES-${EXE}_nord3v2_${nprocs}_%J.err -D . --time=02:00:00 --wrap="export PYTHONPATH=${EXPORTPATH}:${PYTHONPATH}; cd ${SRCPATH}; mpirun --mca mpi_warn_on_fork 0 -np ${nprocs} python ${SRCPATH}/${EXE}"`
done