#! /bin/csh -f

#===============================================================================
# Build time settings
#===============================================================================

#if (-e /usr/share/modules/init/csh) then
#  source /usr/share/modules/init/csh
#  source /hafs_x86_64/devel/share/Modules/init/csh
#  module load subversion
if (-e ${MODULESHOME}/init/csh) then
  source ${MODULESHOME}/init/csh
else
  echo "ERROR: Failed to initialize modules"
  exit -1
endif

# invoking modules sets $MPICH_DIR and $CRAY_NETCDF_DIR

if ( $COMPILER == "intel" ) then
#  module purge
#  module unload gcc-compilers
#  module unload intel-compilers
#  module unload mpt
#  module unload netcdf-fortran
#  module unload netcdf-c
#  module unload hdf5
#  module unload pbs
  module unload compiler
  module unload mpt
  module unload netcdf-fortran

  module load costinit
  module load subversion
  module load compiler/intel/18.0.1.163
#  module load mpt/2.17
  module load mpt/2.18
  module load netcdf-fortran/intel/4.4.2
#  module load netcdf-pnetcdf/intel/sgimpt/4.3.3.1
  module load pnetcdf/intel/sgimpt/1.8.1
#  module load pbs/12.2.4.142262
  #module list
endif

setenv LD_LIBRARY_PATH /p/app/COST/dependencies/curl/7.63.0/intel/lib:$LD_LIBRARY_PATH
#setenv NETCDF_PATH /app/COST/netcdf-fortran/4.4.2/intel
setenv NETCDF_PATH /app/COST/netcdf-fortran/4.4.2/intel
#setenv NETCDF_PATH `pkg-config --variable=prefix netcdf-fortran`
#setenv LD_LIBRARY_PATH ${NETCDF_PATH}/lib:$LD_LIBRARY_PATH
setenv PNETCDF_PATH `pkg-config --variable=prefix pnetcdf`

#-------------------------------------------------------------------------------
# Runtime environment variables
#-------------------------------------------------------------------------------

limit coredumpsize unlimited
limit stacksize unlimited

setenv MPI_IB_RNR_TIMER 26
setenv MPI_IB_TIMEOUT 22  
setenv MPI_IB_SERVICE_LEVEL 1
setenv MPI_VERBOSE true      
unsetenv MPI_IB_CONGESTED

setenv WRFIO_NCD_LARGE_FILE_SUPPORT 1
setenv WRF_EM_CORE 1
