#!/bin/csh

source .env_mach_specific.csh
#eval ` ../../../../E3SM2.1/cime/CIME/Tools/get_case_env`

#set topdir = "/pscratch/sd/z/zhan391/DARPA_project/e3sm_model/code/deepONet" 
#set topdir = "/global/homes/z/zhan391/.conda/envs/pytorch/lib/python3.10/site-packages/torch"
#set topdir = "/global/homes/z/zhan391/.conda/envs/pytorch/lib/python3.8/site-packages/torch"
set topdir="/global/homes/z/zhan391/.conda/envs/pytorch/torch"

setenv LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:${topdir}/lib" 
#setenv PYTHONPATH "${topdir}/pytorch/torch" #/lib/python3.10/site-packages"
set slib = " -L${topdir}/lib -L${CRAY_HDF5_PARALLEL_PREFIX}/lib -lhdf5_hl -lhdf5 -L${CRAY_NETCDF_HDF5PARALLEL_PREFIX}/lib -L${CRAY_PARALLEL_NETCDF_PREFIX}/lib -lpnetcdf -lnetcdf -lnetcdff"

#gfortran ml_model_prediction.f90 -o exec -O2 -g -fbounds-check -I${topdir}/include -I${topdir}/include/mod_files -L${topdir}/lib -lpytorch_fort_proxy -lpytorch_proxy  -I${NETCDF_DIR}/include -I${NETCDF_DIR}/lib -lnetcdff -lnetcdf $slib

ftn ml_model_prediction.f90 -o exec -O2 -g -fbounds-check -I${topdir}/include -I${topdir}/include/mod_files -L${topdir}/lib -lpytorch_fort_proxy -lpytorch_proxy  -I${NETCDF_DIR}/include -I${NETCDF_DIR}/lib -lnetcdff -lnetcdf $slib

./exec
#srun  --label  -n 256 -N 4 -c 4 --cpu_bind=cores -m plane=64 exec 

