#! /bin/csh -f

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

if (-e /opt/modules/default/init/csh) then
  source /opt/modules/default/init/csh
  module rm PrgEnv-pgi
  module rm PrgEnv-cray 
  module rm PrgEnv-gnu
  module rm pgi
  module rm cray
else
  echo "ERROR: Failed to initialize modules"
  exit -1
endif

# invoking modules sets $MPICH_DIR and $NETCDF_DIR

if ( $COMPILER == "pgi" ) then
    module load PrgEnv-pgi
    module switch pgi       pgi/11.10.0        
endif

if ( $COMPILER == "gnu" ) then
    module load PrgEnv-gnu
    module load torque
endif    

if ( $COMPILER == "cray" ) then
    module load PrgEnv-cray/4.0.36
    module load cce/8.0.2
endif
module load torque/2.5.10
module load netcdf-hdf5parallel/4.1.3
module load parallel-netcdf/1.2.0

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

limit coredumpsize unlimited
limit stacksize unlimited

# The environment variable below increase the stack size, which is necessary for
# CICE to run threaded on this machine.  
setenv OMP_STACKSIZE 64M
setenv MPICH_ENV_DISPLAY 1
