|
| 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 <panagiotis.velissariou@noaa.gov> |
| 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 | +# intel-oneapi-compilers/2022.0.2 |
| 25 | +# intel-oneapi-compilers/2022.2.1 |
| 26 | +# intel-oneapi-compilers/2023.1.0 |
| 27 | + |
| 28 | +# intel-oneapi-mpi/2021.5.1 |
| 29 | +# intel-oneapi-mpi/2021.7.1 |
| 30 | +# intel-oneapi-mpi/2021.9.0 |
| 31 | + |
| 32 | +#################### |
| 33 | +### (1) Load all needed environment modules. |
| 34 | +module purge |
| 35 | +#module load cmake/3.20.2 # (already the default cmake) |
| 36 | + |
| 37 | +module load intel-oneapi-compilers/2023.1.0 intel-oneapi-mpi/2021.7.1 |
| 38 | +module load netcdf-c/4.9.2 netcdf-fortran/4.6.0 |
| 39 | +module load netcdf-c/4.9.0 netcdf-fortran/4.5.3 |
| 40 | +module load esmf/8.4.2 |
| 41 | + |
| 42 | +module load intel-oneapi-compilers/2022.2.1 intel-oneapi-mpi/2021.7.1 |
| 43 | +module load netcdf-c/4.9.0 netcdf-fortran/4.6.0 |
| 44 | + |
| 45 | +module load esmf/8.3.1 |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | +module load proj/4.8.0 |
| 51 | +#module load proj/5.2.0 |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +module use /work/noaa/epic/role-epic/spack-stack/hercules/spack-stack-dev-20230825/envs/ufs-pio-2.5.10/install/modulefiles/Core |
| 56 | +###module use /work/noaa/epic/role-epic/spack-stack/hercules/modulefiles |
| 57 | + |
| 58 | +module load stack-intel/2021.9.0 stack-intel-oneapi-mpi/2021.9.0 |
| 59 | + |
| 60 | +module load cmake/3.23.1 |
| 61 | + |
| 62 | +module load netcdf-c/4.9.2 netcdf-fortran/4.6.0 |
| 63 | + |
| 64 | +module load esmf/8.4.2 |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +#################### |
| 69 | +### (2) Set some environments varaiables related to the loaded |
| 70 | +### modules and required to compile the NEMS application properly. |
| 71 | +funcs="$( find ${myDIRS} -type f -iname "PlatformFuncs" | head -n 1 )" |
| 72 | +if [ -f "${funcs}" ]; then |
| 73 | + source "${funcs}" |
| 74 | + |
| 75 | + get_env_hdf5 |
| 76 | + get_env_netcdf |
| 77 | +fi |
| 78 | +unset funcs myDIRS |
| 79 | + |
| 80 | + |
| 81 | +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## |
| 82 | +# Is this needed in all systems? |
| 83 | +# If file locking is not allowed in the filesystem, or the |
| 84 | +# HDF5 locking mechanism is not compatible with the |
| 85 | +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like |
| 86 | +# access denied when trying to READ/WRITE NetCDF files. |
| 87 | +# On some platforms HDF5 locking is disabled on other it is not. |
| 88 | +# If you experience these problems uncomment the next line |
| 89 | +# (this should be done automatically when loading this file - todo). |
| 90 | +#export HDF5_USE_FILE_LOCKING=FALSE |
| 91 | + |
| 92 | +if [ -z "${NETCDF_CONFIG}" ]; then |
| 93 | + export NETCDF_CONFIG=${NETCDF_HOME:+${NETCDF_HOME}/bin/nc-config} |
| 94 | +fi |
| 95 | + |
| 96 | +if [ -z "${NETCDF_INCDIR}" ]; then |
| 97 | + export NETCDF_INCDIR=${NETCDF_INCLUDE_DIRS:+${NETCDF_INCLUDE_DIRS}} |
| 98 | + if [ -z "${NETCDF_INCDIR}" ]; then |
| 99 | + export NETCDF_INCDIR=${NETCDF_HOME:+${NETCDF_HOME}/include} |
| 100 | + fi |
| 101 | +fi |
| 102 | + |
| 103 | +if [ -z "${NETCDF_LIBDIR}" ]; then |
| 104 | + export NETCDF_LIBDIR=${NETCDF_LIBRARY_DIRS:+${NETCDF_LIBRARY_DIRS}} |
| 105 | + if [ -z "${NETCDF_LIBDIR}" ]; then |
| 106 | + export NETCDF_LIBDIR=${NETCDF_HOME:+${NETCDF_HOME}/lib} |
| 107 | + fi |
| 108 | +fi |
| 109 | + |
| 110 | +if [ -z "${ESMFMKFILE}" ]; then |
| 111 | + echo "The variable ESMFMKFILE is not set. Please load the esmf module for your platform" |
| 112 | + echo "Exiting ..." |
| 113 | + exit 1 |
| 114 | +else |
| 115 | + export ESMFMKFILE=${ESMFMKFILE} |
| 116 | +fi |
| 117 | +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## |
0 commit comments