#! /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 compiler
  module unload mpi
  module unload netcdf-fortran
  module unload netcdf-c
  module unload hdf5
  module unload parallel-netcdf

  module load compiler/intel/2017.1.132
#  module load mpi/sgimpt/2.15
  module load mpi/sgimpt/2.18
  module load costinit
  module load netcdf-fortran/intel/4.4.2
  module load hdf5-mpi/intel/sgimpt/1.8.15
  module load parallel-netcdf/intel/sgimpt/1.8.1

  #module list
endif

#setenv NETCDF_PATH /app/COST/netcdf-fortran/4.4.2/intel
#setenv PNETCDF_PATH /p/app/unsupported/COST/parallel-netcdf/1.8.1/intel/sgimpt/lib/
setenv NETCDF_PATH `pkg-config --variable=prefix netcdf-fortran`
setenv PNETCDF_PATH `pkg-config --variable=prefix pnetcdf`
#setenv LD_LIBRARY_PATH ${NETCDF_PATH}/lib:$LD_LIBRARY_PATH

#-------------------------------------------------------------------------------
# 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
