From 8e964773972b4e873adbb488aadc9a00631ab119 Mon Sep 17 00:00:00 2001 From: Panagiotis Velissariou Date: Thu, 13 May 2021 12:20:29 -0500 Subject: [PATCH] update envmodules --- modulefiles/PlatformFuncs | 101 ++++++++++++++++++ modulefiles/envmodules_gnu.linux | 16 +-- .../{envmodules => envmodules_gnu.local} | 11 +- modulefiles/envmodules_intel.linux | 17 +-- modulefiles/envmodules_intel.local | 29 +++++ modulefiles/envmodules_pgi.linux | 17 +-- modulefiles/envmodules_pgi.local | 34 ++++++ 7 files changed, 202 insertions(+), 23 deletions(-) create mode 100644 modulefiles/PlatformFuncs rename modulefiles/{envmodules => envmodules_gnu.local} (83%) create mode 100644 modulefiles/envmodules_intel.local create mode 100644 modulefiles/envmodules_pgi.local diff --git a/modulefiles/PlatformFuncs b/modulefiles/PlatformFuncs new file mode 100644 index 00000000..32316f65 --- /dev/null +++ b/modulefiles/PlatformFuncs @@ -0,0 +1,101 @@ +########################################################################### +### NEMS Build System +### PlatformFuncs :: Utility functions +### +### Author: Panagiotis Velissariou +########################################################################### + +get_env_hdf5() +{ +# if [ "${_found_hdf5:-FALSE}" = "FALSE" ]; then + _found_hdf5=FALSE + if [ -n "${HDF5:+1}" ]; then + HDF5="${HDF5}" + export HDF5HOME="${HDF5}" + HDF5_DIR="${HDF5}" + HDF5_PATH="${HDF5}" + HDF5_ROOT="${HDF5}" + _found_hdf5=TRUE + else + for _var in DIR HOME PATH ROOT + do + _var_val="$(eval "echo \"\$HDF5${_var}\"")" + if [ -n "${_var_val:+1}" ]; then + HDF5="${_var_val}" + export HDF5HOME="${_var_val}" + HDF5_DIR="${_var_val}" + HDF5_PATH="${_var_val}" + HDF5_ROOT="${_var_val}" + _found_hdf5=TRUE + break + else + _var_val="$(eval "echo \"\$HDF5_${_var}\"")" + if [ -n "${_var_val:+1}" ]; then + HDF5="${_var_val}" + export HDF5HOME="${_var_val}" + HDF5_DIR="${_var_val}" + HDF5_PATH="${_var_val}" + HDF5_ROOT="${_var_val}" + _found_hdf5=TRUE + break + fi + fi + done + fi + unset _name _var _var_val +# fi + + return 0 +} + + +get_env_netcdf() +{ +# if [ "${_found_netcdf:-FALSE}" = "FALSE" ]; then + export _found_netcdf=FALSE + for _name in NETCDF NETCDF4 NetCDF NetCDF4 + do + if [ "${_found_netcdf}" = "TRUE" ]; then + break + fi + + _var_val="$(eval "echo \"\$${_name}\"")" + if [ -n "${_var_val:+1}" ]; then + export NETCDF="${_var_val}" + export NETCDFHOME="${_var_val}" + export NETCDF_DIR="${_var_val}" + export NETCDF_PATH="${_var_val}" + export NETCDF_ROOT="${_var_val}" + export _found_netcdf=TRUE + else + for _var in DIR HOME PATH ROOT + do + _var_val="$(eval "echo \"\$${_name}${_var}\"")" + if [ -n "${_var_val:+1}" ]; then + export NETCDF="${_var_val}" + export NETCDFHOME="${_var_val}" + export NETCDF_DIR="${_var_val}" + export NETCDF_PATH="${_var_val}" + export NETCDF_ROOT="${_var_val}" + export _found_netcdf=TRUE + break + else + _var_val="$(eval "echo \"\$${_name}_${_var}\"")" + if [ -n "${_var_val:+1}" ]; then + export NETCDF="${_var_val}" + export NETCDFHOME="${_var_val}" + export NETCDF_DIR="${_var_val}" + export NETCDF_PATH="${_var_val}" + export NETCDF_ROOT="${_var_val}" + export _found_netcdf=TRUE + break + fi + fi + done + fi + done + unset _name _var _var_val +# fi + + return 0 +} diff --git a/modulefiles/envmodules_gnu.linux b/modulefiles/envmodules_gnu.linux index 5cb700e1..d8646ca5 100644 --- a/modulefiles/envmodules_gnu.linux +++ b/modulefiles/envmodules_gnu.linux @@ -5,20 +5,24 @@ #################### ### (1) Load all needed environment modules. -#module purge -#module load gcc impi +module purge +module load intel impi #module load szip hdf5 -#module load netcdf +module load netcdf -#module load esmf +module load esmf #################### ### (2) Set some environments varaiables related to the loaded ### modules and required to compile the NEMS application properly. +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +[ -f "${funcs}" ] && source "${funcs}" +unset funcs -export HDF5HOME=${HDF5} -export NETCDFHOME=${NETCDF} + +get_env_hdf5 +get_env_netcdf export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} diff --git a/modulefiles/envmodules b/modulefiles/envmodules_gnu.local similarity index 83% rename from modulefiles/envmodules rename to modulefiles/envmodules_gnu.local index 3b61d299..b7e83e4a 100644 --- a/modulefiles/envmodules +++ b/modulefiles/envmodules_gnu.local @@ -5,12 +5,13 @@ #################### ### (1) Load all needed environment modules. -#module purge -#module load intel impi -#module load szip hdf5 -#module load netcdf +module purge +module load gcc impi +module load szip hdf5 +module load netcdf -#module load esmf +module use /contrib/modulefiles +module load esmf #################### diff --git a/modulefiles/envmodules_intel.linux b/modulefiles/envmodules_intel.linux index eff77e07..d8646ca5 100644 --- a/modulefiles/envmodules_intel.linux +++ b/modulefiles/envmodules_intel.linux @@ -5,21 +5,26 @@ #################### ### (1) Load all needed environment modules. -#module purge -#module load intel impi +module purge +module load intel impi #module load szip hdf5 -#module load netcdf +module load netcdf -#module load esmf +module load esmf #################### ### (2) Set some environments varaiables related to the loaded ### modules and required to compile the NEMS application properly. +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +[ -f "${funcs}" ] && source "${funcs}" +unset funcs -export HDF5HOME=${HDF5} -export NETCDFHOME=${NETCDF} +get_env_hdf5 +get_env_netcdf + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} diff --git a/modulefiles/envmodules_intel.local b/modulefiles/envmodules_intel.local new file mode 100644 index 00000000..6f8b0aa5 --- /dev/null +++ b/modulefiles/envmodules_intel.local @@ -0,0 +1,29 @@ +#!/bin/bash-*-Shell-script-modules*- + +# This script is responsible for loading modules that are +# compatible with the NUOPC Layer version used in NEMS. + +#################### +### (1) Load all needed environment modules. +module purge +module load intel/18.0.5.274 impi/2018.0.4 +module load szip + +module use /home/emc.nemspara/SOFT-hera/modulefiles +module load hdf5_parallel/1.10.6.release +module load netcdf_parallel/4.7.4.release +module load esmf/8.1.0bs36g + + +#################### +### (2) Set some environments varaiables related to the loaded +### modules and required to compile the NEMS application properly. + +export HDF5HOME=${HDF5} +export NETCDFHOME=${NETCDF} + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} diff --git a/modulefiles/envmodules_pgi.linux b/modulefiles/envmodules_pgi.linux index e0e25e47..ca6adc62 100644 --- a/modulefiles/envmodules_pgi.linux +++ b/modulefiles/envmodules_pgi.linux @@ -5,23 +5,28 @@ #################### ### (1) Load all needed environment modules. -#module purge -#module load pgi impi +module purge +module load intel impi #module load szip hdf5 -#module load netcdf +module load netcdf -#module load esmf +module load esmf #################### ### (2) Set some environments varaiables related to the loaded ### modules and required to compile the NEMS application properly. +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +[ -f "${funcs}" ] && source "${funcs}" +unset funcs -export HDF5HOME=${HDF5} -export NETCDFHOME=${NETCDF} + +get_env_hdf5 +get_env_netcdf export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} + diff --git a/modulefiles/envmodules_pgi.local b/modulefiles/envmodules_pgi.local new file mode 100644 index 00000000..ecc1c9f0 --- /dev/null +++ b/modulefiles/envmodules_pgi.local @@ -0,0 +1,34 @@ +#!/bin/bash-*-Shell-script-modules*- +#---------- +[[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit +echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" +echo " Exiting ..." +${retv} 1 +#---------- + +# This script is responsible for loading modules that are +# compatible with the NUOPC Layer version used in NEMS. + +#################### +### (1) Load all needed environment modules. +module purge +module load pgi impi +module load szip hdf5 +module load netcdf + +module use /contrib/modulefiles +module load esmf + + +#################### +### (2) Set some environments varaiables related to the loaded +### modules and required to compile the NEMS application properly. + +export HDF5HOME=${HDF5} +export NETCDFHOME=${NETCDF} + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE}