|
| 1 | +#!/usr/bin/env bash-*-Shell-script-functions*- |
| 2 | + |
| 3 | +########################################################################### |
| 4 | +### Module File to load the required environment modules for the NEMS application |
| 5 | +### |
| 6 | +### Author: Panagiotis Velissariou < [email protected]> |
| 7 | +### Date: June 26 2021 |
| 8 | +########################################################################### |
| 9 | + |
| 10 | + |
| 11 | +#################### |
| 12 | +# Get the directory where the script is located |
| 13 | +if [[ $(uname -s) == Darwin ]]; then |
| 14 | + myDIRS="$(cd "$(dirname "$(grealpath -s "${BASH_SOURCE[0]}" )" )" && pwd -P)" |
| 15 | +else |
| 16 | + myDIRS="$(cd "$(dirname "$(realpath -s "${BASH_SOURCE[0]}" )" )" && pwd -P)" |
| 17 | +fi |
| 18 | +myDIRS="${myDIRS} . ${APPMODS_DIR}" |
| 19 | +#################### |
| 20 | + |
| 21 | + |
| 22 | +# This script is responsible for loading modules that are |
| 23 | +# compatible with the NUOPC Layer version used in NEMS. |
| 24 | + |
| 25 | + |
| 26 | +#################### |
| 27 | +### (1) Load all needed environment modules. |
| 28 | +module purge |
| 29 | +module load cmake |
| 30 | + |
| 31 | +module use /scratch2/STI/coastal/common/apps/modulefiles |
| 32 | +module load hpc-common |
| 33 | + |
| 34 | +#module load hpc-intel/19.0.5.281 hpc-impi |
| 35 | +#module load hpc-intel/2020.2 hpc-impi |
| 36 | +module load hpc-intel/2022.1.2 hpc-impi |
| 37 | +#module load hpc-intel/2022.3.0 hpc-impi |
| 38 | + |
| 39 | +module load hdf5/1.10.9 netcdf/4.7.4 |
| 40 | +module load proj/4.8.0 |
| 41 | +module load parmetis/4.0.3 |
| 42 | +module load esmf/8.3.1 |
| 43 | + |
| 44 | + |
| 45 | +################### |
| 46 | +### (2) Set some environments varaiables related to the loaded |
| 47 | +### modules and required to compile the NEMS application properly. |
| 48 | +funcs="$( find ${myDIRS} -type f -iname "PlatformFuncs" | head -n 1 )" |
| 49 | +if [ -f "${funcs}" ]; then |
| 50 | + source "${funcs}" |
| 51 | + |
| 52 | + get_env_hdf5 |
| 53 | + get_env_netcdf |
| 54 | +fi |
| 55 | +unset funcs myDIRS |
| 56 | + |
| 57 | + |
| 58 | +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## |
| 59 | +# Is this needed in all systems? |
| 60 | +# If file locking is not allowed in the filesystem, or the |
| 61 | +# HDF5 locking mechanism is not compatible with the |
| 62 | +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like |
| 63 | +# access denied when trying to READ/WRITE NetCDF files. |
| 64 | +# On some platforms HDF5 locking is disabled on other it is not. |
| 65 | +# If you experience these problems uncomment the next line |
| 66 | +# (this should be done automatically when loading this file - todo). |
| 67 | +#export HDF5_USE_FILE_LOCKING=FALSE |
| 68 | + |
| 69 | +if [ -z "${NETCDF_CONFIG}" ]; then |
| 70 | + export NETCDF_CONFIG=${NETCDF_HOME:+${NETCDF_HOME}/bin/nc-config} |
| 71 | +fi |
| 72 | + |
| 73 | +if [ -z "${NETCDF_INCDIR}" ]; then |
| 74 | + export NETCDF_INCDIR=${NETCDF_INC:+${NETCDF_INC}} |
| 75 | + if [ -z "${NETCDF_INCDIR}" ]; then |
| 76 | + export NETCDF_INCDIR=${NETCDF_HOME:+${NETCDF_HOME}/include} |
| 77 | + fi |
| 78 | +fi |
| 79 | + |
| 80 | +if [ -z "${NETCDF_LIBDIR}" ]; then |
| 81 | + export NETCDF_LIBDIR=${NETCDF_LIB:+${NETCDF_LIB}} |
| 82 | + if [ -z "${NETCDF_LIBDIR}" ]; then |
| 83 | + export NETCDF_LIBDIR=${NETCDF_HOME:+${NETCDF_HOME}/lib} |
| 84 | + fi |
| 85 | +fi |
| 86 | + |
| 87 | +if [ -z "${ESMFMKFILE}" ]; then |
| 88 | + echo "The variable ESMFMKFILE is not set. Please load the esmf module for your platform" |
| 89 | + echo "Exiting ..." |
| 90 | + exit 1 |
| 91 | +else |
| 92 | + export ESMFMKFILE=${ESMFMKFILE} |
| 93 | +fi |
| 94 | +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## |
| 95 | + |
0 commit comments