#!/bin/bash
#SBATCH --qos=debug
#SBATCH -N 1
#SBATCH -n 5
#SBATCH -c 1
#SBATCH -t 0:05:00
#SBATCH --exclusive
# Please indicate the machine that is in use. for now only includes "BSC_MN4" & "EC_HPC2020"
platform="BSC_MN4" 

if [ $platform = BSC_MN4 ]; then
    # slurm specific options for Marenostrum4

    module load python/3.6.1
    module load netcdf/4.2
    module load CDO/1.9.3
    module list
    export MPIRUN="mpirun"
    source ../sources/oasis3-mct/generated/python/init.sh  

elif [ $platform = EC_HPC2020 ] ; then

    module reset
    #module load python3/3.8.8-01 prgenv/intel intel/2021.4.0 intel-mkl/19.0.5 hpcx-openmpi/2.9.0 hdf5-parallel/1.10.6 netcdf4-parallel/4.7.4 cdo
    module load python3/3.10.10-01 prgenv/intel intel/2021.4.0 hpcx-openmpi/2.9.0 hdf5-parallel/1.12.2 netcdf4-parallel/4.9.1 cdo 
    module list
    export MPIRUN="mpirun -oversubscribe"
    source ../sources/oasis3-mct/generated/python/init.sh
    export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${NETCDF4_PARALLEL_DIR}/lib:${ECCODES_DIR}/lib:${HDF5_DIR}/lib"
    echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH

fi 

#source ../sources/oasis3-mct/generated/python/init.sh

#bash ./run_example.sh pythoncompat forcing 4 2005-01-01 2005-03-01 0 128 true
#bash ./run_example.sh fortran forcing 4 2005-01-01 2005-03-01 0 128 true
#bash ./run_example-t1279.sh python forcing 4 2010-01-01 2010-03-01 0 128 true

#bash ./run_example.sh datacoupler co2 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2.yaml
#bash ./run_example.sh      co2box co2 4 2005-01-01 2005-03-01 0 128 true false

bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml
#bash ./run_example.sh python co2 4 2005-01-01 2005-03-01 0 128 true
#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true
#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true false
#bash ./run_example.sh co2box co2 4 2005-01-01 2005-05-01 0 128 true false
