From 6c2593cb87deb46ccc33066ffbc85b5a2ecc6dab Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Thu, 4 Mar 2021 16:04:38 -0500 Subject: [PATCH 01/21] Takis' patch for ADCIRC v55 --- ADCIRC | 2 +- ATMESH | 2 +- NEMS | 2 +- NWM | 2 +- WW3 | 2 +- WW3DATA | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ADCIRC b/ADCIRC index 59765040..6a43e9f1 160000 --- a/ADCIRC +++ b/ADCIRC @@ -1 +1 @@ -Subproject commit 59765040a3716ec51b00266710bc8b1b58c48a4c +Subproject commit 6a43e9f1299e311283d9115e4dd35c0e24aafced diff --git a/ATMESH b/ATMESH index b760156d..98be19ce 160000 --- a/ATMESH +++ b/ATMESH @@ -1 +1 @@ -Subproject commit b760156d61d9b207d75763d4eb815f93b978c17a +Subproject commit 98be19cebfb95ff65705debf7da4171cd26485e5 diff --git a/NEMS b/NEMS index 2fdfde2b..09afb76b 160000 --- a/NEMS +++ b/NEMS @@ -1 +1 @@ -Subproject commit 2fdfde2b49b26baccae93cd0da6c2c1c9ab082a4 +Subproject commit 09afb76b58d796e46483a0fea70871e98bfc34c4 diff --git a/NWM b/NWM index 55e9524e..3bc401d2 160000 --- a/NWM +++ b/NWM @@ -1 +1 @@ -Subproject commit 55e9524efa34b51acb6ebbd30e1fc09d4617cbea +Subproject commit 3bc401d298070515cb6171a585d2d19646afd650 diff --git a/WW3 b/WW3 index 7823bd24..60610eb5 160000 --- a/WW3 +++ b/WW3 @@ -1 +1 @@ -Subproject commit 7823bd245ed98df295ac8b6c437903e131101666 +Subproject commit 60610eb5f7a79b8d8bf41a02f078a691bf0506c8 diff --git a/WW3DATA b/WW3DATA index 8308a380..ea2eb49c 160000 --- a/WW3DATA +++ b/WW3DATA @@ -1 +1 @@ -Subproject commit 8308a380f8fc7439748a136e5476476efd751020 +Subproject commit ea2eb49c2b5c9cd6cbc7f34227fec85d2a421d19 From d82ecc4fd8c7bdc8f3d1a2f8ae4387ccd0036066 Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Thu, 4 Mar 2021 16:14:15 -0500 Subject: [PATCH 02/21] add project files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 259148fa..73b7297e 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ *.exe *.out *.app + +# Editor +.idea From 067eab7699c15160ae6d6f65b03dbbbdf4b6360a Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Thu, 4 Mar 2021 16:21:55 -0500 Subject: [PATCH 03/21] Takis' patch for ADCIRC v55 --- HOWTO | 3 +- HOWTO.rej | 16 + build.sh | 243 ++++++++-- build.sh-orig | 43 ++ build.sh.orig | 214 +++++++++ build.sh.rej | 252 +++++++++++ buildcrcnd.sh | 45 ++ compile-NEMS.x.txt | 25 ++ compile-NEMS.x.txt.old | 33 ++ conf/configure.nems.linux.gnu | 56 +++ conf/configure.nems.linux.intel | 56 +++ conf/configure.nems.linux.pgi | 56 +++ conf/configure.nems.ndcrc.intel | 61 +++ conf/externals.nems | 2 + conf/externals.nems.cheyenne | 26 ++ conf/externals.nems.gaea | 26 ++ conf/externals.nems.hera | 2 +- conf/externals.nems.hera.rej | 8 + conf/externals.nems.jet | 26 ++ conf/externals.nems.linux | 2 + conf/externals.nems.macosx | 2 + conf/externals.nems.orion | 26 ++ conf/externals.nems.stampede | 26 ++ conf/externals.nems.wcoss | 26 ++ functions_build | 611 ++++++++++++++++++++++++++ modulefiles/envmodules | 27 ++ modulefiles/envmodules_gnu.cheyenne | 34 ++ modulefiles/envmodules_gnu.gaea | 28 ++ modulefiles/envmodules_gnu.hera | 34 ++ modulefiles/envmodules_gnu.jet | 34 ++ modulefiles/envmodules_gnu.linux | 27 ++ modulefiles/envmodules_gnu.macosx | 27 ++ modulefiles/envmodules_gnu.orion | 27 ++ modulefiles/envmodules_gnu.stampede | 28 ++ modulefiles/envmodules_gnu.wcoss | 28 ++ modulefiles/envmodules_intel.cheyenne | 34 ++ modulefiles/envmodules_intel.gaea | 34 ++ modulefiles/envmodules_intel.hera | 28 ++ modulefiles/envmodules_intel.jet | 34 ++ modulefiles/envmodules_intel.linux | 26 ++ modulefiles/envmodules_intel.macosx | 27 ++ modulefiles/envmodules_intel.orion | 27 ++ modulefiles/envmodules_intel.stampede | 28 ++ modulefiles/envmodules_intel.wcoss | 28 ++ modulefiles/envmodules_pgi.cheyenne | 34 ++ modulefiles/envmodules_pgi.gaea | 31 ++ modulefiles/envmodules_pgi.hera | 34 ++ modulefiles/envmodules_pgi.jet | 34 ++ modulefiles/envmodules_pgi.linux | 27 ++ modulefiles/envmodules_pgi.macosx | 27 ++ modulefiles/envmodules_pgi.orion | 27 ++ modulefiles/envmodules_pgi.stampede | 34 ++ modulefiles/envmodules_pgi.wcoss | 34 ++ modulefiles/ndcrc/ESMF_NUOPC | 23 + modulefiles/ndcrc/coastal_app | 39 ++ 55 files changed, 2752 insertions(+), 38 deletions(-) create mode 100644 HOWTO.rej create mode 100644 build.sh-orig create mode 100755 build.sh.orig create mode 100644 build.sh.rej create mode 100755 buildcrcnd.sh create mode 100644 compile-NEMS.x.txt create mode 100644 compile-NEMS.x.txt.old create mode 100644 conf/configure.nems.linux.gnu create mode 100644 conf/configure.nems.linux.intel create mode 100644 conf/configure.nems.linux.pgi create mode 100644 conf/configure.nems.ndcrc.intel create mode 100644 conf/externals.nems create mode 100644 conf/externals.nems.cheyenne create mode 100644 conf/externals.nems.gaea create mode 100644 conf/externals.nems.hera.rej create mode 100644 conf/externals.nems.jet create mode 100644 conf/externals.nems.linux create mode 100644 conf/externals.nems.macosx create mode 100644 conf/externals.nems.orion create mode 100644 conf/externals.nems.stampede create mode 100644 conf/externals.nems.wcoss create mode 100644 functions_build create mode 100644 modulefiles/envmodules create mode 100644 modulefiles/envmodules_gnu.cheyenne create mode 100644 modulefiles/envmodules_gnu.gaea create mode 100644 modulefiles/envmodules_gnu.hera create mode 100644 modulefiles/envmodules_gnu.jet create mode 100644 modulefiles/envmodules_gnu.linux create mode 100644 modulefiles/envmodules_gnu.macosx create mode 100644 modulefiles/envmodules_gnu.orion create mode 100644 modulefiles/envmodules_gnu.stampede create mode 100644 modulefiles/envmodules_gnu.wcoss create mode 100644 modulefiles/envmodules_intel.cheyenne create mode 100644 modulefiles/envmodules_intel.gaea create mode 100644 modulefiles/envmodules_intel.hera create mode 100644 modulefiles/envmodules_intel.jet create mode 100644 modulefiles/envmodules_intel.linux create mode 100644 modulefiles/envmodules_intel.macosx create mode 100644 modulefiles/envmodules_intel.orion create mode 100644 modulefiles/envmodules_intel.stampede create mode 100644 modulefiles/envmodules_intel.wcoss create mode 100644 modulefiles/envmodules_pgi.cheyenne create mode 100644 modulefiles/envmodules_pgi.gaea create mode 100644 modulefiles/envmodules_pgi.hera create mode 100644 modulefiles/envmodules_pgi.jet create mode 100644 modulefiles/envmodules_pgi.linux create mode 100644 modulefiles/envmodules_pgi.macosx create mode 100644 modulefiles/envmodules_pgi.orion create mode 100644 modulefiles/envmodules_pgi.stampede create mode 100644 modulefiles/envmodules_pgi.wcoss create mode 100644 modulefiles/ndcrc/ESMF_NUOPC create mode 100755 modulefiles/ndcrc/coastal_app diff --git a/HOWTO b/HOWTO index f58ca9aa..47fb3241 100644 --- a/HOWTO +++ b/HOWTO @@ -1,3 +1,5 @@ +Modified: Panagiotis Velissariou - 12/05/2020 + ================================== Coastal Act Team - 9/13/2019 @@ -591,7 +593,6 @@ build_NWM: $(nwm_mk) env_file=$(NWM_SRCDIR)/setEnvar.sh -esmf_env=$(NWM_SRCDIR)/esmf-impi-env.sh comp_opt=3 # HOW to source env here?? diff --git a/HOWTO.rej b/HOWTO.rej new file mode 100644 index 00000000..c60c4ca8 --- /dev/null +++ b/HOWTO.rej @@ -0,0 +1,16 @@ +--- HOWTO 2020-12-01 01:08:10.000000000 -0600 ++++ HOWTO 2020-12-09 22:33:55.671362895 -0600 +@@ -1,3 +1,5 @@ ++Modified: Panagiotis Velissariou - 12/05/2020 ++ + ================================== + Coastal Act Team - 9/13/2019 + +@@ -591,7 +593,6 @@ + + + env_file=$(NWM_SRCDIR)/setEnvar.sh +-esmf_env=$(NWM_SRCDIR)/esmf-impi-env.sh + comp_opt=3 + + # HOW to source env here?? diff --git a/build.sh b/build.sh index 41e309aa..ba6f6cb4 100755 --- a/build.sh +++ b/build.sh @@ -1,43 +1,214 @@ #!/bin/bash -# Description : Script to compile NSEModel NEMS application -# Usage : ./build.sh -# Date : Feb 27, 2020 -# Contact : moghimis@gmail.com - -# Check for env variables -if [ "${ROOTDIR}" == "" ] - then - echo "ERROR - Your ROOTDIR environment variable is not set" - exit 1 -fi -if [ "${METIS_PATH}" == "" ] - then - echo "ERROR - Your METIS_PATH environment variable for WW3 is not set" - exit 1 +########################################################################### +### Author: Panagiotis Velissariou +### +### Version - 1.0 Fri Dec 04 2020 +########################################################################### + + +###==================== +# Make sure that the current working directory is in the PATH +[[ ! :$PATH: == *:".":* ]] && export PATH="${PATH}:." + + +# Get the directory where the script is located +scrNAME="${BASH_SOURCE[0]}" +if [[ $(uname -s) == Darwin ]]; then +# readonly scrDIR="$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" + readonly scrDIR="$(cd "$(dirname "$(grealpath -s "${scrNAME}" )" )" && pwd -P)" +else +# readonly scrDIR="$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" + readonly scrDIR="$(cd "$(dirname "$(realpath -s "${scrNAME}")" )" && pwd -P)" +fi + +funcs="$( find ${scrDIR} -type f -name "functions_build" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" else - echo "METIS_PATH set to ${METIS_PATH}" + echo " ### ERROR :: in ${scrNAME}" + echo " Cannot load the required file: ${funcs}" + echo " Exiting now ..." + echo + exit 1 +fi + +unset funcs +###==================== + + +######### +# Call ParseArgs to get the user input. +ParseArgs "${@}" + + +########## +# Set the variables for this script +CLEAN=${MY_CLEAN:-0} + +[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "${MY_COMPILER}" )" + +[ -n "${MY_COMPONENT:+1}" ] && COMPONENT="$( toUPPER "${MY_COMPONENT}" )" + +[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" + +[ "${MY_PARMAKE:0}" -gt 1 ] && PARMAKE=${MY_PARMAKE} + +[ -n "${MY_PLATFORM:+1}" ] && PLATFORM="$( toLOWER "${MY_PLATFORM}" )" + +[ -n "${MY_VERBOSE:+1}" ] && VERBOSE="$( toLOWER "${MY_VERBOSE}" )" + +modFILE="envmodules${COMPILER:+_${COMPILER}}${PLATFORM:+.${PLATFORM}}" + +# Customize the NEMS.x filename to include the component names +if [ -n "${COMPONENT:+1}" ]; then + compFNAME="$( strTrim "$( toLOWER "${COMPONENT}" )" )" + compFNAME="$( echo "${compFNAME}" | sed 's/ /_/g' )" +fi + +# Export some environment variables for NEMS +export NEMS_COMPILER=${COMPILER} +########## + + +########## +# Get the project directories and perform a basic check on them +readonly nemsDIR="${NEMS_DIR:-${scrDIR}/NEMS}" +if [ ! -f "${nemsDIR}/NEMSAppBuilder" ]; then + echo "The project directory \"${nemsDIR}\" does not appear to contain NEMSAppBuilder." + echo "Is this the correct NEMS directory?" + echo "You might need to set the environment variable NEMS_DIR before running this script." + echo "Exiting ..." + exit 1 fi -# Load modules -source ${ROOTDIR}/modulefiles/hera/ESMF_NUOPC +readonly modDIR="${NEMSMODS_DIR:-${scrDIR}/modulefiles}" +if [ ! -f "${modDIR}/${modFILE}" ]; then + echo "The modulefiles directory \"${modDIR}\" does not appear to contain module: ${modFILE}." + echo "Is this the correct modulefiles directory?" + echo "You might need to set the environment variable NEMSMODS_DIR before running this script." + echo "Exiting ..." + exit 1 +fi +########## + + +########## +# If the user requested to clean the build folder, do the cleaning end exit +if [ ${CLEAN:-0} -ge 1 ]; then + echo "User requested to only clean the project. Cleaning ..." + + pushd ${nemsDIR} >/dev/null 2>&1 + [ ${CLEAN:-0} -eq 1 ] && compileNems clean + [ ${CLEAN:-0} -eq 2 ] && compileNems distclean + popd >/dev/null 2>&1 + + exit 0 +fi +########## + + +########## +# Source the environment module +source ${modDIR}/${modFILE} + +component_ww3="$( echo "${COMPONENT}" | sed 's/ /:/g' )" +if [[ :${component_ww3}: == *:"WW3":* ]]; then + export WW3_CONFOPT="${COMPILER}" + export WW3_COMP="${COMPILER}" + export WWATCH3_NETCDF=NC4 +fi +########## + + +########## +# Get a final user response for the variables +echo +echo "The following variables are defined:" +echo " CLEAN = ${CLEAN}" +echo " COMPILER = ${COMPILER:-Undefined, Supported values are: [${MY_COMPILING_SYTEMS}]}" +echo " NEMS_COMPILER = ${NEMS_COMPILER}" +if [[ :${component_ww3}: == *:"WW3":* ]]; then + echo " WW3_CONFOPT = ${WW3_CONFOPT}" + echo " WW3_COMP = ${WW3_COMP}" + echo " WWATCH3_NETCDF = ${WWATCH3_NETCDF}" +fi +echo " COMPONENTS = ${COMPONENT:-Undefined, Supported values are: [${MY_COMPONENT_LIST}]}" +echo " OS = ${OS}" +echo " PLATFORM = ${PLATFORM}" +echo " VERBOSE = ${VERBOSE}" +echo +echo " HDF5HOME = ${HDF5HOME}" +echo " NETCDFHOME = ${NETCDFHOME}" +echo " NETCDF_INCDIR = ${NETCDF_INCDIR}" +echo " NETCDF_LIBDIR = ${NETCDF_LIBDIR}" +echo +echo " ESMFMKFILE = ${ESMFMKFILE}" +echo + module list -echo "Building NEMS app in ${ROOTDIR}/NEMS" -cd ${ROOTDIR}/NEMS - -# Clean up -make -f GNUmakefile distclean_ADCIRC COMPONENTS="ADCIRC" -make -f GNUmakefile distclean_WW3DATA COMPONENTS="WW3DATA" -make -f GNUmakefile distclean_ATMESH COMPONENTS="ATMESH" -make -f GNUmakefile distclean_WW3 COMPONENTS="WW3" -make -f GNUmakefile distclean_NWM COMPONENTS="NWM" -make -f GNUmakefile distclean_NEMS COMPONENTS="ADCIRC WW3 NWM ATMESH" - -# Make coupled NEMS app -#make -f GNUmakefile build COMPONENTS="ADCIRC NWM ATMESH" -#make -f GNUmakefile build COMPONENTS="ADCIRC WW3 ATMESH" -#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH WW3 NWM" -#make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" -#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH NWM" -make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH NWM" +echo_response= +while [ -z "${echo_response}" ] ; do + echo -n "Are these values correct? [y/n]: " + read echo_response + echo_response="$( getYesNo "${echo_response}" )" +done + +if [ "${echo_response:-no}" = "no" ]; then + echo + echo "User responded: ${echo_response}" + echo "Exiting now ..." + echo + exit 1 +fi + +unset echo_response +########## + + +############################################################ +### START THE CALCULATIONS +############################################################ + +########## +# Compile the project +compileERR=0 +pushd ${nemsDIR} >/dev/null 2>&1 + case ${CLEAN:-0} in + -1 ) + compileNems clean + compileERR=$? + ;; + -2 ) + compileNems distclean + compileERR=$? + ;; + -3 ) + compileNems noclean + compileERR=$? + ;; + * ) + compileNems clean + compileERR=$? + ;; + esac + + if [ ${compileERR} -eq 0 ]; then + compileNems build + compileERR=$? + fi + + if [ ${compileERR} -eq 0 ]; then + if [ -f exe/NEMS.x ]; then + cp -p exe/NEMS.x exe/NEMS${compFNAME:+-${compFNAME}}.x + fi + fi +popd >/dev/null 2>&1 + +########## +# Install all data, executables, libraries in a common directory +[ ${compileERR:-0} -eq 0 ] && installNems +########## + +exit 0 diff --git a/build.sh-orig b/build.sh-orig new file mode 100644 index 00000000..41e309aa --- /dev/null +++ b/build.sh-orig @@ -0,0 +1,43 @@ +#!/bin/bash + +# Description : Script to compile NSEModel NEMS application +# Usage : ./build.sh +# Date : Feb 27, 2020 +# Contact : moghimis@gmail.com + +# Check for env variables +if [ "${ROOTDIR}" == "" ] + then + echo "ERROR - Your ROOTDIR environment variable is not set" + exit 1 +fi +if [ "${METIS_PATH}" == "" ] + then + echo "ERROR - Your METIS_PATH environment variable for WW3 is not set" + exit 1 +else + echo "METIS_PATH set to ${METIS_PATH}" +fi + +# Load modules +source ${ROOTDIR}/modulefiles/hera/ESMF_NUOPC +module list + +echo "Building NEMS app in ${ROOTDIR}/NEMS" +cd ${ROOTDIR}/NEMS + +# Clean up +make -f GNUmakefile distclean_ADCIRC COMPONENTS="ADCIRC" +make -f GNUmakefile distclean_WW3DATA COMPONENTS="WW3DATA" +make -f GNUmakefile distclean_ATMESH COMPONENTS="ATMESH" +make -f GNUmakefile distclean_WW3 COMPONENTS="WW3" +make -f GNUmakefile distclean_NWM COMPONENTS="NWM" +make -f GNUmakefile distclean_NEMS COMPONENTS="ADCIRC WW3 NWM ATMESH" + +# Make coupled NEMS app +#make -f GNUmakefile build COMPONENTS="ADCIRC NWM ATMESH" +#make -f GNUmakefile build COMPONENTS="ADCIRC WW3 ATMESH" +#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH WW3 NWM" +#make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" +#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH NWM" +make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH NWM" diff --git a/build.sh.orig b/build.sh.orig new file mode 100755 index 00000000..e0f7132b --- /dev/null +++ b/build.sh.orig @@ -0,0 +1,214 @@ +#!/bin/bash + +########################################################################### +### Author: Panagiotis Velissariou +### +### Version - 1.0 Fri Dec 04 2020 +########################################################################### + + +###==================== +# Make sure that the current working directory is in the PATH +[[ ! :$PATH: == *:".":* ]] && export PATH="${PATH}:." + + +# Get the directory where the script is located +scrNAME="${BASH_SOURCE[0]}" +if [[ $(uname -s) == Darwin ]]; then +# readonly scrDIR="$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" + readonly scrDIR="$(cd "$(dirname "$(grealpath -s "${scrNAME}" )" )" && pwd -P)" +else +# readonly scrDIR="$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" + readonly scrDIR="$(cd "$(dirname "$(realpath -s "${scrNAME}")" )" && pwd -P)" +fi + +funcs="$( find ${scrDIR} -type f -name "functions_build" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" +else + echo " ### ERROR :: in ${scrNAME}" + echo " Cannot load the required file: ${funcs}" + echo " Exiting now ..." + echo + exit 1 +fi + +unset funcs +###==================== + + +######### +# Call ParseArgs to get the user input. +ParseArgs "${@}" + + +########## +# Set the variables for this script +CLEAN=${MY_CLEAN:-0} + +[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "${MY_COMPILER}" )" + +[ -n "${MY_COMPONENT:+1}" ] && COMPONENT="${MY_COMPONENT}" + +[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" + +[ "${MY_PARMAKE:0}" -gt 1 ] && PARMAKE=${MY_PARMAKE} + +[ -n "${MY_PLATFORM:+1}" ] && PLATFORM="$( toLOWER "${MY_PLATFORM}" )" + +[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" + +[ -n "${MY_VERBOSE:+1}" ] && VERBOSE="$( toLOWER "${MY_VERBOSE}" )" + +mod_file="envmodules${COMPILER:+_${COMPILER}}${PLATFORM:+.${PLATFORM}}" + +if [ -n "${COMPONENT:+1}" ]; then + comp_fname="$( strTrim "$( toLOWER "${COMPONENT}" )" )" + comp_fname="$( echo "${comp_fname}" | sed 's/ /_/g' )" +fi +########## + + +########## +# Get the project directories and perform a basic check on them +readonly nemsDIR="${NEMS_DIR:-${scrDIR}/NEMS}" +if [ ! -f "${nemsDIR}/NEMSAppBuilder" ]; then + echo "The project directory \"${nemsDIR}\" does not appear to contain NEMSAppBuilder." + echo "Is this the correct NEMS directory?" + echo "You might need to set the environment variable NEMS_DIR before running this script." + echo "Exiting ..." + exit 1 +fi + +readonly modsDIR="${NEMSMODS_DIR:-${scrDIR}/modulefiles}" +if [ ! -f "${modsDIR}/${mod_file}" ]; then + echo "The modulefiles directory \"${modsDIR}\" does not appear to contain module: ${mod_file}." + echo "Is this the correct modulefiles directory?" + echo "You might need to set the environment variable NEMSMODS_DIR before running this script." + echo "Exiting ..." + exit 1 +fi +########## + + +########## +# If the user requested to clean the build folder, do the cleaning end exit +if [ ${CLEAN:-0} -ge 1 ]; then + echo "User requested to only clean the project. Cleaning ..." + + pushd ${nemsDIR} >/dev/null 2>&1 + [ ${CLEAN:-0} -eq 1 ] && compileNems clean + [ ${CLEAN:-0} -eq 2 ] && compileNems distclean + popd >/dev/null 2>&1 + + exit 0 +fi +########## + + +########## +# Export some environment variables for NEMS +export NEMS_COMPILER=${COMPILER} + +# Source the environment module +source ${modsDIR}/${mod_file} + +component_ww3=":$( echo "${COMPONENT}" | sed 's/ /:/g' ):" +if [[ :$component_ww3: == *:"WW3":* ]]; then + if [ -z "${METIS_PATH}" ]; then + echo "ERROR :: The METIS_PATH environment variable for WW3 is not set." + echo " Set the METIS_PATH environment variable before running this script:" + echo " METIS_PATH=\"path_to_compiled_metis\"" + echo "Exiting ..." + exit 1 + else + export METIS_PATH="${METIS_PATH}" + fi + export WW3_COMP="${COMPILER}" +fi + +########## + + +########## +# Get a final user response for the variables +echo +echo "The following variables are defined:" +echo " CLEAN = ${CLEAN}" +echo " COMPILER = ${COMPILER:-Undefined, Supported values are: [${MY_COMPILING_SYTEMS}]}" +echo " NEMS_COMPILER = ${NEMS_COMPILER}" +echo " WW3_COMP = ${WW3_COMP}" +echo " COMPONENTS = ${COMPONENT:-Undefined, Supported values are: [${MY_COMPONENT_LIST}]}" +echo " OS = ${OS}" +echo " PLATFORM = ${PLATFORM}" +echo " VERBOSE = ${VERBOSE}" +echo +echo " METIS_PATH = ${METIS_PATH}" +echo " HDF5HOME = ${HDF5HOME}" +echo " NETCDFHOME = ${NETCDFHOME}" +echo " NETCDF_INCDIR = ${NETCDF_INCDIR}" +echo " NETCDF_LIBDIR = ${NETCDF_LIBDIR}" +echo +echo " ESMFMKFILE = ${ESMFMKFILE}" +echo + +module list + +echo_response= +while [ -z "${echo_response}" ] ; do + echo -n "Are these values correct? [y/n]: " + read echo_response + echo_response="$( getYesNo "${echo_response}" )" +done + +if [ "${echo_response:-no}" = "no" ]; then + echo + echo "User responded: ${echo_response}" + echo "Exiting now ..." + echo + exit 1 +fi + +unset echo_response +########## + + +############################################################ +### START THE CALCULATIONS +############################################################ + +########## +# Compile the project +pushd ${nemsDIR} >/dev/null 2>&1 + case ${CLEAN:-0} in + -1 ) + compileNems clean + err=$? + ;; + -2 ) + compileNems distclean + err=$? + ;; + -3 ) + compileNems noclean + err=$? + ;; + * ) + compileNems clean + err=$? + ;; + esac + + if [ ${err} -eq 0 ]; then + compileNems build + err=$? + fi + + if [ ${err} -eq 0 ]; then + if [ -f exe/NEMS.x ]; then + cp -p exe/NEMS.x exe/NEMS${comp_fname:+-${comp_fname}}.x + fi + fi +popd >/dev/null 2>&1 + +exit 0 diff --git a/build.sh.rej b/build.sh.rej new file mode 100644 index 00000000..73467255 --- /dev/null +++ b/build.sh.rej @@ -0,0 +1,252 @@ +--- build.sh 2020-12-04 14:36:35.000000000 -0600 ++++ build.sh 2020-12-09 22:32:32.779825479 -0600 +@@ -1,43 +1,214 @@ + #!/bin/bash + +-# Description : Script to compile NSEModel NEMS application +-# Usage : ./build.sh +-# Date : Feb 27, 2020 +-# Contact : moghimis@gmail.com +- +-# Check for env variables +-if [ "${ROOTDIR}" == "" ] +- then +- echo "ERROR - Your ROOTDIR environment variable is not set" +- exit 1 +-fi +-if [ "${METIS_PATH}" == "" ] +- then +- echo "ERROR - Your METIS_PATH environment variable for WW3 is not set" +- exit 1 ++########################################################################### ++### Author: Panagiotis Velissariou ++### ++### Version - 1.0 Fri Dec 04 2020 ++########################################################################### ++ ++ ++###==================== ++# Make sure that the current working directory is in the PATH ++[[ ! :$PATH: == *:".":* ]] && export PATH="${PATH}:." ++ ++ ++# Get the directory where the script is located ++scrNAME="${BASH_SOURCE[0]}" ++if [[ $(uname -s) == Darwin ]]; then ++# readonly scrDIR="$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" ++ readonly scrDIR="$(cd "$(dirname "$(grealpath -s "${scrNAME}" )" )" && pwd -P)" + else +- echo "METIS_PATH set to ${METIS_PATH}" ++# readonly scrDIR="$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" ++ readonly scrDIR="$(cd "$(dirname "$(realpath -s "${scrNAME}")" )" && pwd -P)" + fi + +-# Load modules +-source ${ROOTDIR}/modulefiles/hera/ESMF_NUOPC ++funcs="$( find ${scrDIR} -type f -name "functions_build" | head -n 1 )" ++if [ -f "${funcs}" ]; then ++ source "${funcs}" ++else ++ echo " ### ERROR :: in ${scrNAME}" ++ echo " Cannot load the required file: ${funcs}" ++ echo " Exiting now ..." ++ echo ++ exit 1 ++fi ++ ++unset funcs ++###==================== ++ ++ ++######### ++# Call ParseArgs to get the user input. ++ParseArgs "${@}" ++ ++ ++########## ++# Set the variables for this script ++CLEAN=${MY_CLEAN:-0} ++ ++[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "${MY_COMPILER}" )" ++ ++[ -n "${MY_COMPONENT:+1}" ] && COMPONENT="$( toUPPER "${MY_COMPONENT}" )" ++ ++[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" ++ ++[ "${MY_PARMAKE:0}" -gt 1 ] && PARMAKE=${MY_PARMAKE} ++ ++[ -n "${MY_PLATFORM:+1}" ] && PLATFORM="$( toLOWER "${MY_PLATFORM}" )" ++ ++[ -n "${MY_VERBOSE:+1}" ] && VERBOSE="$( toLOWER "${MY_VERBOSE}" )" ++ ++modFILE="envmodules${COMPILER:+_${COMPILER}}${PLATFORM:+.${PLATFORM}}" ++ ++# Customize the NEMS.x filename to include the component names ++if [ -n "${COMPONENT:+1}" ]; then ++ compFNAME="$( strTrim "$( toLOWER "${COMPONENT}" )" )" ++ compFNAME="$( echo "${compFNAME}" | sed 's/ /_/g' )" ++fi ++ ++# Export some environment variables for NEMS ++export NEMS_COMPILER=${COMPILER} ++########## ++ ++ ++########## ++# Get the project directories and perform a basic check on them ++readonly nemsDIR="${NEMS_DIR:-${scrDIR}/NEMS}" ++if [ ! -f "${nemsDIR}/NEMSAppBuilder" ]; then ++ echo "The project directory \"${nemsDIR}\" does not appear to contain NEMSAppBuilder." ++ echo "Is this the correct NEMS directory?" ++ echo "You might need to set the environment variable NEMS_DIR before running this script." ++ echo "Exiting ..." ++ exit 1 ++fi ++ ++readonly modDIR="${NEMSMODS_DIR:-${scrDIR}/modulefiles}" ++if [ ! -f "${modDIR}/${modFILE}" ]; then ++ echo "The modulefiles directory \"${modDIR}\" does not appear to contain module: ${modFILE}." ++ echo "Is this the correct modulefiles directory?" ++ echo "You might need to set the environment variable NEMSMODS_DIR before running this script." ++ echo "Exiting ..." ++ exit 1 ++fi ++########## ++ ++ ++########## ++# If the user requested to clean the build folder, do the cleaning end exit ++if [ ${CLEAN:-0} -ge 1 ]; then ++ echo "User requested to only clean the project. Cleaning ..." ++ ++ pushd ${nemsDIR} >/dev/null 2>&1 ++ [ ${CLEAN:-0} -eq 1 ] && compileNems clean ++ [ ${CLEAN:-0} -eq 2 ] && compileNems distclean ++ popd >/dev/null 2>&1 ++ ++ exit 0 ++fi ++########## ++ ++ ++########## ++# Source the environment module ++source ${modDIR}/${modFILE} ++ ++component_ww3="$( echo "${COMPONENT}" | sed 's/ /:/g' )" ++if [[ :${component_ww3}: == *:"WW3":* ]]; then ++ export WW3_CONFOPT="${COMPILER}" ++ export WW3_COMP="${COMPILER}" ++ export WWATCH3_NETCDF=NC4 ++fi ++########## ++ ++ ++########## ++# Get a final user response for the variables ++echo ++echo "The following variables are defined:" ++echo " CLEAN = ${CLEAN}" ++echo " COMPILER = ${COMPILER:-Undefined, Supported values are: [${MY_COMPILING_SYTEMS}]}" ++echo " NEMS_COMPILER = ${NEMS_COMPILER}" ++if [[ :${component_ww3}: == *:"WW3":* ]]; then ++ echo " WW3_CONFOPT = ${WW3_CONFOPT}" ++ echo " WW3_COMP = ${WW3_COMP}" ++ echo " WWATCH3_NETCDF = ${WWATCH3_NETCDF}" ++fi ++echo " COMPONENTS = ${COMPONENT:-Undefined, Supported values are: [${MY_COMPONENT_LIST}]}" ++echo " OS = ${OS}" ++echo " PLATFORM = ${PLATFORM}" ++echo " VERBOSE = ${VERBOSE}" ++echo ++echo " HDF5HOME = ${HDF5HOME}" ++echo " NETCDFHOME = ${NETCDFHOME}" ++echo " NETCDF_INCDIR = ${NETCDF_INCDIR}" ++echo " NETCDF_LIBDIR = ${NETCDF_LIBDIR}" ++echo ++echo " ESMFMKFILE = ${ESMFMKFILE}" ++echo ++ + module list + +-echo "Building NEMS app in ${ROOTDIR}/NEMS" +-cd ${ROOTDIR}/NEMS ++echo_response= ++while [ -z "${echo_response}" ] ; do ++ echo -n "Are these values correct? [y/n]: " ++ read echo_response ++ echo_response="$( getYesNo "${echo_response}" )" ++done ++ ++if [ "${echo_response:-no}" = "no" ]; then ++ echo ++ echo "User responded: ${echo_response}" ++ echo "Exiting now ..." ++ echo ++ exit 1 ++fi ++ ++unset echo_response ++########## ++ ++ ++############################################################ ++### START THE CALCULATIONS ++############################################################ ++ ++########## ++# Compile the project ++compileERR=0 ++pushd ${nemsDIR} >/dev/null 2>&1 ++ case ${CLEAN:-0} in ++ -1 ) ++ compileNems clean ++ compileERR=$? ++ ;; ++ -2 ) ++ compileNems distclean ++ compileERR=$? ++ ;; ++ -3 ) ++ compileNems noclean ++ compileERR=$? ++ ;; ++ * ) ++ compileNems clean ++ compileERR=$? ++ ;; ++ esac ++ ++ if [ ${compileERR} -eq 0 ]; then ++ compileNems build ++ compileERR=$? ++ fi ++ ++ if [ ${compileERR} -eq 0 ]; then ++ if [ -f exe/NEMS.x ]; then ++ cp -p exe/NEMS.x exe/NEMS${compFNAME:+-${compFNAME}}.x ++ fi ++ fi ++popd >/dev/null 2>&1 ++ ++########## ++# Install all data, executables, libraries in a common directory ++[ ${compileERR:-0} -eq 0 ] && installNems ++########## + +-# Clean up +-make -f GNUmakefile distclean_ADCIRC COMPONENTS="ADCIRC" +-make -f GNUmakefile distclean_WW3DATA COMPONENTS="WW3DATA" +-make -f GNUmakefile distclean_ATMESH COMPONENTS="ATMESH" +-make -f GNUmakefile distclean_WW3 COMPONENTS="WW3" +-make -f GNUmakefile distclean_NWM COMPONENTS="NWM" +-make -f GNUmakefile distclean_NEMS COMPONENTS="ADCIRC WW3 NWM ATMESH" +- +-# Make coupled NEMS app +-#make -f GNUmakefile build COMPONENTS="ADCIRC NWM ATMESH" +-#make -f GNUmakefile build COMPONENTS="ADCIRC WW3 ATMESH" +-#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH WW3 NWM" +-#make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" +-#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH NWM" +-make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH NWM" ++exit 0 diff --git a/buildcrcnd.sh b/buildcrcnd.sh new file mode 100755 index 00000000..c9fb2030 --- /dev/null +++ b/buildcrcnd.sh @@ -0,0 +1,45 @@ +#!/bin/bash -i + +# Description : Script to compile NSEModel NEMS application +# Usage : ./build.sh +# Date : Feb 27, 2020 +# Contact : moghimis@gmail.com + + +# load modules +#source modulefiles/ndcrc/ESMF_NUOPC + +cd NEMS +curdir=$PWD ; + +echo $curdir +cd $curdir/src ; make clean ; +cd $curdir + +# location of netcdf at ND-CRC +export NETCDF=/opt/crc/n/netcdf/4.7.0/intel/18.0/ +export NETCDFHOME=/opt/crc/n/netcdf/4.7.0/intel/18.0/ + +# location of ESMFMKFILE +export ESMFMKFILE=/pontus/gling/ADC_v55-WW3-NWM-NEMS/esmf_8/DEFAULTINSTALLDIR/lib/libO/Linux.intel.64.mvapich2.default/esmf.mk + +#clean up +make -f GNUmakefile distclean_ADCIRC COMPONENTS="ADCIRC" +make -f GNUmakefile distclean_WW3DATA COMPONENTS="WW3DATA" +make -f GNUmakefile distclean_ATMESH COMPONENTS="ATMESH" +#make -f GNUmakefile distclean_NWM COMPONENTS="NWM" +make -f GNUmakefile distclean_WW3 COMPONENTS="WW3" + +#make +#make -f GNUmakefile build COMPONENTS="ADCIRC NWM ATMESH" +#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH WW3 NWM" +make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH WW3 WW3DATA" +#make -f GNUmakefile build COMPONENTS="WW3DATA ADCIRC ATMESH" +#make -f GNUmakefile build COMPONENTS="WW3" +#make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" +#make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" +#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH NWM" +#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH" + + + diff --git a/compile-NEMS.x.txt b/compile-NEMS.x.txt new file mode 100644 index 00000000..a3126e4e --- /dev/null +++ b/compile-NEMS.x.txt @@ -0,0 +1,25 @@ +Patch usage: patch -p1 < patch_name + example: patch -p1 < ADC-WW3-NWM-NEMS.patch + to reverse it: + example: patch -p1 -R < ADC-WW3-NWM-NEMS.patch + +1) Run the build.sh script as: + build.sh -h or, build.sh --help + to get the list of all options available to script. + +2) Example: Run the build.sh script as: + build.sh + to use the default settings + +3) Example: Run the build.sh script as: + build.sh -plat stampede -component "ADCIRC ATMESH + to use customized settings + +3) Example: Run the build.sh script as: + build.sh -c --component="ADCIRC ATMESH + to clean a previous compilation using "make clean" + build.sh -c 2 --component="ADCIRC ATMESH + to clean a previous compilation using "make distclean" + +Panagiotis Velissariou - 12/04/2020 + diff --git a/compile-NEMS.x.txt.old b/compile-NEMS.x.txt.old new file mode 100644 index 00000000..09bbb45d --- /dev/null +++ b/compile-NEMS.x.txt.old @@ -0,0 +1,33 @@ +1) First load all necessary modules +module load intel +module load impi +module load netcdf +module load hdf5 + +module use /work/07380/panvel/Modules/modulefiles +module load impi-intel/esmf-7.1.0r +(OR: module load impi-intel/esmf-8.0.1) + +2) Set the following environment variables: +export NETCDF=${TACC_NETCDF_DIR} +export HDF5=${TACC_HDF5_DIR} +export ESMFMKFILE=/work/07380/panvel/apps/intel/impi/esmf-7.1.0r/lib64/esmf.mk +(OR: export ESMFMKFILE=/work/07380/panvel/apps/intel/impi/esmf-8.0.1/lib64/esmf.mk) + +3) Change directory into the NEMS directory and run make +cd NEMS (if not in the NEMS directory) +make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" + +The executable will be: NEMS/exe/NEMS.x + +To clean the generated files: +cd NEMS (if not in the NEMS directory) +make -f GNUmakefile clean COMPONENTS="ADCIRC WW3DATA ATMESH" + +OR to clean everything: +cd NEMS (if not in the NEMS directory) +make -f GNUmakefile distclean COMPONENTS="ADCIRC WW3DATA ATMESH" + + +Panagiotis Velissariou - 10/18/2020 + diff --git a/conf/configure.nems.linux.gnu b/conf/configure.nems.linux.gnu new file mode 100644 index 00000000..d1aee7e4 --- /dev/null +++ b/conf/configure.nems.linux.gnu @@ -0,0 +1,56 @@ +## NEMS configuration file +## +## Platform: Generic/Linux +## Compiler: GNU with MPI --- needs fixing + +SHELL = /bin/sh + +################################################################################ +## Include the common configuration parts +include $(TOP)/conf/configure.nems.NUOPC + +################################################################################ +## Other settings + +NETCDF_INC = -I$(NETCDF_INCDIR) +NETCDF_LIB = -L$(NETCDF_LIBDIR) -lnetcdf + +NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +NEMSIO_LIB = -L${LIBDIR} -lnemsio +SYS_LIB = + +EXTLIBS = $(NEMSIO_LIB) \ + $(NETCDF_LIB) \ + $(ESMF_LIB) \ + $(SYS_LIB) -lm + +EXTLIBS_POST = $(NEMSIO_LIB) \ + $(ESMF_LIB) \ + $(NETCDF_LIB) \ + $(SYS_LIB) +### +FC = mpif90 -g -ffree-line-length-none -fno-range-check -fbacktrace +F77 = mpiifort -g -ffree-line-length-none -fno-range-check -fbacktrace +FREE = -free +FIXED = -fixed +R8 = -r8 + +FINCS = $(ESMF_INC) $(NEMSIO_INC) $(NETCDF_INC) +#TRAPS = ??? + +FFLAGS = $(TRAPS) $(FINCS) -fp-model strict + +OPTS_NMM = -g -ffree-line-length-none -fno-range-check -fbacktrace $(FREE) + +FFLAGM_DEBUG = + +FFLAGS_NMM = $(MACROS_NWM) $(OPTS_NMM) $(FFLAGS) + +FPP = -fpp +CPP = cpp -P -traditional +CPPFLAGS = -DENABLE_SMP -DCHNK_RRTM=8 + +AR = ar +ARFLAGS = -r + +RM = rm diff --git a/conf/configure.nems.linux.intel b/conf/configure.nems.linux.intel new file mode 100644 index 00000000..a3229932 --- /dev/null +++ b/conf/configure.nems.linux.intel @@ -0,0 +1,56 @@ +## NEMS configuration file +## +## Platform: Generic/Linux +## Compiler: Intel with IntelMPI + +SHELL = /bin/sh + +################################################################################ +## Include the common configuration parts +include $(TOP)/conf/configure.nems.NUOPC + +################################################################################ +## Other settings + +NETCDF_INC = -I$(NETCDF_INCDIR) +NETCDF_LIB = -L$(NETCDF_LIBDIR) -lnetcdf + +NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +NEMSIO_LIB = -L${LIBDIR} -lnemsio +SYS_LIB = + +EXTLIBS = $(NEMSIO_LIB) \ + $(NETCDF_LIB) \ + $(ESMF_LIB) \ + $(SYS_LIB) -lm + +EXTLIBS_POST = $(NEMSIO_LIB) \ + $(ESMF_LIB) \ + $(NETCDF_LIB) \ + $(SYS_LIB) +### +FC = mpiifort -g -qopenmp -mkl=sequential -align array32byte -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -qopenmp -convert big_endian -assume byterecl -mkl=sequential +F77 = mpiifort -g -qopenmp -mkl=sequential -align array32byte -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -qopenmp -convert big_endian -assume byterecl -mkl=sequential +FREE = -free +FIXED = -fixed +R8 = -r8 + +FINCS = $(ESMF_INC) $(NEMSIO_INC) $(NETCDF_INC) +#TRAPS = -g -fno-inline -no-ip -traceback -ftrapuv -fpe0 -ftz -check all -check noarg_temp_created -fp-stack-check + +FFLAGS = $(TRAPS) $(FINCS) -fp-model strict + +OPTS_NMM = -g -fno-inline -no-ip -traceback -ftrapuv -fpe0 -ftz -check all -check noarg_temp_created -fp-stack-check $(FREE) + +FFLAGM_DEBUG = + +FFLAGS_NMM = $(MACROS_NWM) $(OPTS_NMM) $(FFLAGS) + +FPP = -fpp +CPP = cpp -P -traditional +CPPFLAGS = -DENABLE_SMP -DCHNK_RRTM=8 + +AR = ar +ARFLAGS = -r + +RM = rm diff --git a/conf/configure.nems.linux.pgi b/conf/configure.nems.linux.pgi new file mode 100644 index 00000000..81674d2d --- /dev/null +++ b/conf/configure.nems.linux.pgi @@ -0,0 +1,56 @@ +## NEMS configuration file +## +## Platform: Generic/Linux +## Compiler: PGI with MPI --- needs fixing + +SHELL = /bin/sh + +################################################################################ +## Include the common configuration parts +include $(TOP)/conf/configure.nems.NUOPC + +################################################################################ +## Other settings + +NETCDF_INC = -I$(NETCDF_INCDIR) +NETCDF_LIB = -L$(NETCDF_LIBDIR) -lnetcdf + +NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +NEMSIO_LIB = -L${LIBDIR} -lnemsio +SYS_LIB = + +EXTLIBS = $(NEMSIO_LIB) \ + $(NETCDF_LIB) \ + $(ESMF_LIB) \ + $(SYS_LIB) -lm + +EXTLIBS_POST = $(NEMSIO_LIB) \ + $(ESMF_LIB) \ + $(NETCDF_LIB) \ + $(SYS_LIB) +### +FC = mpif90 -g -Mextend -Minform,inform -Mbounds +F77 = mpif90 -g -Mextend -Minform,inform -Mbounds +FREE = -free +FIXED = +R8 = -r8 + +FINCS = $(ESMF_INC) $(NEMSIO_INC) $(NETCDF_INC) +#TRAPS = -g -fno-inline -no-ip -traceback -ftrapuv -fpe0 -ftz -check all -check noarg_temp_created -fp-stack-check + +FFLAGS = $(TRAPS) $(FINCS) -fp-model strict + +OPTS_NMM = -g -Mextend -Minform,inform -Mbounds $(FREE) + +FFLAGM_DEBUG = + +FFLAGS_NMM = $(MACROS_NWM) $(OPTS_NMM) $(FFLAGS) + +FPP = -fpp +CPP = cpp -P -traditional +CPPFLAGS = -DENABLE_SMP -DCHNK_RRTM=8 + +AR = ar +ARFLAGS = -r + +RM = rm diff --git a/conf/configure.nems.ndcrc.intel b/conf/configure.nems.ndcrc.intel new file mode 100644 index 00000000..ce0df05b --- /dev/null +++ b/conf/configure.nems.ndcrc.intel @@ -0,0 +1,61 @@ +## NEMS configuration file +## +## Platform: Hera +## Compiler: Intel with IntelMPI + +SHELL = /bin/sh + +################################################################################ +## Include the common configuration parts +include $(TOP)/conf/configure.nems.NUOPC +#include $(TOP)/conf/configure.ndcrc.NUOPC + + +################################################################################ +## Other settings + +NETCDF_INC = -I$(NETCDF)/include +NETCDF_LIB = -L$(NETCDF)/lib -lnetcdff + +NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +NEMSIO_LIB = -L${LIBDIR} -lnemsio +SYS_LIB = + +EXTLIBS = $(NEMSIO_LIB) \ + $(NETCDF_LIB) \ + $(ESMF_LIB) \ + $(SYS_LIB) -lm + +EXTLIBS_POST = $(NEMSIO_LIB) \ + $(ESMF_LIB) \ + $(NETCDF_LIB) \ + $(SYS_LIB) +### +#FC = mpiifort -g -qopenmp -mkl=sequential -align array32byte -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -qopenmp -convert big_endian -assume byterecl -mkl=sequential +#F77 = mpiifort -g -qopenmp -mkl=sequential -align array32byte -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -qopenmp -convert big_endian -assume byterecl -mkl=sequential +FREE = -free +FC = mpif90 -g -qopenmp -mkl=sequential -align array32byte -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -qopenmp -convert big_endian -assume byterecl -mkl=sequential +F77 = mpif90 -g -qopenmp -mkl=sequential -align array32byte -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -qopenmp -convert big_endian -assume byterecl -mkl=sequential +FIXED = -fixed +R8 = -r8 +CC = mpicc + +FINCS = $(ESMF_INC) $(NEMSIO_INC) $(NETCDF_INC) +#TRAPS = -g -fno-inline -no-ip -traceback -ftrapuv -fpe0 -ftz -check all -check noarg_temp_created -fp-stack-check + +FFLAGS = $(TRAPS) $(FINCS) -fp-model strict + +OPTS_NMM = -g -fno-inline -no-ip -traceback -ftrapuv -fpe0 -ftz -check all -check noarg_temp_created -fp-stack-check $(FREE) + +FFLAGM_DEBUG = + +FFLAGS_NMM = $(MACROS_NWM) $(OPTS_NMM) $(FFLAGS) + +FPP = -fpp +CPP = cpp -P -traditional +CPPFLAGS = -DENABLE_SMP -DCHNK_RRTM=8 + +AR = ar +ARFLAGS = -r + +RM = rm diff --git a/conf/externals.nems b/conf/externals.nems new file mode 100644 index 00000000..7d3e85ad --- /dev/null +++ b/conf/externals.nems @@ -0,0 +1,2 @@ +# Location of external components + diff --git a/conf/externals.nems.cheyenne b/conf/externals.nems.cheyenne new file mode 100644 index 00000000..9feed939 --- /dev/null +++ b/conf/externals.nems.cheyenne @@ -0,0 +1,26 @@ +# Location of external components + +SATM_DIR= +XATM_DIR= +SLND_DIR= +XLND_DIR= +NOAH_DIR= +NOAHMP_DIR= +SICE_DIR= +XICE_DIR= +CICE_DIR= +SOCN_DIR= +XOCN_DIR= +MOM5_DIR= +HYCOM_DIR= +POM_DIR= +SWAV_DIR= +XWAV_DIR= +WW3_DIR= +SIPM_DIR= +XIPM_DIR= +IPE_DIR= +SHYD_DIR= +XHYD_DIR= +WRFHYDRO_DIR= +LIS_DIR= diff --git a/conf/externals.nems.gaea b/conf/externals.nems.gaea new file mode 100644 index 00000000..9feed939 --- /dev/null +++ b/conf/externals.nems.gaea @@ -0,0 +1,26 @@ +# Location of external components + +SATM_DIR= +XATM_DIR= +SLND_DIR= +XLND_DIR= +NOAH_DIR= +NOAHMP_DIR= +SICE_DIR= +XICE_DIR= +CICE_DIR= +SOCN_DIR= +XOCN_DIR= +MOM5_DIR= +HYCOM_DIR= +POM_DIR= +SWAV_DIR= +XWAV_DIR= +WW3_DIR= +SIPM_DIR= +XIPM_DIR= +IPE_DIR= +SHYD_DIR= +XHYD_DIR= +WRFHYDRO_DIR= +LIS_DIR= diff --git a/conf/externals.nems.hera b/conf/externals.nems.hera index e30e7ff8..9feed939 100755 --- a/conf/externals.nems.hera +++ b/conf/externals.nems.hera @@ -1,4 +1,4 @@ -# Location of external components on Theia +# Location of external components SATM_DIR= XATM_DIR= diff --git a/conf/externals.nems.hera.rej b/conf/externals.nems.hera.rej new file mode 100644 index 00000000..a8f60eee --- /dev/null +++ b/conf/externals.nems.hera.rej @@ -0,0 +1,8 @@ +--- conf/externals.nems.hera 2020-12-04 14:36:35.000000000 -0600 ++++ conf/externals.nems.hera 2020-12-09 22:33:55.670362901 -0600 +@@ -1,4 +1,4 @@ +-# Location of external components on Theia ++# Location of external components + + SATM_DIR= + XATM_DIR= diff --git a/conf/externals.nems.jet b/conf/externals.nems.jet new file mode 100644 index 00000000..9feed939 --- /dev/null +++ b/conf/externals.nems.jet @@ -0,0 +1,26 @@ +# Location of external components + +SATM_DIR= +XATM_DIR= +SLND_DIR= +XLND_DIR= +NOAH_DIR= +NOAHMP_DIR= +SICE_DIR= +XICE_DIR= +CICE_DIR= +SOCN_DIR= +XOCN_DIR= +MOM5_DIR= +HYCOM_DIR= +POM_DIR= +SWAV_DIR= +XWAV_DIR= +WW3_DIR= +SIPM_DIR= +XIPM_DIR= +IPE_DIR= +SHYD_DIR= +XHYD_DIR= +WRFHYDRO_DIR= +LIS_DIR= diff --git a/conf/externals.nems.linux b/conf/externals.nems.linux new file mode 100644 index 00000000..7d3e85ad --- /dev/null +++ b/conf/externals.nems.linux @@ -0,0 +1,2 @@ +# Location of external components + diff --git a/conf/externals.nems.macosx b/conf/externals.nems.macosx new file mode 100644 index 00000000..7d3e85ad --- /dev/null +++ b/conf/externals.nems.macosx @@ -0,0 +1,2 @@ +# Location of external components + diff --git a/conf/externals.nems.orion b/conf/externals.nems.orion new file mode 100644 index 00000000..9feed939 --- /dev/null +++ b/conf/externals.nems.orion @@ -0,0 +1,26 @@ +# Location of external components + +SATM_DIR= +XATM_DIR= +SLND_DIR= +XLND_DIR= +NOAH_DIR= +NOAHMP_DIR= +SICE_DIR= +XICE_DIR= +CICE_DIR= +SOCN_DIR= +XOCN_DIR= +MOM5_DIR= +HYCOM_DIR= +POM_DIR= +SWAV_DIR= +XWAV_DIR= +WW3_DIR= +SIPM_DIR= +XIPM_DIR= +IPE_DIR= +SHYD_DIR= +XHYD_DIR= +WRFHYDRO_DIR= +LIS_DIR= diff --git a/conf/externals.nems.stampede b/conf/externals.nems.stampede new file mode 100644 index 00000000..9feed939 --- /dev/null +++ b/conf/externals.nems.stampede @@ -0,0 +1,26 @@ +# Location of external components + +SATM_DIR= +XATM_DIR= +SLND_DIR= +XLND_DIR= +NOAH_DIR= +NOAHMP_DIR= +SICE_DIR= +XICE_DIR= +CICE_DIR= +SOCN_DIR= +XOCN_DIR= +MOM5_DIR= +HYCOM_DIR= +POM_DIR= +SWAV_DIR= +XWAV_DIR= +WW3_DIR= +SIPM_DIR= +XIPM_DIR= +IPE_DIR= +SHYD_DIR= +XHYD_DIR= +WRFHYDRO_DIR= +LIS_DIR= diff --git a/conf/externals.nems.wcoss b/conf/externals.nems.wcoss new file mode 100644 index 00000000..9feed939 --- /dev/null +++ b/conf/externals.nems.wcoss @@ -0,0 +1,26 @@ +# Location of external components + +SATM_DIR= +XATM_DIR= +SLND_DIR= +XLND_DIR= +NOAH_DIR= +NOAHMP_DIR= +SICE_DIR= +XICE_DIR= +CICE_DIR= +SOCN_DIR= +XOCN_DIR= +MOM5_DIR= +HYCOM_DIR= +POM_DIR= +SWAV_DIR= +XWAV_DIR= +WW3_DIR= +SIPM_DIR= +XIPM_DIR= +IPE_DIR= +SHYD_DIR= +XHYD_DIR= +WRFHYDRO_DIR= +LIS_DIR= diff --git a/functions_build b/functions_build new file mode 100644 index 00000000..05111ddc --- /dev/null +++ b/functions_build @@ -0,0 +1,611 @@ +#!/bin/bash-*-Shell-script-functions*- + +########################################################################### +### Author: Panagiotis Velissariou +### +### Version - 1.0 Fri Dec 04 2020 +########################################################################### + +set +u + +MY_COMPILING_SYTEMS="gnu, intel, pgi" +MY_COMPONENT_LIST="ADCIRC WW3DATA WW3 NWM ATMESH" + +################################################## +### MODELLING SYSTEM BUILD FUNCTIONS +################################################## + +###======================================== +### ParseArgs() +### Usage: ParseArgs args +### Parameters: args = the script options +### Returns: 0 +### Echoes: NONE +### +### Gets the supplied options to the script. +###======================================== +ParseArgs() +{ + local nm_func=$( basename ${BASH_SOURCE[${#BASH_SOURCE[@]}-1]} ) + + local opt_all opt_opt opt_arg opt_chk + + local t_VAR + local ans0 ans ival intN + local all_evars + + all_evars="MY_CLEAN MY_COMPILER MY_COMPONENT MY_OS MY_PARMAKE MY_PLATFORM MY_VERBOSE" + + for ival in ${all_evars}; do unset __${ival}; done + + + __MY_CLEAN=0 + __MY_COMPILER=intel + __MY_COMPONENT="ADCIRC WW3DATA ATMESH" + __MY_OS= + __MY_PARMAKE=1 + __MY_PLATFORM= + __MY_VERBOSE= + + + # ----- + # Process the function options + opt_all=( c clean compiler component j os plat v verbose h help ) + opt_all=":$( echo "${opt_all[@]/#/-} ${opt_all[@]/#/--}" | sed 's/ /:/g' ):" + + unset __OPTION_LIST + while test $# -gt 0; do + case "${1}" in + -[^-]*=* | --[^-]*=* ) + opt_opt="$( toLOWER "$( echo "${1}" | sed 's/=.*//' )" )" + len=$(( ${#opt_opt} + 1 )) + opt_arg="$( strTrim "$( echo "${1:${len}}" )" 2 )" + [ "$( echo "${opt_all}" | egrep -o ":${opt_arg}:" )" ] && \ + opt_arg= + ;; + -[^-]* | --[^-]* ) + opt_opt="$( toLOWER "${1}" )" + opt_chk="$( toLOWER "$( echo "${2}" | sed 's/=.*//' )" )" + if [ "$( echo "${opt_all}" | egrep -o ":${opt_chk}:" )" ]; then + opt_arg= + else + opt_arg="$( strTrim "$( echo "${2}" )" )" + fi + ;; + *) + opt_opt= + opt_arg= + ;; + esac + + case "${opt_opt}" in + -c | --c | -clean | --clean ) + checkFuncOpt "--clean" + if [ $? -eq 0 ]; then + __MY_CLEAN=1 + if [ "X${opt_arg}" != "X" ]; then + if `isInteger "${opt_arg}"` ; then + __MY_CLEAN=$( echo "${opt_arg}" ) + [ ${opt_arg} -le -3 ] && __MY_CLEAN=-3 + [ ${opt_arg} -ge 2 ] && __MY_CLEAN=2 + else + __MY_CLEAN=0 + [ "$( getYesNo "${opt_arg}" )" = "yes" ] && __MY_CLEAN=1 + fi + fi + fi + ;; + -compiler | --compiler ) + checkFuncOpt "--compiler" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_COMPILER="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" + fi + fi + ;; + -component | --component ) + checkFuncOpt "--component" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_COMPONENT="$( strTrim "${opt_arg}" )" + fi + fi + ;; + -j | --j ) + checkFuncOpt "--j" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_PARMAKE=1 + t_VAR="$( getPosInteger "${opt_arg}" )" + [ ! -z "${t_VAR}" ] && __MY_PARMAKE=${t_VAR} + fi + fi + ;; + -os | --os ) + checkFuncOpt "--os" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_OS="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" + fi + fi + ;; + -plat | --plat ) + checkFuncOpt "--plat" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_PLATFORM="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" + fi + fi + ;; + -v | --v | -verbose | --verbose ) + checkFuncOpt "--verbose" + if [ $? -eq 0 ]; then + __MY_VERBOSE=b + if [ "X${opt_arg}" != "X" ]; then + __MY_VERBOSE="$( echo "$( strTrim "${opt_arg}" 2 )" | sed 's/[[:space:]]/,/g' )" + fi + fi + ;; + -h | -help | --h | --help ) + UsageBuild ${nm_func} + ;; + *) ;; # DEFAULT + esac + shift + opt_opt= + opt_arg= + done + unset __OPTION_LIST + # ----- + + if [ -z "${__MY_OS}" ]; then + case "$(uname -s)" in + Darwin ) __MY_OS="macosx" ;; + Linux ) __MY_OS="linux" ;; + *) __MY_OS="UNDEFINED";; # DEFAULT + esac + fi + + # Export the values of all __* variables. + for ival in ${all_evars} + do + ans0="$( eval "echo \${$(echo ${ival}):-}" )" + ans="$( eval "echo \${$(echo __${ival}):-}" )" + ans=${ans:-${ans0:-}} + + eval "${ival}=\${ans}" + export ${ival} + + unset __${ival} + done + + return 0 +} + +UsageBuild() +{ + local nm="$( basename ${0} )" + + echo + echo "Usage: \"${nm}\" [{-|--}option1{=|space}[option_value1]] [{-|--}option2{=|space}[option_value2]] ..." + echo + + echo " -h|-help|--h|--help" + echo " Show this help screen." + echo + #--- + echo " -c|--c|-clean|--clean [=|space] \"0|1|yes|no\" (OPTIONAL)." + echo " Only clean the already compiled CMake build system." + echo " Default: 0|no." + echo + #--- + echo " -compiler|--compiler [=|space] \"compiling_system\" (OPTIONAL)." + echo " The compiling system to use (${MY_COMPILING_SYTEMS})." + echo " Default: intel." + echo + #--- + echo " -component|--component [=|space] \"component_list\" (OPTIONAL)." + echo " The component(s) to use (${MY_COMPONENT_LIST})." + echo " Default: \"ADCIRC WW3DATA ATMESH\"." + echo + #--- + echo " -j|--j [=|space] \"N\" (OPTIONAL)." + echo " Define the number of make jobs to run simultaneously." + echo " Default: 1." + echo + #--- + echo " -os|--os [=|space] \"OS string\" (OPTIONAL)." + echo " The name of the Operating system." + echo " Supported OSes: linux macosx." + echo " Default: current OS." + echo + #--- + echo " -plat|--plat [=|space] \"platform\" (OPTIONAL)." + echo " The name of the compute HPC platform to consider." + echo " Selecting a platform, environment modules specific to that platform are loaded" + echo " and corresponding environment variables are set." + echo " Supported platforms: cheyenne gaea hera jet orion stampede wcoss." + echo " Default: none." + echo + #--- + echo " -v|--v|-verbose|--verbose [=|space] \"a,b,v,i,j,m,n\" (any combination, OPTIONAL)." + echo " Enable verbosity in the make files during compilation." + echo " a (all) : all types of debugging output are enabled" + echo " n (none) : disable all debugging currently enabled" + echo " b (basic) : basic debugging and whether the build was successful or not" + echo " v (verbose) : a level above basic" + echo " i (implicit) : prints messages describing the implicit rule searches for each target" + echo " j (jobs) : prints messages giving details on the invocation of specific sub-commands" + echo " m (makefile) : enables messages while rebuilding makefiles" + echo " Default:none." + echo + #--- + + exit 0 +} + +###======================================== +### checkFuncOpt() +### Usage: checkFuncOpt opt_name +### Parameters: +### opt_name: The name of the option to a function +### +### Returns : Exits on error +### +### Exports : __OPTION_LIST +### +### Echoes : NONE +### +### checkFuncOpt: Checks if an option to a function is already supplied. +###======================================== +checkFuncOpt() { + local opt_inp opt_list + + [ $# -eq 0 ] && return -1 + + opt_inp="$( strTrim "${1}" 2 )" + opt_inp="$( echo "${opt_inp}" | sed 's/^[-]*//' )" + + opt_list="$( strTrim "${__OPTION_LIST}" 2 )" + [ -n ${opt_list:+1} ] && \ + opt_list=":$( echo "${opt_list}" | sed 's/ /:/g' ):" + + [ "$( echo "${opt_list}" | egrep -o ":${opt_inp}:" )" ] && return 1 + + __OPTION_LIST="${__OPTION_LIST} ${opt_inp}" + export __OPTION_LIST + + return 0 +} + +###======================================== +### isInteger() +### Usage: isInteger var +### Parameters: var +### Returns: 1 if var is not an integer (0 is an integer as well) +### 0 in any other case +### Echoes: NONE +###======================================== +isInteger() +{ + local -i retval=1 + + [ $# -eq 0 ] && return ${retval} + + if [ "${1:-UNDEF}" -eq "${1}" ] 2>/dev/null + then + retval=0 + fi + + return ${retval} +} + +###======================================== +### getInteger() +### Usage: getInteger int +### Parameters: int (int >=0 or, int < 0) +### Returns: 1 if var is not an integer +### 0 in any other case +### Echoes: int, if it is a valid integer (including 0), +### in any other case echoes an empty string +###======================================== +getInteger() +{ + local -i retval=0 + local echoval= minus= + + # strip spaces, '+' signs and '-' signs + # if the first character of the string is '-', set the minus variable + echoval="$( echo "${1}" | sed 's/[[:space:]+]//g' )" + [ "X$( echo "${echoval:0:1}" )" = "X-" ] && minus="-" + echoval="${minus}$( echo "${echoval}" | sed 's/[[:space:]-]//g' )" + + if isInteger ${echoval}; then + echoval="$(echo "scale=0; ${echoval} + 0" | bc -ql 2>/dev/null)" + retval=$? + echoval="${echoval:-0}" + else + echoval= + retval=1 + fi + + echo -n ${echoval} + + return ${retval} +} + +###======================================== +### getPosInteger() +### Usage: getPosInteger posint +### Parameters: posint (posint >= 0) +### Returns: 1 if var is not a positive integer +### 0 in any other case +### Echoes: posint if it is a valid positive integer +### (including 0), in any other case echoes an +### empty string +###======================================== +getPosInteger() +{ + local -i retval=0 + local echoval= + + echoval=$( getInteger "${1}" ) + retval=$? + + if [ ${retval} -ne 0 ] ; then + echoval= + retval=1 + else + if [ ${echoval} -lt 0 ]; then + echoval= + retval=1 + fi + fi + + echo -n ${echoval} + + return ${retval} +} + +###======================================== +### getYesNo() +### Usage: getYesNo value +### Parameters: +### value : The input value (the value of a parameter) +### The value of a bash parameter that is checked +### against TRUE/FALSE. If the value is one of: +### ">=1|y|yes|yea|yeah|yep" +### then the value of parameter is TRUE (answer = yes). +### If the value is one of: +### "<=0|n|no|not|nop|nope" +### then the value of parameter is FALSE (answer = no). +### If the value is empty then the value of parameter +### is FALSE (answer = no) +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : A "yes" or "no" answer. +### +### getYesNo: Checks if a parameter is assigned a TRUE/FALSE value. +###======================================== +getYesNo() +{ + local param answer + + param="$( echo "${1}" | tr '[:upper:]' '[:lower:]' )" + + if [ "${param}" -eq "${param}" ] 2>/dev/null + then + [ ${param} -le 0 ] && param=0 + [ ${param} -gt 0 ] && param=1 + fi + + case "${param}" in + 1|y|yes|yea|yeah|yep) answer="yes" ;; + 0|n|no|not|nop|nope) answer="no" ;; + *) answer="" ;; # DEFAULT + esac + + echo -n "${answer}" +} + +###======================================== +### toUPPER() +### Usage: toUPPER string +### Parameters: +### string : The string in to convert +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : The input string converted to an all upper case string +### +### toUPPER: Converts a string to an all upper case string +###======================================== +function toUPPER() +{ + echo "${1}" | tr '[:lower:]' '[:upper:]' +} + +###======================================== +### toLOWER() +### Usage: toLOWER string +### Parameters: +### string : The string in to convert +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : The input string converted to an all lower case string +### +### toLOWER: Converts a string to an all lower case string +###======================================== +function toLOWER() +{ + echo "${1}" | tr '[:upper:]' '[:lower:]' +} + +###======================================== +### strESC() +### Usage: strESC string +### Parameters: +### string : The input string +### The input string on which this function is applied +### to escape special characters used in bash/sed ... +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : The modified string with its special characters escaped +### +### strESC: Escapes special characters in a string: "'()/[]*. +###======================================== +strESC() +{ + echo -n "$( echo "${*}" | sed -e "s/[\"\'\(\)\/\*\!]/\\\&/g;s/\[/\\\&/g;s/\]/\\\&/g" )" +} + +strESC1() +{ + echo -n "$( echo "${*}" | sed -e "s/[\&\/\*\!]/\\\&/g;s/\[/\\\&/g;s/\]/\\\&/g" )" +} + +###======================================== +### strTrim() +### Usage: strTrim s1 flag +### Parameters: +### s1 : The input string +### flag : Integer +### A value that controls the action of strTrim. +### If flag is zero or not present, trailing blanks are removed. +### Leading blanks are removed if it is equal to 1. +### Both are removed if it is equal to 2. +### In any other case, trailing blanks are removed. +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : s1 with all leading and/or trailing +### white spaces removed. +### +### strTrim: Removes all leading and/or trailing white spaces +### from the input string +###======================================== +function strTrim () +{ + local trimFLG="${2:-0}" + local out_str= + + case ${trimFLG} in + 0) out_str="$(echo "${1}" | sed 's/[[:space:]]*$//')" ;; + 1) out_str="$(echo "${1}" | sed 's/^[[:space:]]*//')" ;; + 2) out_str="$(echo "${1}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" ;; + *) out_str="$(echo "${1}" | sed 's/[[:space:]]*$//')" ;; + esac + + echo -n ${out_str} +} + +compileNems() { + local cmp_type cmp_make cmp_comp cmp_mjob + local err=0 + + [ $# -eq 0 ] && return ${err} + + cmp_type="$( toLOWER "${1}" )" + cmp_make=GNUmakefile + cmp_comp="${COMPONENT:+COMPONENTS=\"${COMPONENT}\"}" + cmp_mjob="${PARMAKE:+-j ${PARMAKE}}" + cmp_verb="${VERBOSE:+--debug=${VERBOSE}}" + + case "${cmp_type}" in + "clean"|"distclean" ) + if [ -f "${cmp_make}" ]; then + echo + echo "compileNems :: Cleaning: make -f ${cmp_make} ${cmp_type} ${cmp_comp}" + eval "make ${cmp_verb} -f ${cmp_make} ${cmp_type} ${cmp_comp}" + err=$? + + if [ "${cmp_type}" == "distclean" ]; then + rm -f NEMS/exe/NEMS-*.x + fi + else + echo "compileNems :: Cleaning: no makefile found: makefile = ${cmp_make}" + err=1 + fi + ;; + "build"|"compile" ) + if [ -f "${cmp_make}" ]; then + echo + echo "compileNems :: Compiling: make ${cmp_mjob} -f ${cmp_make} ${cmp_type} ${cmp_comp}" + eval "make ${cmp_verb} ${cmp_mjob} -f ${cmp_make} ${cmp_type} ${cmp_comp}" + err=$? + else + echo "compileNems :: Compiling: no makefile found: makefile = ${cmp_make}" + err=1 + fi + ;; + * ) err=0 ;; # Do nothing + esac + + return ${err} +} + +installNems() { + local cmp_comp icmp + local instdir + local CPBIN="/bin/cp -fpv" + local RMBIN="/bin/rm -fv" + + instdir="ALLBIN_INSTALL" + + cmp_comp="${COMPONENT}" + + [ ! -d "${instdir}" ] && mkdir -p ${instdir} + + for icmp in ${cmp_comp} + do + indir="${icmp}_INSTALL" + + if [ -d ${indir} ]; then + echo + echo " --- Installing from: ${indir} to ${instdir} ---" + ${CPBIN} ${indir}/* ${instdir}/ + fi + + ###### Extra ADCIRC files + if [ "${icmp}" == "ADCIRC" ]; then + echo + echo " --- Installing from: ${icmp} to ${instdir} ---" + for iprog in adcprep + do + prog="$( find ${icmp} -type f -name ${iprog} | head -1 )" + if [ -n "${prog:+1}" ]; then + ${CPBIN} ${prog} ${instdir}/ + fi + done + fi + ###### + done + + ###### Install the NEMS/exe/NEMS* files + echo + echo " --- Installing from: NEMS/exe to ${instdir} ---" + for iprog in NEMS/exe/NEMS-*.x + do + if [ -f "${iprog}" ]; then + ${CPBIN} ${iprog} ${instdir}/ + fi + done + + ###### Remove un-needed files from instdir + echo + echo " --- Removing files that are not needed from: ${instdir} ---" + ${RMBIN} ${instdir}/*.mk ${instdir}/*.mod +} diff --git a/modulefiles/envmodules b/modulefiles/envmodules new file mode 100644 index 00000000..3b61d299 --- /dev/null +++ b/modulefiles/envmodules @@ -0,0 +1,27 @@ +#!/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 impi +#module load szip hdf5 +#module load netcdf + +#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} diff --git a/modulefiles/envmodules_gnu.cheyenne b/modulefiles/envmodules_gnu.cheyenne new file mode 100644 index 00000000..23899380 --- /dev/null +++ b/modulefiles/envmodules_gnu.cheyenne @@ -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 gcc 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} diff --git a/modulefiles/envmodules_gnu.gaea b/modulefiles/envmodules_gnu.gaea new file mode 100644 index 00000000..b7e83e4a --- /dev/null +++ b/modulefiles/envmodules_gnu.gaea @@ -0,0 +1,28 @@ +#!/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 gcc 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} diff --git a/modulefiles/envmodules_gnu.hera b/modulefiles/envmodules_gnu.hera new file mode 100644 index 00000000..23899380 --- /dev/null +++ b/modulefiles/envmodules_gnu.hera @@ -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 gcc 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} diff --git a/modulefiles/envmodules_gnu.jet b/modulefiles/envmodules_gnu.jet new file mode 100644 index 00000000..23899380 --- /dev/null +++ b/modulefiles/envmodules_gnu.jet @@ -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 gcc 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} diff --git a/modulefiles/envmodules_gnu.linux b/modulefiles/envmodules_gnu.linux new file mode 100644 index 00000000..5cb700e1 --- /dev/null +++ b/modulefiles/envmodules_gnu.linux @@ -0,0 +1,27 @@ +#!/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 gcc impi +#module load szip hdf5 +#module load netcdf + +#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} diff --git a/modulefiles/envmodules_gnu.macosx b/modulefiles/envmodules_gnu.macosx new file mode 100644 index 00000000..5cb700e1 --- /dev/null +++ b/modulefiles/envmodules_gnu.macosx @@ -0,0 +1,27 @@ +#!/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 gcc impi +#module load szip hdf5 +#module load netcdf + +#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} diff --git a/modulefiles/envmodules_gnu.orion b/modulefiles/envmodules_gnu.orion new file mode 100644 index 00000000..d90402b3 --- /dev/null +++ b/modulefiles/envmodules_gnu.orion @@ -0,0 +1,27 @@ +#!/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 gcc impi +module load szip hdf5 +module load netcdf + +module load esmf + + +#################### +### (2) Set some environments varaiables related to the loaded +### modules and required to compile the NEMS application properly. + +export HDF5HOME=${HDF5_ROOT} +export NETCDFHOME=${NETCDF_ROOT} + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDF_INCLUDE_DIRS} +export NETCDF_LIBDIR=${NETCDF_LIBRARY_DIRS} + +export ESMFMKFILE=${ESMFMKFILE} diff --git a/modulefiles/envmodules_gnu.stampede b/modulefiles/envmodules_gnu.stampede new file mode 100644 index 00000000..2cc88d56 --- /dev/null +++ b/modulefiles/envmodules_gnu.stampede @@ -0,0 +1,28 @@ +#!/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 gcc impi +module load hdf5 +module load netcdf + +module use /work/07380/panvel/Modules/modulefiles +module load impi-intel/esmf-8.0.1 + + +#################### +### (2) Set some environments varaiables related to the loaded +### modules and required to compile the NEMS application properly. + +export HDF5HOME=${TACC_HDF5_DIR} +export NETCDFHOME=${TACC_NETCDF_DIR} + +export NETCDF_CONFIG=${TACC_NETCDF_BIN}/nc-config +export NETCDF_INCDIR=${TACC_NETCDF_INC} +export NETCDF_LIBDIR=${TACC_NETCDF_LIB} + +export ESMFMKFILE=${ESMFMKFILE} diff --git a/modulefiles/envmodules_gnu.wcoss b/modulefiles/envmodules_gnu.wcoss new file mode 100644 index 00000000..55c30263 --- /dev/null +++ b/modulefiles/envmodules_gnu.wcoss @@ -0,0 +1,28 @@ +#!/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 gcc 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} diff --git a/modulefiles/envmodules_intel.cheyenne b/modulefiles/envmodules_intel.cheyenne new file mode 100644 index 00000000..4358bc8a --- /dev/null +++ b/modulefiles/envmodules_intel.cheyenne @@ -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 intel 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} diff --git a/modulefiles/envmodules_intel.gaea b/modulefiles/envmodules_intel.gaea new file mode 100644 index 00000000..4358bc8a --- /dev/null +++ b/modulefiles/envmodules_intel.gaea @@ -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 intel 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} diff --git a/modulefiles/envmodules_intel.hera b/modulefiles/envmodules_intel.hera new file mode 100644 index 00000000..eee86378 --- /dev/null +++ b/modulefiles/envmodules_intel.hera @@ -0,0 +1,28 @@ +#!/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 impi +module load szip hdf5 +module load netcdf + +module use /home/emc.nemspara/SOFT-hera/modulefiles +module load esmf/8.0.0bs48g + + +#################### +### (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_intel.jet b/modulefiles/envmodules_intel.jet new file mode 100644 index 00000000..4358bc8a --- /dev/null +++ b/modulefiles/envmodules_intel.jet @@ -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 intel 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} diff --git a/modulefiles/envmodules_intel.linux b/modulefiles/envmodules_intel.linux new file mode 100644 index 00000000..eff77e07 --- /dev/null +++ b/modulefiles/envmodules_intel.linux @@ -0,0 +1,26 @@ +#!/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 impi +#module load szip hdf5 +#module load netcdf + +#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_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} diff --git a/modulefiles/envmodules_intel.macosx b/modulefiles/envmodules_intel.macosx new file mode 100644 index 00000000..3b61d299 --- /dev/null +++ b/modulefiles/envmodules_intel.macosx @@ -0,0 +1,27 @@ +#!/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 impi +#module load szip hdf5 +#module load netcdf + +#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} diff --git a/modulefiles/envmodules_intel.orion b/modulefiles/envmodules_intel.orion new file mode 100644 index 00000000..0e915c9f --- /dev/null +++ b/modulefiles/envmodules_intel.orion @@ -0,0 +1,27 @@ +#!/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 impi +module load szip hdf5 +module load netcdf + +module load esmf + + +#################### +### (2) Set some environments varaiables related to the loaded +### modules and required to compile the NEMS application properly. + +export HDF5HOME=${HDF5_ROOT} +export NETCDFHOME=${NETCDF_ROOT} + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDF_INCLUDE_DIRS} +export NETCDF_LIBDIR=${NETCDF_LIBRARY_DIRS} + +export ESMFMKFILE=${ESMFMKFILE} diff --git a/modulefiles/envmodules_intel.stampede b/modulefiles/envmodules_intel.stampede new file mode 100644 index 00000000..e613292e --- /dev/null +++ b/modulefiles/envmodules_intel.stampede @@ -0,0 +1,28 @@ +#!/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 impi +module load hdf5 +module load netcdf + +module use /work/07380/panvel/Modules/modulefiles +module load impi-intel/esmf-8.0.1 + + +#################### +### (2) Set some environments varaiables related to the loaded +### modules and required to compile the NEMS application properly. + +export HDF5HOME=${TACC_HDF5_DIR} +export NETCDFHOME=${TACC_NETCDF_DIR} + +export NETCDF_CONFIG=${TACC_NETCDF_BIN}/nc-config +export NETCDF_INCDIR=${TACC_NETCDF_INC} +export NETCDF_LIBDIR=${TACC_NETCDF_LIB} + +export ESMFMKFILE=${ESMFMKFILE} diff --git a/modulefiles/envmodules_intel.wcoss b/modulefiles/envmodules_intel.wcoss new file mode 100644 index 00000000..9f0662ad --- /dev/null +++ b/modulefiles/envmodules_intel.wcoss @@ -0,0 +1,28 @@ +#!/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 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} diff --git a/modulefiles/envmodules_pgi.cheyenne b/modulefiles/envmodules_pgi.cheyenne new file mode 100644 index 00000000..ecc1c9f0 --- /dev/null +++ b/modulefiles/envmodules_pgi.cheyenne @@ -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} diff --git a/modulefiles/envmodules_pgi.gaea b/modulefiles/envmodules_pgi.gaea new file mode 100644 index 00000000..b3f09057 --- /dev/null +++ b/modulefiles/envmodules_pgi.gaea @@ -0,0 +1,31 @@ +#!/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 +#---------- + +#################### +### (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} diff --git a/modulefiles/envmodules_pgi.hera b/modulefiles/envmodules_pgi.hera new file mode 100644 index 00000000..ecc1c9f0 --- /dev/null +++ b/modulefiles/envmodules_pgi.hera @@ -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} diff --git a/modulefiles/envmodules_pgi.jet b/modulefiles/envmodules_pgi.jet new file mode 100644 index 00000000..ecc1c9f0 --- /dev/null +++ b/modulefiles/envmodules_pgi.jet @@ -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} diff --git a/modulefiles/envmodules_pgi.linux b/modulefiles/envmodules_pgi.linux new file mode 100644 index 00000000..e0e25e47 --- /dev/null +++ b/modulefiles/envmodules_pgi.linux @@ -0,0 +1,27 @@ +#!/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 pgi impi +#module load szip hdf5 +#module load netcdf + +#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} diff --git a/modulefiles/envmodules_pgi.macosx b/modulefiles/envmodules_pgi.macosx new file mode 100644 index 00000000..e0e25e47 --- /dev/null +++ b/modulefiles/envmodules_pgi.macosx @@ -0,0 +1,27 @@ +#!/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 pgi impi +#module load szip hdf5 +#module load netcdf + +#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} diff --git a/modulefiles/envmodules_pgi.orion b/modulefiles/envmodules_pgi.orion new file mode 100644 index 00000000..437d2940 --- /dev/null +++ b/modulefiles/envmodules_pgi.orion @@ -0,0 +1,27 @@ +#!/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 pgi impi +module load szip hdf5 +module load netcdf + +module load esmf + + +#################### +### (2) Set some environments varaiables related to the loaded +### modules and required to compile the NEMS application properly. + +export HDF5HOME=${HDF5_ROOT} +export NETCDFHOME=${NETCDF_ROOT} + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDF_INCLUDE_DIRS} +export NETCDF_LIBDIR=${NETCDF_LIBRARY_DIRS} + +export ESMFMKFILE=${ESMFMKFILE} diff --git a/modulefiles/envmodules_pgi.stampede b/modulefiles/envmodules_pgi.stampede new file mode 100644 index 00000000..1effcc1e --- /dev/null +++ b/modulefiles/envmodules_pgi.stampede @@ -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 hdf5 +module load netcdf + +module use /work/07380/panvel/Modules/modulefiles +module load impi-intel/esmf-8.0.1 + + +#################### +### (2) Set some environments varaiables related to the loaded +### modules and required to compile the NEMS application properly. + +export HDF5HOME=${TACC_HDF5_DIR} +export NETCDFHOME=${TACC_NETCDF_DIR} + +export NETCDF_CONFIG=${TACC_NETCDF_BIN}/nc-config +export NETCDF_INCDIR=${TACC_NETCDF_INC} +export NETCDF_LIBDIR=${TACC_NETCDF_LIB} + +export ESMFMKFILE=${ESMFMKFILE} diff --git a/modulefiles/envmodules_pgi.wcoss b/modulefiles/envmodules_pgi.wcoss new file mode 100644 index 00000000..93b0c6d4 --- /dev/null +++ b/modulefiles/envmodules_pgi.wcoss @@ -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} diff --git a/modulefiles/ndcrc/ESMF_NUOPC b/modulefiles/ndcrc/ESMF_NUOPC new file mode 100644 index 00000000..4a0644de --- /dev/null +++ b/modulefiles/ndcrc/ESMF_NUOPC @@ -0,0 +1,23 @@ +#%Module ###################################################################### + +# This script is responsible for loading modules that are compatible with +# the NUOPC Layer version used in NEMS. + +#module load intel/18.0.5.274 +#module load szip/2.1 +#module load hdf5/1.10.4 +#module load impi/2018.0.4 +#module load netcdf/4.6.1 + +which module + +module load mvapich2 +module load netcdf + +# Environment for ESMF v8.0.0 beta snapshot 48g +#module use /home/emc.nemspara/SOFT-hera/modulefiles +#module load esmf/8.0.0bs48g +# +module use -a /afs/crc.nd.edu/user/d/dwirasae/privatemodules +module load esmf/8.0 + diff --git a/modulefiles/ndcrc/coastal_app b/modulefiles/ndcrc/coastal_app new file mode 100755 index 00000000..bdb5d3e8 --- /dev/null +++ b/modulefiles/ndcrc/coastal_app @@ -0,0 +1,39 @@ +#%Module###################################################################### +## +## NEMS coastal_app Prerequisites: hera + +##### rem by saeed ### proc ModulesHelp {} { +##### rem by saeed ### puts stderr "\tcit - loads modules required for building and running FV3 under NEMS on Theia" +##### rem by saeed ### } + +##### rem by saeed ### module-whatis "loads NEMS FV3 prerequisites for Theia" + +# NOTE: the "module purge" and loading of the module command are +# handled by the module-setup.sh (or .csh) script. + +## +## load programming environment +## this typically includes compiler, MPI and job scheduler +## + +module load intel/18.0.5.274 +module load szip/2.1 +module load hdf5/1.10.4 +module load impi/2018.0.4 +module load netcdf/4.6.1 + +#This below library is for esmf 8.0 on Hera, compiled and tested successfully for NWM-NUOPC CAP +#module use /home/emc.nemspara/SOFT-hera/modulefiles + +# for current NEMS +module load esmf/7.1.0r + + +#module use /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles +#module load w3nco/v2.0.6 +#module load w3emc/v2.0.5 + + + + + From ef6992e0ff868e50b86f0104e8ea1c12be03f43d Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Fri, 5 Mar 2021 20:38:18 +0000 Subject: [PATCH 04/21] use specific module version and build of impi and ESMF --- modulefiles/envmodules_intel.hera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modulefiles/envmodules_intel.hera b/modulefiles/envmodules_intel.hera index eee86378..fef3aa2b 100644 --- a/modulefiles/envmodules_intel.hera +++ b/modulefiles/envmodules_intel.hera @@ -6,7 +6,7 @@ #################### ### (1) Load all needed environment modules. module purge -module load intel impi +module load intel impi/2018.0.4 module load szip hdf5 module load netcdf From afa15f82b7ee55a022920f0c46e8aa7ae4286599 Mon Sep 17 00:00:00 2001 From: "zachary.burnett" Date: Mon, 15 Mar 2021 14:13:39 -0400 Subject: [PATCH 05/21] remove submodules to add them again (reset) --- ADCIRC | 1 - ATMESH | 1 - NEMS | 1 - NWM | 1 - WW3 | 1 - WW3DATA | 1 - 6 files changed, 6 deletions(-) delete mode 160000 ADCIRC delete mode 160000 ATMESH delete mode 160000 NEMS delete mode 160000 NWM delete mode 160000 WW3 delete mode 160000 WW3DATA diff --git a/ADCIRC b/ADCIRC deleted file mode 160000 index 6a43e9f1..00000000 --- a/ADCIRC +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6a43e9f1299e311283d9115e4dd35c0e24aafced diff --git a/ATMESH b/ATMESH deleted file mode 160000 index 98be19ce..00000000 --- a/ATMESH +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 98be19cebfb95ff65705debf7da4171cd26485e5 diff --git a/NEMS b/NEMS deleted file mode 160000 index 09afb76b..00000000 --- a/NEMS +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 09afb76b58d796e46483a0fea70871e98bfc34c4 diff --git a/NWM b/NWM deleted file mode 160000 index 3bc401d2..00000000 --- a/NWM +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3bc401d298070515cb6171a585d2d19646afd650 diff --git a/WW3 b/WW3 deleted file mode 160000 index 60610eb5..00000000 --- a/WW3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 60610eb5f7a79b8d8bf41a02f078a691bf0506c8 diff --git a/WW3DATA b/WW3DATA deleted file mode 160000 index ea2eb49c..00000000 --- a/WW3DATA +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ea2eb49c2b5c9cd6cbc7f34227fec85d2a421d19 From 0d173bb7bbaec6bdc838d67ec1024688a6b03b28 Mon Sep 17 00:00:00 2001 From: "zachary.burnett" Date: Mon, 15 Mar 2021 14:25:30 -0400 Subject: [PATCH 06/21] update submodules to point to new pull request commits --- .gitmodules | 12 ++++++------ ADCIRC | 1 + ATMESH | 1 + NEMS | 1 + NWM | 1 + WW3 | 1 + WW3DATA | 1 + 7 files changed, 12 insertions(+), 6 deletions(-) create mode 160000 ADCIRC create mode 160000 ATMESH create mode 160000 NEMS create mode 160000 NWM create mode 160000 WW3 create mode 160000 WW3DATA diff --git a/.gitmodules b/.gitmodules index c21b87e1..53771378 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,24 +1,24 @@ [submodule "ATMESH"] path = ATMESH - url = https://github.com/moghimis/ATMESH + url = https://github.com/noaa-ocs-modeling/ATMESH.git branch = master [submodule "WW3DATA"] path = WW3DATA - url = https://github.com/moghimis/WW3DATA + url = https://github.com/noaa-ocs-modeling/WW3DATA.git branch = master [submodule "WW3"] path = WW3 - url = https://github.com/awest-noaa/WW3.git + url = https://github.com/noaa-ocs-modeling/WW3.git branch = nuopc_unstruc [submodule "NEMS"] path = NEMS - url = https://github.com/moghimis/NEMS + url = https://github.com/noaa-ocs-modeling/NEMS.git branch = develop [submodule "ADCIRC"] path = ADCIRC - url = https://github.com/moghimis/adcirc-cg.git + url = https://github.com/adcirc/adcirc-cg.git branch = master [submodule "NWM"] path = NWM - url = https://github.com/trimbleava/nwm_public_nuopc.git + url = https://github.com/noaa-ocs-modeling/nwm_public_nuopc.git branch = master diff --git a/ADCIRC b/ADCIRC new file mode 160000 index 00000000..69cabdf0 --- /dev/null +++ b/ADCIRC @@ -0,0 +1 @@ +Subproject commit 69cabdf05c8a2a8eb7eb56c7984c66a5021944b5 diff --git a/ATMESH b/ATMESH new file mode 160000 index 00000000..da054839 --- /dev/null +++ b/ATMESH @@ -0,0 +1 @@ +Subproject commit da054839ce8277049413bcdcd84a98952095952c diff --git a/NEMS b/NEMS new file mode 160000 index 00000000..6c46179e --- /dev/null +++ b/NEMS @@ -0,0 +1 @@ +Subproject commit 6c46179efbf8d4f0f56b82298853c94baf2e8c18 diff --git a/NWM b/NWM new file mode 160000 index 00000000..8d26faf5 --- /dev/null +++ b/NWM @@ -0,0 +1 @@ +Subproject commit 8d26faf58854a3c43c091128ada7fba43eeb4bf6 diff --git a/WW3 b/WW3 new file mode 160000 index 00000000..aceedbb2 --- /dev/null +++ b/WW3 @@ -0,0 +1 @@ +Subproject commit aceedbb2d1720e5d3c80e07ad804d1472587711e diff --git a/WW3DATA b/WW3DATA new file mode 160000 index 00000000..beda5f2e --- /dev/null +++ b/WW3DATA @@ -0,0 +1 @@ +Subproject commit beda5f2eab6bf670991ad970fc064e0a80584f0a From 8e4a3a70170971f88b585ff4cbf440c3d4dd9263 Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Mon, 15 Mar 2021 14:40:05 -0400 Subject: [PATCH 07/21] update NWM and WW3 on linux file system --- NWM | 2 +- WW3 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NWM b/NWM index 8d26faf5..3bc401d2 160000 --- a/NWM +++ b/NWM @@ -1 +1 @@ -Subproject commit 8d26faf58854a3c43c091128ada7fba43eeb4bf6 +Subproject commit 3bc401d298070515cb6171a585d2d19646afd650 diff --git a/WW3 b/WW3 index aceedbb2..60610eb5 160000 --- a/WW3 +++ b/WW3 @@ -1 +1 @@ -Subproject commit aceedbb2d1720e5d3c80e07ad804d1472587711e +Subproject commit 60610eb5f7a79b8d8bf41a02f078a691bf0506c8 From e947a2530af8b5fe0b6c34352467d84c77160561 Mon Sep 17 00:00:00 2001 From: "zachary.burnett" Date: Tue, 16 Mar 2021 10:28:24 -0400 Subject: [PATCH 08/21] update README.md --- README.md | 203 +++++++++++++++++++++++++++++------------------------- 1 file changed, 110 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index 282a3548..ac251fe2 100644 --- a/README.md +++ b/README.md @@ -1,101 +1,118 @@ -## ADC-WW3-NWM-NEMS - -ADC-WW3-NWM-NEMS is an ESMF application developed as part of the Coastal Act -coupling project to determine wind versus water percentage loss caused by a -Named Storm Event. - -## Cloning - git clone --recursive https://github.com/moghimis/ADC-WW3-NWM-NEMS +# ADC-WW3-NWM-NEMS + +ESMF application for building a NUOPC / NEMS application coupling ADCIRC, ATMESH, WW3 / WW3DATA, and NWM. + +`ADC-WW3-NWM-NEMS` was developed as part of the Coastal Act to help determination of wind versus water percentage loss caused +by a Named Storm Event. + +```bash +git clone --recursive https://github.com/noaa-ocs-modeling/ADC-WW3-NWM-NEMS +cd ADC-WW3-NWM-NEMS +``` + +## Compilation + +```bash +./build.sh --component "ADCIRC ATMESH WW3DATA" --plat hera --compiler intel --clean -2 +``` + +- `--component` can be any combination of + - `ADCIRC` + - `ATMESH` + - `WW3` / `WW3DATA` + - `NWM` +- `--plat` can be any combination of + - `cheyenne` + - `gaea` + - `hera` + - `jet` + - `linux` + - `macosx` + - `orion` + - `stampede` + - `wcoss` +- `--compiler` can be one of + - `intel` + - `gnu` + - `pgi` +- `--clean` is optional, and can be one of + - `1` (`make clean`, default) + - `2` (`make distclean`) + - `-1` (`make clean` then build) + - `-2` (`make distclean` then build) + +#### adding a new platform / compiler to compilation script + +Environment files are stored in `modulefiles/` with the filename `envmodules_.` + +To compile in your own system you should create a similar file, then run `build.sh` to compile. ## Requirements -### Install ParMETIS - -Unstructured WW3 requires an installation of ParMETIS for domain decomposition. Download the code from this [link](http://glaros.dtc.umn.edu/gkhome/metis/parmetis/download) - -To build ParMETIS: - - module purge - - module load intel impi - - setenv CFLAGS -fPIC - - make config cc=mpiicc cxx=mpiicc prefix=/path/to/your/parmetis/ | & tee config.out-rr - - make install | & tee make-install.out-rr - -This adds `libparmetis.a` under `/path/to/your/parmetis/lib/libparmetis.a` - -Set the path to ParMETIS: - - setenv METIS_PATH /path/to/your/parmetis - -### Set module files based on your HPC - -For a list of additional requirements and versions, see: - - modulefiles/hera/ESMF_NUOPC - - -## Compile - -Set the following environment variable: - -- `ROOTDIR`: The directory of your choice where the repository has been cloned - -In the build script `build.sh`, select desired components for which to build the app, e.g.: - - make -f GNUmakefile build COMPONENTS="ADCIRC WW3 ATMESH" - -Execute the build script: - - ./build.sh - +#### installing ParMETIS for WW3 + +Using unstructured WW3 requires an installation of ParMETIS for domain decomposition. + +1. [download the code here](http://glaros.dtc.umn.edu/gkhome/metis/parmetis/download) +2. build ParMETIS + ```bash + module purge + module load intel impi + setenv CFLAGS -fPIC + make config cc=mpiicc cxx=mpiicc prefix=/path/to/your/parmetis/ | & tee config.out-rr + make install | & tee make-install.out-rr + ``` + This adds `libparmetis.a` under `/path/to/your/parmetis/lib/libparmetis.a`. +3. set the path to ParMETIS + ```bash + setenv METIS_PATH /path/to/your/parmetis + ``` ## Collaboration To collaborate and contribute to this repository follow below instructions: -While in github GUI, https://github.com/moghimis/ADC-WW3-NWM-NEMS: - -1) Hit the "Fork" button located on the upper right corner of the GUI in order - to have your own copy of this repository into your own github repository. -2) Your github username displays with a message "Where should we fork ..." . - Click on your username to fork it into your account. -3) You should see the source codes in your own github repository with the same - name as the forked reopsitory. - -Next you should create your local version of your forked repository. -Go to your local directoy and clone the the repository: - -1) git clone --recursive https://github.com//ADC-WW3-NWM-NEMS -2) do your collaboration edition and when finished -3) git add . -4) git commit -m "describe what you changed" -5) git push origin master - to push your changes into your github -6) enter your github username/password if asked - -While in your github repository GUI: - -1) push the "New pull request" button -2) hit the "Create pull request" button -3) the request goes to originated repository, where your changes are reviewed and - merged or rejected. - -### Setup and compilation - -This application contains a module file tailored for the intended computer system. -To compile in your own system you should create a similar file. The setup module -file, is located at modulefile/hera/ESMF_NUOPC. Also, for your convenience there -is a "HOWTO" that explains in detail about the usage of this application. - - -## Cite - -Moghimi, S.; Van der Westhuysen, A.; Abdolali, A.; Myers, E.; Vinogradov, S.; Ma, Z.; Liu, F.; Mehra, A.; Kurkowski, N. Development of an ESMF Based Flexible Coupling Application of ADCIRC and WAVEWATCH III for High Fidelity Coastal Inundation Studies. J. Mar. Sci. Eng. 2020, 8, 308. https://doi.org/10.3390/jmse8050308 - -Development of a Flexible Coupling Framework for Coastal Inundation Studies, 2020 S Moghimi, A van der Westhuysen, A Abdolali, E Myers, S Vinogradov -https://arxiv.org/abs/2003.12652 - -Development of a Flexible Coupling Interface for ADCIRC Model for Coastal Inundation Studies, 2019 Saeed Moghimi, Sergey Vinogradov, Edward P Myers, Yuji Funakoshi, Andre J Van der Westhuysen, Ali Abdolali, Zaizhong Ma, Fei Liu https://repository.library.noaa.gov/view/noaa/20609/ +1. go to https://github.com/noaa-ocs-modeling/ADC-WW3-NWM-NEMS +2. create a fork (click `Fork` on the upper right corner), and fork to your account. +3. clone your forked repository + ```bash + git clone --recursive https://github.com//ADC-WW3-NWM-NEMS + ``` +4. edit the files locally + ```bash + git status + ``` +5. commit changes + ```bash + git commit -a -m "describe what you changed" + ``` +6. push your changes to GitHub + ```bash + git push + ``` +7. enter your GitHub username/password if asked +8. create a pull request with descriptions of changes at + ``` + https://github.com/noaa-ocs-modeling/ADC-WW3-NWM-NEMS/compare/...: + ``` + +## Citations + +``` +Moghimi, S., Van der Westhuysen, A., Abdolali, A., Myers, E., Vinogradov, S., + Ma, Z., Liu, F., Mehra, A., & Kurkowski, N. (2020). Development of an ESMF + Based Flexible Coupling Application of ADCIRC and WAVEWATCH III for High + Fidelity Coastal Inundation Studies. Journal of Marine Science and + Engineering, 8(5), 308. https://doi.org/10.3390/jmse8050308 + +Moghimi, S., Vinogradov, S., Myers, E. P., Funakoshi, Y., Van der Westhuysen, + A. J., Abdolali, A., Ma, Z., & Liu, F. (2019). Development of a Flexible + Coupling Interface for ADCIRC model for Coastal Inundation Studies. NOAA + Technical Memorandum, NOS CS(41). + https://repository.library.noaa.gov/view/noaa/20609/ + +Moghimi, S., Westhuysen, A., Abdolali, A., Myers, E., Vinogradov, S., Ma, Z., + Liu, F., Mehra, A., & Kurkowski, N. (2020). Development of a Flexible + Coupling Framework for Coastal Inundation Studies. + https://arxiv.org/abs/2003.12652 +``` From a856501fa0226fe446f4a47ce30fe3c569c58b46 Mon Sep 17 00:00:00 2001 From: "zachary.burnett" Date: Tue, 16 Mar 2021 10:29:01 -0400 Subject: [PATCH 09/21] remove old files --- HOWTO.rej | 16 -- build.sh-orig | 43 ------ build.sh.orig | 214 --------------------------- build.sh.rej | 252 -------------------------------- compile-NEMS.x.txt.old | 33 ----- modulefiles/hera/ESMF_NUOPC | 17 --- modulefiles/hera/coastal_app | 39 ----- modulefiles/ndcrc/ESMF_NUOPC | 23 --- modulefiles/ndcrc/coastal_app | 39 ----- modulefiles/theia/theia_modules | 41 ------ 10 files changed, 717 deletions(-) delete mode 100644 HOWTO.rej delete mode 100644 build.sh-orig delete mode 100755 build.sh.orig delete mode 100644 build.sh.rej delete mode 100644 compile-NEMS.x.txt.old delete mode 100644 modulefiles/hera/ESMF_NUOPC delete mode 100755 modulefiles/hera/coastal_app delete mode 100644 modulefiles/ndcrc/ESMF_NUOPC delete mode 100755 modulefiles/ndcrc/coastal_app delete mode 100755 modulefiles/theia/theia_modules diff --git a/HOWTO.rej b/HOWTO.rej deleted file mode 100644 index c60c4ca8..00000000 --- a/HOWTO.rej +++ /dev/null @@ -1,16 +0,0 @@ ---- HOWTO 2020-12-01 01:08:10.000000000 -0600 -+++ HOWTO 2020-12-09 22:33:55.671362895 -0600 -@@ -1,3 +1,5 @@ -+Modified: Panagiotis Velissariou - 12/05/2020 -+ - ================================== - Coastal Act Team - 9/13/2019 - -@@ -591,7 +593,6 @@ - - - env_file=$(NWM_SRCDIR)/setEnvar.sh --esmf_env=$(NWM_SRCDIR)/esmf-impi-env.sh - comp_opt=3 - - # HOW to source env here?? diff --git a/build.sh-orig b/build.sh-orig deleted file mode 100644 index 41e309aa..00000000 --- a/build.sh-orig +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Description : Script to compile NSEModel NEMS application -# Usage : ./build.sh -# Date : Feb 27, 2020 -# Contact : moghimis@gmail.com - -# Check for env variables -if [ "${ROOTDIR}" == "" ] - then - echo "ERROR - Your ROOTDIR environment variable is not set" - exit 1 -fi -if [ "${METIS_PATH}" == "" ] - then - echo "ERROR - Your METIS_PATH environment variable for WW3 is not set" - exit 1 -else - echo "METIS_PATH set to ${METIS_PATH}" -fi - -# Load modules -source ${ROOTDIR}/modulefiles/hera/ESMF_NUOPC -module list - -echo "Building NEMS app in ${ROOTDIR}/NEMS" -cd ${ROOTDIR}/NEMS - -# Clean up -make -f GNUmakefile distclean_ADCIRC COMPONENTS="ADCIRC" -make -f GNUmakefile distclean_WW3DATA COMPONENTS="WW3DATA" -make -f GNUmakefile distclean_ATMESH COMPONENTS="ATMESH" -make -f GNUmakefile distclean_WW3 COMPONENTS="WW3" -make -f GNUmakefile distclean_NWM COMPONENTS="NWM" -make -f GNUmakefile distclean_NEMS COMPONENTS="ADCIRC WW3 NWM ATMESH" - -# Make coupled NEMS app -#make -f GNUmakefile build COMPONENTS="ADCIRC NWM ATMESH" -#make -f GNUmakefile build COMPONENTS="ADCIRC WW3 ATMESH" -#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH WW3 NWM" -#make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" -#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH NWM" -make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH NWM" diff --git a/build.sh.orig b/build.sh.orig deleted file mode 100755 index e0f7132b..00000000 --- a/build.sh.orig +++ /dev/null @@ -1,214 +0,0 @@ -#!/bin/bash - -########################################################################### -### Author: Panagiotis Velissariou -### -### Version - 1.0 Fri Dec 04 2020 -########################################################################### - - -###==================== -# Make sure that the current working directory is in the PATH -[[ ! :$PATH: == *:".":* ]] && export PATH="${PATH}:." - - -# Get the directory where the script is located -scrNAME="${BASH_SOURCE[0]}" -if [[ $(uname -s) == Darwin ]]; then -# readonly scrDIR="$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" - readonly scrDIR="$(cd "$(dirname "$(grealpath -s "${scrNAME}" )" )" && pwd -P)" -else -# readonly scrDIR="$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" - readonly scrDIR="$(cd "$(dirname "$(realpath -s "${scrNAME}")" )" && pwd -P)" -fi - -funcs="$( find ${scrDIR} -type f -name "functions_build" | head -n 1 )" -if [ -f "${funcs}" ]; then - source "${funcs}" -else - echo " ### ERROR :: in ${scrNAME}" - echo " Cannot load the required file: ${funcs}" - echo " Exiting now ..." - echo - exit 1 -fi - -unset funcs -###==================== - - -######### -# Call ParseArgs to get the user input. -ParseArgs "${@}" - - -########## -# Set the variables for this script -CLEAN=${MY_CLEAN:-0} - -[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "${MY_COMPILER}" )" - -[ -n "${MY_COMPONENT:+1}" ] && COMPONENT="${MY_COMPONENT}" - -[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" - -[ "${MY_PARMAKE:0}" -gt 1 ] && PARMAKE=${MY_PARMAKE} - -[ -n "${MY_PLATFORM:+1}" ] && PLATFORM="$( toLOWER "${MY_PLATFORM}" )" - -[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" - -[ -n "${MY_VERBOSE:+1}" ] && VERBOSE="$( toLOWER "${MY_VERBOSE}" )" - -mod_file="envmodules${COMPILER:+_${COMPILER}}${PLATFORM:+.${PLATFORM}}" - -if [ -n "${COMPONENT:+1}" ]; then - comp_fname="$( strTrim "$( toLOWER "${COMPONENT}" )" )" - comp_fname="$( echo "${comp_fname}" | sed 's/ /_/g' )" -fi -########## - - -########## -# Get the project directories and perform a basic check on them -readonly nemsDIR="${NEMS_DIR:-${scrDIR}/NEMS}" -if [ ! -f "${nemsDIR}/NEMSAppBuilder" ]; then - echo "The project directory \"${nemsDIR}\" does not appear to contain NEMSAppBuilder." - echo "Is this the correct NEMS directory?" - echo "You might need to set the environment variable NEMS_DIR before running this script." - echo "Exiting ..." - exit 1 -fi - -readonly modsDIR="${NEMSMODS_DIR:-${scrDIR}/modulefiles}" -if [ ! -f "${modsDIR}/${mod_file}" ]; then - echo "The modulefiles directory \"${modsDIR}\" does not appear to contain module: ${mod_file}." - echo "Is this the correct modulefiles directory?" - echo "You might need to set the environment variable NEMSMODS_DIR before running this script." - echo "Exiting ..." - exit 1 -fi -########## - - -########## -# If the user requested to clean the build folder, do the cleaning end exit -if [ ${CLEAN:-0} -ge 1 ]; then - echo "User requested to only clean the project. Cleaning ..." - - pushd ${nemsDIR} >/dev/null 2>&1 - [ ${CLEAN:-0} -eq 1 ] && compileNems clean - [ ${CLEAN:-0} -eq 2 ] && compileNems distclean - popd >/dev/null 2>&1 - - exit 0 -fi -########## - - -########## -# Export some environment variables for NEMS -export NEMS_COMPILER=${COMPILER} - -# Source the environment module -source ${modsDIR}/${mod_file} - -component_ww3=":$( echo "${COMPONENT}" | sed 's/ /:/g' ):" -if [[ :$component_ww3: == *:"WW3":* ]]; then - if [ -z "${METIS_PATH}" ]; then - echo "ERROR :: The METIS_PATH environment variable for WW3 is not set." - echo " Set the METIS_PATH environment variable before running this script:" - echo " METIS_PATH=\"path_to_compiled_metis\"" - echo "Exiting ..." - exit 1 - else - export METIS_PATH="${METIS_PATH}" - fi - export WW3_COMP="${COMPILER}" -fi - -########## - - -########## -# Get a final user response for the variables -echo -echo "The following variables are defined:" -echo " CLEAN = ${CLEAN}" -echo " COMPILER = ${COMPILER:-Undefined, Supported values are: [${MY_COMPILING_SYTEMS}]}" -echo " NEMS_COMPILER = ${NEMS_COMPILER}" -echo " WW3_COMP = ${WW3_COMP}" -echo " COMPONENTS = ${COMPONENT:-Undefined, Supported values are: [${MY_COMPONENT_LIST}]}" -echo " OS = ${OS}" -echo " PLATFORM = ${PLATFORM}" -echo " VERBOSE = ${VERBOSE}" -echo -echo " METIS_PATH = ${METIS_PATH}" -echo " HDF5HOME = ${HDF5HOME}" -echo " NETCDFHOME = ${NETCDFHOME}" -echo " NETCDF_INCDIR = ${NETCDF_INCDIR}" -echo " NETCDF_LIBDIR = ${NETCDF_LIBDIR}" -echo -echo " ESMFMKFILE = ${ESMFMKFILE}" -echo - -module list - -echo_response= -while [ -z "${echo_response}" ] ; do - echo -n "Are these values correct? [y/n]: " - read echo_response - echo_response="$( getYesNo "${echo_response}" )" -done - -if [ "${echo_response:-no}" = "no" ]; then - echo - echo "User responded: ${echo_response}" - echo "Exiting now ..." - echo - exit 1 -fi - -unset echo_response -########## - - -############################################################ -### START THE CALCULATIONS -############################################################ - -########## -# Compile the project -pushd ${nemsDIR} >/dev/null 2>&1 - case ${CLEAN:-0} in - -1 ) - compileNems clean - err=$? - ;; - -2 ) - compileNems distclean - err=$? - ;; - -3 ) - compileNems noclean - err=$? - ;; - * ) - compileNems clean - err=$? - ;; - esac - - if [ ${err} -eq 0 ]; then - compileNems build - err=$? - fi - - if [ ${err} -eq 0 ]; then - if [ -f exe/NEMS.x ]; then - cp -p exe/NEMS.x exe/NEMS${comp_fname:+-${comp_fname}}.x - fi - fi -popd >/dev/null 2>&1 - -exit 0 diff --git a/build.sh.rej b/build.sh.rej deleted file mode 100644 index 73467255..00000000 --- a/build.sh.rej +++ /dev/null @@ -1,252 +0,0 @@ ---- build.sh 2020-12-04 14:36:35.000000000 -0600 -+++ build.sh 2020-12-09 22:32:32.779825479 -0600 -@@ -1,43 +1,214 @@ - #!/bin/bash - --# Description : Script to compile NSEModel NEMS application --# Usage : ./build.sh --# Date : Feb 27, 2020 --# Contact : moghimis@gmail.com -- --# Check for env variables --if [ "${ROOTDIR}" == "" ] -- then -- echo "ERROR - Your ROOTDIR environment variable is not set" -- exit 1 --fi --if [ "${METIS_PATH}" == "" ] -- then -- echo "ERROR - Your METIS_PATH environment variable for WW3 is not set" -- exit 1 -+########################################################################### -+### Author: Panagiotis Velissariou -+### -+### Version - 1.0 Fri Dec 04 2020 -+########################################################################### -+ -+ -+###==================== -+# Make sure that the current working directory is in the PATH -+[[ ! :$PATH: == *:".":* ]] && export PATH="${PATH}:." -+ -+ -+# Get the directory where the script is located -+scrNAME="${BASH_SOURCE[0]}" -+if [[ $(uname -s) == Darwin ]]; then -+# readonly scrDIR="$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" -+ readonly scrDIR="$(cd "$(dirname "$(grealpath -s "${scrNAME}" )" )" && pwd -P)" - else -- echo "METIS_PATH set to ${METIS_PATH}" -+# readonly scrDIR="$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" -+ readonly scrDIR="$(cd "$(dirname "$(realpath -s "${scrNAME}")" )" && pwd -P)" - fi - --# Load modules --source ${ROOTDIR}/modulefiles/hera/ESMF_NUOPC -+funcs="$( find ${scrDIR} -type f -name "functions_build" | head -n 1 )" -+if [ -f "${funcs}" ]; then -+ source "${funcs}" -+else -+ echo " ### ERROR :: in ${scrNAME}" -+ echo " Cannot load the required file: ${funcs}" -+ echo " Exiting now ..." -+ echo -+ exit 1 -+fi -+ -+unset funcs -+###==================== -+ -+ -+######### -+# Call ParseArgs to get the user input. -+ParseArgs "${@}" -+ -+ -+########## -+# Set the variables for this script -+CLEAN=${MY_CLEAN:-0} -+ -+[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "${MY_COMPILER}" )" -+ -+[ -n "${MY_COMPONENT:+1}" ] && COMPONENT="$( toUPPER "${MY_COMPONENT}" )" -+ -+[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" -+ -+[ "${MY_PARMAKE:0}" -gt 1 ] && PARMAKE=${MY_PARMAKE} -+ -+[ -n "${MY_PLATFORM:+1}" ] && PLATFORM="$( toLOWER "${MY_PLATFORM}" )" -+ -+[ -n "${MY_VERBOSE:+1}" ] && VERBOSE="$( toLOWER "${MY_VERBOSE}" )" -+ -+modFILE="envmodules${COMPILER:+_${COMPILER}}${PLATFORM:+.${PLATFORM}}" -+ -+# Customize the NEMS.x filename to include the component names -+if [ -n "${COMPONENT:+1}" ]; then -+ compFNAME="$( strTrim "$( toLOWER "${COMPONENT}" )" )" -+ compFNAME="$( echo "${compFNAME}" | sed 's/ /_/g' )" -+fi -+ -+# Export some environment variables for NEMS -+export NEMS_COMPILER=${COMPILER} -+########## -+ -+ -+########## -+# Get the project directories and perform a basic check on them -+readonly nemsDIR="${NEMS_DIR:-${scrDIR}/NEMS}" -+if [ ! -f "${nemsDIR}/NEMSAppBuilder" ]; then -+ echo "The project directory \"${nemsDIR}\" does not appear to contain NEMSAppBuilder." -+ echo "Is this the correct NEMS directory?" -+ echo "You might need to set the environment variable NEMS_DIR before running this script." -+ echo "Exiting ..." -+ exit 1 -+fi -+ -+readonly modDIR="${NEMSMODS_DIR:-${scrDIR}/modulefiles}" -+if [ ! -f "${modDIR}/${modFILE}" ]; then -+ echo "The modulefiles directory \"${modDIR}\" does not appear to contain module: ${modFILE}." -+ echo "Is this the correct modulefiles directory?" -+ echo "You might need to set the environment variable NEMSMODS_DIR before running this script." -+ echo "Exiting ..." -+ exit 1 -+fi -+########## -+ -+ -+########## -+# If the user requested to clean the build folder, do the cleaning end exit -+if [ ${CLEAN:-0} -ge 1 ]; then -+ echo "User requested to only clean the project. Cleaning ..." -+ -+ pushd ${nemsDIR} >/dev/null 2>&1 -+ [ ${CLEAN:-0} -eq 1 ] && compileNems clean -+ [ ${CLEAN:-0} -eq 2 ] && compileNems distclean -+ popd >/dev/null 2>&1 -+ -+ exit 0 -+fi -+########## -+ -+ -+########## -+# Source the environment module -+source ${modDIR}/${modFILE} -+ -+component_ww3="$( echo "${COMPONENT}" | sed 's/ /:/g' )" -+if [[ :${component_ww3}: == *:"WW3":* ]]; then -+ export WW3_CONFOPT="${COMPILER}" -+ export WW3_COMP="${COMPILER}" -+ export WWATCH3_NETCDF=NC4 -+fi -+########## -+ -+ -+########## -+# Get a final user response for the variables -+echo -+echo "The following variables are defined:" -+echo " CLEAN = ${CLEAN}" -+echo " COMPILER = ${COMPILER:-Undefined, Supported values are: [${MY_COMPILING_SYTEMS}]}" -+echo " NEMS_COMPILER = ${NEMS_COMPILER}" -+if [[ :${component_ww3}: == *:"WW3":* ]]; then -+ echo " WW3_CONFOPT = ${WW3_CONFOPT}" -+ echo " WW3_COMP = ${WW3_COMP}" -+ echo " WWATCH3_NETCDF = ${WWATCH3_NETCDF}" -+fi -+echo " COMPONENTS = ${COMPONENT:-Undefined, Supported values are: [${MY_COMPONENT_LIST}]}" -+echo " OS = ${OS}" -+echo " PLATFORM = ${PLATFORM}" -+echo " VERBOSE = ${VERBOSE}" -+echo -+echo " HDF5HOME = ${HDF5HOME}" -+echo " NETCDFHOME = ${NETCDFHOME}" -+echo " NETCDF_INCDIR = ${NETCDF_INCDIR}" -+echo " NETCDF_LIBDIR = ${NETCDF_LIBDIR}" -+echo -+echo " ESMFMKFILE = ${ESMFMKFILE}" -+echo -+ - module list - --echo "Building NEMS app in ${ROOTDIR}/NEMS" --cd ${ROOTDIR}/NEMS -+echo_response= -+while [ -z "${echo_response}" ] ; do -+ echo -n "Are these values correct? [y/n]: " -+ read echo_response -+ echo_response="$( getYesNo "${echo_response}" )" -+done -+ -+if [ "${echo_response:-no}" = "no" ]; then -+ echo -+ echo "User responded: ${echo_response}" -+ echo "Exiting now ..." -+ echo -+ exit 1 -+fi -+ -+unset echo_response -+########## -+ -+ -+############################################################ -+### START THE CALCULATIONS -+############################################################ -+ -+########## -+# Compile the project -+compileERR=0 -+pushd ${nemsDIR} >/dev/null 2>&1 -+ case ${CLEAN:-0} in -+ -1 ) -+ compileNems clean -+ compileERR=$? -+ ;; -+ -2 ) -+ compileNems distclean -+ compileERR=$? -+ ;; -+ -3 ) -+ compileNems noclean -+ compileERR=$? -+ ;; -+ * ) -+ compileNems clean -+ compileERR=$? -+ ;; -+ esac -+ -+ if [ ${compileERR} -eq 0 ]; then -+ compileNems build -+ compileERR=$? -+ fi -+ -+ if [ ${compileERR} -eq 0 ]; then -+ if [ -f exe/NEMS.x ]; then -+ cp -p exe/NEMS.x exe/NEMS${compFNAME:+-${compFNAME}}.x -+ fi -+ fi -+popd >/dev/null 2>&1 -+ -+########## -+# Install all data, executables, libraries in a common directory -+[ ${compileERR:-0} -eq 0 ] && installNems -+########## - --# Clean up --make -f GNUmakefile distclean_ADCIRC COMPONENTS="ADCIRC" --make -f GNUmakefile distclean_WW3DATA COMPONENTS="WW3DATA" --make -f GNUmakefile distclean_ATMESH COMPONENTS="ATMESH" --make -f GNUmakefile distclean_WW3 COMPONENTS="WW3" --make -f GNUmakefile distclean_NWM COMPONENTS="NWM" --make -f GNUmakefile distclean_NEMS COMPONENTS="ADCIRC WW3 NWM ATMESH" -- --# Make coupled NEMS app --#make -f GNUmakefile build COMPONENTS="ADCIRC NWM ATMESH" --#make -f GNUmakefile build COMPONENTS="ADCIRC WW3 ATMESH" --#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH WW3 NWM" --#make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" --#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH NWM" --make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH NWM" -+exit 0 diff --git a/compile-NEMS.x.txt.old b/compile-NEMS.x.txt.old deleted file mode 100644 index 09bbb45d..00000000 --- a/compile-NEMS.x.txt.old +++ /dev/null @@ -1,33 +0,0 @@ -1) First load all necessary modules -module load intel -module load impi -module load netcdf -module load hdf5 - -module use /work/07380/panvel/Modules/modulefiles -module load impi-intel/esmf-7.1.0r -(OR: module load impi-intel/esmf-8.0.1) - -2) Set the following environment variables: -export NETCDF=${TACC_NETCDF_DIR} -export HDF5=${TACC_HDF5_DIR} -export ESMFMKFILE=/work/07380/panvel/apps/intel/impi/esmf-7.1.0r/lib64/esmf.mk -(OR: export ESMFMKFILE=/work/07380/panvel/apps/intel/impi/esmf-8.0.1/lib64/esmf.mk) - -3) Change directory into the NEMS directory and run make -cd NEMS (if not in the NEMS directory) -make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" - -The executable will be: NEMS/exe/NEMS.x - -To clean the generated files: -cd NEMS (if not in the NEMS directory) -make -f GNUmakefile clean COMPONENTS="ADCIRC WW3DATA ATMESH" - -OR to clean everything: -cd NEMS (if not in the NEMS directory) -make -f GNUmakefile distclean COMPONENTS="ADCIRC WW3DATA ATMESH" - - -Panagiotis Velissariou - 10/18/2020 - diff --git a/modulefiles/hera/ESMF_NUOPC b/modulefiles/hera/ESMF_NUOPC deleted file mode 100644 index 591471f8..00000000 --- a/modulefiles/hera/ESMF_NUOPC +++ /dev/null @@ -1,17 +0,0 @@ -#%Module###################################################################### - -# This script is responsible for loading modules that are compatible with -# the NUOPC Layer version used in NEMS. - -module load intel/18.0.5.274 -module load szip/2.1 -module load hdf5/1.10.4 -module load impi/2018.0.4 -module load netcdf/4.6.1 - -# Environment for ESMF v8.0.0 beta snapshot 48g -module use /home/emc.nemspara/SOFT-hera/modulefiles -module load esmf/8.0.0bs48g -# - -# diff --git a/modulefiles/hera/coastal_app b/modulefiles/hera/coastal_app deleted file mode 100755 index bdb5d3e8..00000000 --- a/modulefiles/hera/coastal_app +++ /dev/null @@ -1,39 +0,0 @@ -#%Module###################################################################### -## -## NEMS coastal_app Prerequisites: hera - -##### rem by saeed ### proc ModulesHelp {} { -##### rem by saeed ### puts stderr "\tcit - loads modules required for building and running FV3 under NEMS on Theia" -##### rem by saeed ### } - -##### rem by saeed ### module-whatis "loads NEMS FV3 prerequisites for Theia" - -# NOTE: the "module purge" and loading of the module command are -# handled by the module-setup.sh (or .csh) script. - -## -## load programming environment -## this typically includes compiler, MPI and job scheduler -## - -module load intel/18.0.5.274 -module load szip/2.1 -module load hdf5/1.10.4 -module load impi/2018.0.4 -module load netcdf/4.6.1 - -#This below library is for esmf 8.0 on Hera, compiled and tested successfully for NWM-NUOPC CAP -#module use /home/emc.nemspara/SOFT-hera/modulefiles - -# for current NEMS -module load esmf/7.1.0r - - -#module use /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles -#module load w3nco/v2.0.6 -#module load w3emc/v2.0.5 - - - - - diff --git a/modulefiles/ndcrc/ESMF_NUOPC b/modulefiles/ndcrc/ESMF_NUOPC deleted file mode 100644 index 4a0644de..00000000 --- a/modulefiles/ndcrc/ESMF_NUOPC +++ /dev/null @@ -1,23 +0,0 @@ -#%Module ###################################################################### - -# This script is responsible for loading modules that are compatible with -# the NUOPC Layer version used in NEMS. - -#module load intel/18.0.5.274 -#module load szip/2.1 -#module load hdf5/1.10.4 -#module load impi/2018.0.4 -#module load netcdf/4.6.1 - -which module - -module load mvapich2 -module load netcdf - -# Environment for ESMF v8.0.0 beta snapshot 48g -#module use /home/emc.nemspara/SOFT-hera/modulefiles -#module load esmf/8.0.0bs48g -# -module use -a /afs/crc.nd.edu/user/d/dwirasae/privatemodules -module load esmf/8.0 - diff --git a/modulefiles/ndcrc/coastal_app b/modulefiles/ndcrc/coastal_app deleted file mode 100755 index bdb5d3e8..00000000 --- a/modulefiles/ndcrc/coastal_app +++ /dev/null @@ -1,39 +0,0 @@ -#%Module###################################################################### -## -## NEMS coastal_app Prerequisites: hera - -##### rem by saeed ### proc ModulesHelp {} { -##### rem by saeed ### puts stderr "\tcit - loads modules required for building and running FV3 under NEMS on Theia" -##### rem by saeed ### } - -##### rem by saeed ### module-whatis "loads NEMS FV3 prerequisites for Theia" - -# NOTE: the "module purge" and loading of the module command are -# handled by the module-setup.sh (or .csh) script. - -## -## load programming environment -## this typically includes compiler, MPI and job scheduler -## - -module load intel/18.0.5.274 -module load szip/2.1 -module load hdf5/1.10.4 -module load impi/2018.0.4 -module load netcdf/4.6.1 - -#This below library is for esmf 8.0 on Hera, compiled and tested successfully for NWM-NUOPC CAP -#module use /home/emc.nemspara/SOFT-hera/modulefiles - -# for current NEMS -module load esmf/7.1.0r - - -#module use /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles -#module load w3nco/v2.0.6 -#module load w3emc/v2.0.5 - - - - - diff --git a/modulefiles/theia/theia_modules b/modulefiles/theia/theia_modules deleted file mode 100755 index bd3ae7b1..00000000 --- a/modulefiles/theia/theia_modules +++ /dev/null @@ -1,41 +0,0 @@ -#%Module###################################################################### -## -## NEMS FV3 Prerequisites: Theia - -##proc ModulesHelp {} { -## puts stderr "\tcit - loads modules required for building and running FV3 under NEMS on Theia" -##} - -##module-whatis "loads NEMS FV3 prerequisites for Theia" - -# NOTE: the "module purge" and loading of the module command are -# handled by the module-setup.sh (or .csh) script. - -## -## load programming environment -## this typically includes compiler, MPI and job scheduler -## -module load intel/15.1.133 -module load impi/5.0.3.048 -module load hdf5 -module load netcdf/4.3.0 -module load esmf/7.0.2 - -## From old NEMS -#source /etc/profile -#module load intel/14.0.2 impi/4.1.3.048 netcdf/4.3.0 -#module use /scratch4/NCEPDEV/nems/save/Gerhard.Theurich/Modulefiles -#module load esmf/7.0.0 -#module use /scratch4/NCEPDEV/nems/save/Daniel.Rosen/Modulefiles/theia -#module load jasper/1.900.1 gribapi/1.12.3 - -## -## load nwprod libraries -## -module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles - -#module load bacio/v2.0.1 -#module load sp/v2.0.2 -#module load ip/v2.0.0 -module load w3nco/v2.0.6 -module load w3emc/v2.0.5 From f5e4fcb098e2508a61c4891f49f7a0a31874c68f Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Wed, 17 Mar 2021 09:28:36 -0400 Subject: [PATCH 10/21] remove buildcrcnd.sh --- buildcrcnd.sh | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100755 buildcrcnd.sh diff --git a/buildcrcnd.sh b/buildcrcnd.sh deleted file mode 100755 index c9fb2030..00000000 --- a/buildcrcnd.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -i - -# Description : Script to compile NSEModel NEMS application -# Usage : ./build.sh -# Date : Feb 27, 2020 -# Contact : moghimis@gmail.com - - -# load modules -#source modulefiles/ndcrc/ESMF_NUOPC - -cd NEMS -curdir=$PWD ; - -echo $curdir -cd $curdir/src ; make clean ; -cd $curdir - -# location of netcdf at ND-CRC -export NETCDF=/opt/crc/n/netcdf/4.7.0/intel/18.0/ -export NETCDFHOME=/opt/crc/n/netcdf/4.7.0/intel/18.0/ - -# location of ESMFMKFILE -export ESMFMKFILE=/pontus/gling/ADC_v55-WW3-NWM-NEMS/esmf_8/DEFAULTINSTALLDIR/lib/libO/Linux.intel.64.mvapich2.default/esmf.mk - -#clean up -make -f GNUmakefile distclean_ADCIRC COMPONENTS="ADCIRC" -make -f GNUmakefile distclean_WW3DATA COMPONENTS="WW3DATA" -make -f GNUmakefile distclean_ATMESH COMPONENTS="ATMESH" -#make -f GNUmakefile distclean_NWM COMPONENTS="NWM" -make -f GNUmakefile distclean_WW3 COMPONENTS="WW3" - -#make -#make -f GNUmakefile build COMPONENTS="ADCIRC NWM ATMESH" -#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH WW3 NWM" -make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH WW3 WW3DATA" -#make -f GNUmakefile build COMPONENTS="WW3DATA ADCIRC ATMESH" -#make -f GNUmakefile build COMPONENTS="WW3" -#make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" -#make -f GNUmakefile build COMPONENTS="ADCIRC WW3DATA ATMESH" -#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH NWM" -#make -f GNUmakefile build COMPONENTS="ADCIRC ATMESH" - - - From f914615c1699c64e1060dce3bb0cec5b06309f62 Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Thu, 18 Mar 2021 15:46:59 +0000 Subject: [PATCH 11/21] update ADCIRC submodule with new commits --- ADCIRC | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ADCIRC b/ADCIRC index 69cabdf0..74287374 160000 --- a/ADCIRC +++ b/ADCIRC @@ -1 +1 @@ -Subproject commit 69cabdf05c8a2a8eb7eb56c7984c66a5021944b5 +Subproject commit 7428737428ff4fb72582526bc1cbcb200e6feb3d From a8af2b00d4d5837556a037eec4ddaac219e3b048 Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Thu, 18 Mar 2021 16:21:02 +0000 Subject: [PATCH 12/21] update gitignore with build files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 73b7297e..a4e1a415 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,9 @@ *.a *.lib +# intermediate build files +*_INSTALL/ + # Executables *.exe *.out From 204c589fb1967a646f1584715b5427108ac212a4 Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Thu, 18 Mar 2021 16:21:19 +0000 Subject: [PATCH 13/21] update nems with gitignore --- NEMS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEMS b/NEMS index 6c46179e..b5828b0e 160000 --- a/NEMS +++ b/NEMS @@ -1 +1 @@ -Subproject commit 6c46179efbf8d4f0f56b82298853c94baf2e8c18 +Subproject commit b5828b0ea995f9e8241fddd2031ff3134b1cacb8 From 65871a9416dfa86298d0ffda2950b18676b31e22 Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Fri, 19 Mar 2021 20:35:06 +0000 Subject: [PATCH 14/21] use specific modules used for ESMF build, until we can build our own ESMF --- modulefiles/envmodules_intel.hera | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modulefiles/envmodules_intel.hera b/modulefiles/envmodules_intel.hera index fef3aa2b..2e24bd51 100644 --- a/modulefiles/envmodules_intel.hera +++ b/modulefiles/envmodules_intel.hera @@ -6,9 +6,9 @@ #################### ### (1) Load all needed environment modules. module purge -module load intel impi/2018.0.4 +module load intel/18.0.5.274 impi/2018.0.4 module load szip hdf5 -module load netcdf +module load netcdf/4.6.1 module use /home/emc.nemspara/SOFT-hera/modulefiles module load esmf/8.0.0bs48g From d3bc339b35b1b5be4ba5e62c2c0fdfefb7d15e6f Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Mon, 22 Mar 2021 13:58:33 +0000 Subject: [PATCH 15/21] update NEMS submodule --- NEMS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEMS b/NEMS index b5828b0e..7cf93063 160000 --- a/NEMS +++ b/NEMS @@ -1 +1 @@ -Subproject commit b5828b0ea995f9e8241fddd2031ff3134b1cacb8 +Subproject commit 7cf930637f6bc49d1974c354800eb1d25d3ba641 From dd7f0c26801fe39a0908d85d74f4291f02894de3 Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Mon, 22 Mar 2021 15:08:55 +0000 Subject: [PATCH 16/21] update ESMF module to --- modulefiles/envmodules_intel.hera | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modulefiles/envmodules_intel.hera b/modulefiles/envmodules_intel.hera index 2e24bd51..597b85d4 100644 --- a/modulefiles/envmodules_intel.hera +++ b/modulefiles/envmodules_intel.hera @@ -8,10 +8,10 @@ module purge module load intel/18.0.5.274 impi/2018.0.4 module load szip hdf5 -module load netcdf/4.6.1 module use /home/emc.nemspara/SOFT-hera/modulefiles -module load esmf/8.0.0bs48g +module load netcdf_parallel/4.7.4.release +module load esmf/8.1.0bs36g #################### From 747f22b6e1f20ed603eb395cd6ea8e22e01c57dd Mon Sep 17 00:00:00 2001 From: zacharyburnettNOAA Date: Mon, 22 Mar 2021 15:15:43 +0000 Subject: [PATCH 17/21] update HDF5 module to parallel NEMS build --- modulefiles/envmodules_intel.hera | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modulefiles/envmodules_intel.hera b/modulefiles/envmodules_intel.hera index 597b85d4..6f8b0aa5 100644 --- a/modulefiles/envmodules_intel.hera +++ b/modulefiles/envmodules_intel.hera @@ -7,9 +7,10 @@ ### (1) Load all needed environment modules. module purge module load intel/18.0.5.274 impi/2018.0.4 -module load szip hdf5 +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 From 8fda1e18022f9567c9f4c2b498e7ff9f3ef0d9c8 Mon Sep 17 00:00:00 2001 From: "zachary.burnett" Date: Mon, 22 Mar 2021 14:07:17 -0400 Subject: [PATCH 18/21] update README.md --- README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ac251fe2..263479c6 100644 --- a/README.md +++ b/README.md @@ -22,24 +22,25 @@ cd ADC-WW3-NWM-NEMS - `WW3` / `WW3DATA` - `NWM` - `--plat` can be any combination of - - `cheyenne` - - `gaea` - `hera` + - `stampede` - `jet` - - `linux` - - `macosx` - `orion` - - `stampede` - `wcoss` + - `gaea` + - `cheyenne` + - `linux` + - `macosx` - `--compiler` can be one of - `intel` - `gnu` - `pgi` - `--clean` is optional, and can be one of - - `1` (`make clean`, default) - - `2` (`make distclean`) - - `-1` (`make clean` then build) - - `-2` (`make distclean` then build) + - ` ` (`make clean` and exit) + - `1` (`make clean` and exit) + - `2` (`make clobber` and exit) + - `-1` (`make clean` and build) + - `-2` (`make clobber` and build) #### adding a new platform / compiler to compilation script From 55cb8b6ce1e447726ffb10bf410e7afda7a8fc95 Mon Sep 17 00:00:00 2001 From: "zachary.burnett" Date: Mon, 22 Mar 2021 14:51:55 -0400 Subject: [PATCH 19/21] update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 263479c6..c351c972 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ cd ADC-WW3-NWM-NEMS - `--plat` can be any combination of - `hera` - `stampede` - - `jet` - - `orion` - `wcoss` + - `orion` + - `jet` - `gaea` - `cheyenne` - `linux` From 8e964773972b4e873adbb488aadc9a00631ab119 Mon Sep 17 00:00:00 2001 From: Panagiotis Velissariou Date: Thu, 13 May 2021 12:20:29 -0500 Subject: [PATCH 20/21] 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} From fa8c33168e13ef9178258636ae93ad40b7f00e48 Mon Sep 17 00:00:00 2001 From: Panagiotis Velissariou Date: Thu, 13 May 2021 12:41:15 -0500 Subject: [PATCH 21/21] Updated build.sh file --- build.sh | 215 +----- scripts/build-v1.0.sh | 214 ++++++ scripts/build-v1.1.sh | 227 +++++++ scripts/functions_build | 617 ++++++++++++++++++ .../functions_build-v1.0 | 0 scripts/functions_build.del | 617 ++++++++++++++++++ 6 files changed, 1676 insertions(+), 214 deletions(-) mode change 100755 => 120000 build.sh create mode 100644 scripts/build-v1.0.sh create mode 100644 scripts/build-v1.1.sh create mode 100644 scripts/functions_build rename functions_build => scripts/functions_build-v1.0 (100%) create mode 100644 scripts/functions_build.del diff --git a/build.sh b/build.sh deleted file mode 100755 index ba6f6cb4..00000000 --- a/build.sh +++ /dev/null @@ -1,214 +0,0 @@ -#!/bin/bash - -########################################################################### -### Author: Panagiotis Velissariou -### -### Version - 1.0 Fri Dec 04 2020 -########################################################################### - - -###==================== -# Make sure that the current working directory is in the PATH -[[ ! :$PATH: == *:".":* ]] && export PATH="${PATH}:." - - -# Get the directory where the script is located -scrNAME="${BASH_SOURCE[0]}" -if [[ $(uname -s) == Darwin ]]; then -# readonly scrDIR="$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" - readonly scrDIR="$(cd "$(dirname "$(grealpath -s "${scrNAME}" )" )" && pwd -P)" -else -# readonly scrDIR="$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" - readonly scrDIR="$(cd "$(dirname "$(realpath -s "${scrNAME}")" )" && pwd -P)" -fi - -funcs="$( find ${scrDIR} -type f -name "functions_build" | head -n 1 )" -if [ -f "${funcs}" ]; then - source "${funcs}" -else - echo " ### ERROR :: in ${scrNAME}" - echo " Cannot load the required file: ${funcs}" - echo " Exiting now ..." - echo - exit 1 -fi - -unset funcs -###==================== - - -######### -# Call ParseArgs to get the user input. -ParseArgs "${@}" - - -########## -# Set the variables for this script -CLEAN=${MY_CLEAN:-0} - -[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "${MY_COMPILER}" )" - -[ -n "${MY_COMPONENT:+1}" ] && COMPONENT="$( toUPPER "${MY_COMPONENT}" )" - -[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" - -[ "${MY_PARMAKE:0}" -gt 1 ] && PARMAKE=${MY_PARMAKE} - -[ -n "${MY_PLATFORM:+1}" ] && PLATFORM="$( toLOWER "${MY_PLATFORM}" )" - -[ -n "${MY_VERBOSE:+1}" ] && VERBOSE="$( toLOWER "${MY_VERBOSE}" )" - -modFILE="envmodules${COMPILER:+_${COMPILER}}${PLATFORM:+.${PLATFORM}}" - -# Customize the NEMS.x filename to include the component names -if [ -n "${COMPONENT:+1}" ]; then - compFNAME="$( strTrim "$( toLOWER "${COMPONENT}" )" )" - compFNAME="$( echo "${compFNAME}" | sed 's/ /_/g' )" -fi - -# Export some environment variables for NEMS -export NEMS_COMPILER=${COMPILER} -########## - - -########## -# Get the project directories and perform a basic check on them -readonly nemsDIR="${NEMS_DIR:-${scrDIR}/NEMS}" -if [ ! -f "${nemsDIR}/NEMSAppBuilder" ]; then - echo "The project directory \"${nemsDIR}\" does not appear to contain NEMSAppBuilder." - echo "Is this the correct NEMS directory?" - echo "You might need to set the environment variable NEMS_DIR before running this script." - echo "Exiting ..." - exit 1 -fi - -readonly modDIR="${NEMSMODS_DIR:-${scrDIR}/modulefiles}" -if [ ! -f "${modDIR}/${modFILE}" ]; then - echo "The modulefiles directory \"${modDIR}\" does not appear to contain module: ${modFILE}." - echo "Is this the correct modulefiles directory?" - echo "You might need to set the environment variable NEMSMODS_DIR before running this script." - echo "Exiting ..." - exit 1 -fi -########## - - -########## -# If the user requested to clean the build folder, do the cleaning end exit -if [ ${CLEAN:-0} -ge 1 ]; then - echo "User requested to only clean the project. Cleaning ..." - - pushd ${nemsDIR} >/dev/null 2>&1 - [ ${CLEAN:-0} -eq 1 ] && compileNems clean - [ ${CLEAN:-0} -eq 2 ] && compileNems distclean - popd >/dev/null 2>&1 - - exit 0 -fi -########## - - -########## -# Source the environment module -source ${modDIR}/${modFILE} - -component_ww3="$( echo "${COMPONENT}" | sed 's/ /:/g' )" -if [[ :${component_ww3}: == *:"WW3":* ]]; then - export WW3_CONFOPT="${COMPILER}" - export WW3_COMP="${COMPILER}" - export WWATCH3_NETCDF=NC4 -fi -########## - - -########## -# Get a final user response for the variables -echo -echo "The following variables are defined:" -echo " CLEAN = ${CLEAN}" -echo " COMPILER = ${COMPILER:-Undefined, Supported values are: [${MY_COMPILING_SYTEMS}]}" -echo " NEMS_COMPILER = ${NEMS_COMPILER}" -if [[ :${component_ww3}: == *:"WW3":* ]]; then - echo " WW3_CONFOPT = ${WW3_CONFOPT}" - echo " WW3_COMP = ${WW3_COMP}" - echo " WWATCH3_NETCDF = ${WWATCH3_NETCDF}" -fi -echo " COMPONENTS = ${COMPONENT:-Undefined, Supported values are: [${MY_COMPONENT_LIST}]}" -echo " OS = ${OS}" -echo " PLATFORM = ${PLATFORM}" -echo " VERBOSE = ${VERBOSE}" -echo -echo " HDF5HOME = ${HDF5HOME}" -echo " NETCDFHOME = ${NETCDFHOME}" -echo " NETCDF_INCDIR = ${NETCDF_INCDIR}" -echo " NETCDF_LIBDIR = ${NETCDF_LIBDIR}" -echo -echo " ESMFMKFILE = ${ESMFMKFILE}" -echo - -module list - -echo_response= -while [ -z "${echo_response}" ] ; do - echo -n "Are these values correct? [y/n]: " - read echo_response - echo_response="$( getYesNo "${echo_response}" )" -done - -if [ "${echo_response:-no}" = "no" ]; then - echo - echo "User responded: ${echo_response}" - echo "Exiting now ..." - echo - exit 1 -fi - -unset echo_response -########## - - -############################################################ -### START THE CALCULATIONS -############################################################ - -########## -# Compile the project -compileERR=0 -pushd ${nemsDIR} >/dev/null 2>&1 - case ${CLEAN:-0} in - -1 ) - compileNems clean - compileERR=$? - ;; - -2 ) - compileNems distclean - compileERR=$? - ;; - -3 ) - compileNems noclean - compileERR=$? - ;; - * ) - compileNems clean - compileERR=$? - ;; - esac - - if [ ${compileERR} -eq 0 ]; then - compileNems build - compileERR=$? - fi - - if [ ${compileERR} -eq 0 ]; then - if [ -f exe/NEMS.x ]; then - cp -p exe/NEMS.x exe/NEMS${compFNAME:+-${compFNAME}}.x - fi - fi -popd >/dev/null 2>&1 - -########## -# Install all data, executables, libraries in a common directory -[ ${compileERR:-0} -eq 0 ] && installNems -########## - -exit 0 diff --git a/build.sh b/build.sh new file mode 120000 index 00000000..7def0452 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +scripts/build-v1.1.sh \ No newline at end of file diff --git a/scripts/build-v1.0.sh b/scripts/build-v1.0.sh new file mode 100644 index 00000000..ba6f6cb4 --- /dev/null +++ b/scripts/build-v1.0.sh @@ -0,0 +1,214 @@ +#!/bin/bash + +########################################################################### +### Author: Panagiotis Velissariou +### +### Version - 1.0 Fri Dec 04 2020 +########################################################################### + + +###==================== +# Make sure that the current working directory is in the PATH +[[ ! :$PATH: == *:".":* ]] && export PATH="${PATH}:." + + +# Get the directory where the script is located +scrNAME="${BASH_SOURCE[0]}" +if [[ $(uname -s) == Darwin ]]; then +# readonly scrDIR="$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" + readonly scrDIR="$(cd "$(dirname "$(grealpath -s "${scrNAME}" )" )" && pwd -P)" +else +# readonly scrDIR="$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)" + readonly scrDIR="$(cd "$(dirname "$(realpath -s "${scrNAME}")" )" && pwd -P)" +fi + +funcs="$( find ${scrDIR} -type f -name "functions_build" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" +else + echo " ### ERROR :: in ${scrNAME}" + echo " Cannot load the required file: ${funcs}" + echo " Exiting now ..." + echo + exit 1 +fi + +unset funcs +###==================== + + +######### +# Call ParseArgs to get the user input. +ParseArgs "${@}" + + +########## +# Set the variables for this script +CLEAN=${MY_CLEAN:-0} + +[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "${MY_COMPILER}" )" + +[ -n "${MY_COMPONENT:+1}" ] && COMPONENT="$( toUPPER "${MY_COMPONENT}" )" + +[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" + +[ "${MY_PARMAKE:0}" -gt 1 ] && PARMAKE=${MY_PARMAKE} + +[ -n "${MY_PLATFORM:+1}" ] && PLATFORM="$( toLOWER "${MY_PLATFORM}" )" + +[ -n "${MY_VERBOSE:+1}" ] && VERBOSE="$( toLOWER "${MY_VERBOSE}" )" + +modFILE="envmodules${COMPILER:+_${COMPILER}}${PLATFORM:+.${PLATFORM}}" + +# Customize the NEMS.x filename to include the component names +if [ -n "${COMPONENT:+1}" ]; then + compFNAME="$( strTrim "$( toLOWER "${COMPONENT}" )" )" + compFNAME="$( echo "${compFNAME}" | sed 's/ /_/g' )" +fi + +# Export some environment variables for NEMS +export NEMS_COMPILER=${COMPILER} +########## + + +########## +# Get the project directories and perform a basic check on them +readonly nemsDIR="${NEMS_DIR:-${scrDIR}/NEMS}" +if [ ! -f "${nemsDIR}/NEMSAppBuilder" ]; then + echo "The project directory \"${nemsDIR}\" does not appear to contain NEMSAppBuilder." + echo "Is this the correct NEMS directory?" + echo "You might need to set the environment variable NEMS_DIR before running this script." + echo "Exiting ..." + exit 1 +fi + +readonly modDIR="${NEMSMODS_DIR:-${scrDIR}/modulefiles}" +if [ ! -f "${modDIR}/${modFILE}" ]; then + echo "The modulefiles directory \"${modDIR}\" does not appear to contain module: ${modFILE}." + echo "Is this the correct modulefiles directory?" + echo "You might need to set the environment variable NEMSMODS_DIR before running this script." + echo "Exiting ..." + exit 1 +fi +########## + + +########## +# If the user requested to clean the build folder, do the cleaning end exit +if [ ${CLEAN:-0} -ge 1 ]; then + echo "User requested to only clean the project. Cleaning ..." + + pushd ${nemsDIR} >/dev/null 2>&1 + [ ${CLEAN:-0} -eq 1 ] && compileNems clean + [ ${CLEAN:-0} -eq 2 ] && compileNems distclean + popd >/dev/null 2>&1 + + exit 0 +fi +########## + + +########## +# Source the environment module +source ${modDIR}/${modFILE} + +component_ww3="$( echo "${COMPONENT}" | sed 's/ /:/g' )" +if [[ :${component_ww3}: == *:"WW3":* ]]; then + export WW3_CONFOPT="${COMPILER}" + export WW3_COMP="${COMPILER}" + export WWATCH3_NETCDF=NC4 +fi +########## + + +########## +# Get a final user response for the variables +echo +echo "The following variables are defined:" +echo " CLEAN = ${CLEAN}" +echo " COMPILER = ${COMPILER:-Undefined, Supported values are: [${MY_COMPILING_SYTEMS}]}" +echo " NEMS_COMPILER = ${NEMS_COMPILER}" +if [[ :${component_ww3}: == *:"WW3":* ]]; then + echo " WW3_CONFOPT = ${WW3_CONFOPT}" + echo " WW3_COMP = ${WW3_COMP}" + echo " WWATCH3_NETCDF = ${WWATCH3_NETCDF}" +fi +echo " COMPONENTS = ${COMPONENT:-Undefined, Supported values are: [${MY_COMPONENT_LIST}]}" +echo " OS = ${OS}" +echo " PLATFORM = ${PLATFORM}" +echo " VERBOSE = ${VERBOSE}" +echo +echo " HDF5HOME = ${HDF5HOME}" +echo " NETCDFHOME = ${NETCDFHOME}" +echo " NETCDF_INCDIR = ${NETCDF_INCDIR}" +echo " NETCDF_LIBDIR = ${NETCDF_LIBDIR}" +echo +echo " ESMFMKFILE = ${ESMFMKFILE}" +echo + +module list + +echo_response= +while [ -z "${echo_response}" ] ; do + echo -n "Are these values correct? [y/n]: " + read echo_response + echo_response="$( getYesNo "${echo_response}" )" +done + +if [ "${echo_response:-no}" = "no" ]; then + echo + echo "User responded: ${echo_response}" + echo "Exiting now ..." + echo + exit 1 +fi + +unset echo_response +########## + + +############################################################ +### START THE CALCULATIONS +############################################################ + +########## +# Compile the project +compileERR=0 +pushd ${nemsDIR} >/dev/null 2>&1 + case ${CLEAN:-0} in + -1 ) + compileNems clean + compileERR=$? + ;; + -2 ) + compileNems distclean + compileERR=$? + ;; + -3 ) + compileNems noclean + compileERR=$? + ;; + * ) + compileNems clean + compileERR=$? + ;; + esac + + if [ ${compileERR} -eq 0 ]; then + compileNems build + compileERR=$? + fi + + if [ ${compileERR} -eq 0 ]; then + if [ -f exe/NEMS.x ]; then + cp -p exe/NEMS.x exe/NEMS${compFNAME:+-${compFNAME}}.x + fi + fi +popd >/dev/null 2>&1 + +########## +# Install all data, executables, libraries in a common directory +[ ${compileERR:-0} -eq 0 ] && installNems +########## + +exit 0 diff --git a/scripts/build-v1.1.sh b/scripts/build-v1.1.sh new file mode 100644 index 00000000..30f8880e --- /dev/null +++ b/scripts/build-v1.1.sh @@ -0,0 +1,227 @@ +#!/bin/bash + +########################################################################### +### Author: Panagiotis Velissariou +### +### Version - 1.1 +### +### 1.1 Wed Apr 14 2021 +### 1.0 Fri Dec 04 2020 +########################################################################### + + +###==================== +# Make sure that the current working directory is in the PATH +[[ ! :$PATH: == *:".":* ]] && export PATH="${PATH}:." + + +# Get the directory where the script is located +if [[ $(uname -s) == Darwin ]]; then + readonly scrNAME="$( grealpath -s "${BASH_SOURCE[0]}" )" + readonly scrDIR="$(cd "$(dirname "${scrNAME}" )" && pwd -P)" +else + readonly scrNAME="$( realpath -s "${BASH_SOURCE[0]}" )" + readonly scrDIR="$(cd "$(dirname "$(realpath -s "${BASH_SOURCE[0]}")" )" && pwd -P)" +fi + +funcs="$( find ${scrDIR} -type f -name "functions_build" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" +else + echo " ### ERROR :: in ${scrNAME}" + echo " Cannot load the required file: ${funcs}" + echo " Exiting now ..." + echo + exit 1 +fi + +unset funcs +###==================== + + +######### +# Call ParseArgs to get the user input. +ParseArgs "${@}" + + +########## +# Set the variables for this script +CLEAN=${MY_CLEAN:-0} + +[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "${MY_COMPILER}" )" + +[ -n "${MY_COMPONENT:+1}" ] && COMPONENT="$( toUPPER "${MY_COMPONENT}" )" + + +[ -n "${MY_OS:+1}" ] && OS="$( toLOWER "${MY_OS}" )" +if [ -n "${MY_PLATFORM:+1}" ]; then + PLATFORM="$( toLOWER "${MY_PLATFORM}" )" +else + PLATFORM="${OS}" +fi +export NEMS_PLATFORM=${PLATFORM} +export MACHINE_ID=${PLATFORM} + + +[ "${MY_PARMAKE:0}" -gt 1 ] && PARMAKE=${MY_PARMAKE} + +[ -n "${MY_VERBOSE:+1}" ] && VERBOSE="$( toLOWER "${MY_VERBOSE}" )" + +modFILE="envmodules${COMPILER:+_${COMPILER}}${PLATFORM:+.${PLATFORM}}" + +# Customize the NEMS.x filename to include the component names +if [ -n "${COMPONENT:+1}" ]; then + compFNAME="$( strTrim "$( toLOWER "${COMPONENT}" )" )" + compFNAME="$( echo "${compFNAME}" | sed 's/ /_/g' )" +fi + +# Export some environment variables for NEMS +export NEMS_COMPILER=${COMPILER} +########## + + +########## +# Get the project directories and perform a basic check on them +readonly nemsDIR="${NEMS_DIR:-${scrDIR}/NEMS}" +if [ ! -f "${nemsDIR}/NEMSAppBuilder" ]; then + echo "The project directory \"${nemsDIR}\" does not appear to contain NEMSAppBuilder." + echo "Is this the correct NEMS directory?" + echo "You might need to set the environment variable NEMS_DIR before running this script." + echo "Exiting ..." + exit 1 +fi + +readonly modDIR="${NEMSMODS_DIR:-${scrDIR}/modulefiles}" +if [ ! -f "${modDIR}/${modFILE}" ]; then + echo + echo "The modulefiles directory \"${modDIR}\" does not appear to contain the module file: ${modFILE}." + echo "Is this the correct \"modulefiles\" directory?" + echo "You might need to set the environment variable \"NEMSMODS_DIR\" to point to a custom modulefiles directory before running this script." + echo "Exiting ..." + echo + exit 1 +fi +########## + + +########## +# If the user requested to clean the build folder, do the cleaning end exit +if [ ${CLEAN:-0} -ge 1 ]; then + echo "User requested to only clean the project. Cleaning ..." + + pushd ${nemsDIR} >/dev/null 2>&1 + [ ${CLEAN:-0} -eq 1 ] && compileNems clean + [ ${CLEAN:-0} -eq 2 ] && compileNems distclean + popd >/dev/null 2>&1 + + exit 0 +fi +########## + + +########## +# Source the environment module +source ${modDIR}/${modFILE} + +component_ww3="$( echo "${COMPONENT}" | sed 's/ /:/g' )" +if [[ :${component_ww3}: == *:"WW3":* ]]; then + export WW3_CONFOPT="${COMPILER}" + export WW3_COMP="${COMPILER}" + export WWATCH3_NETCDF=NC4 +fi +########## + + +########## +# Get a final user response for the variables +echo +echo "The following variables are defined:" +echo " CLEAN = ${CLEAN}" +echo " COMPILER = ${COMPILER:-Undefined, Supported values are: [${MY_COMPILING_SYTEMS}]}" +echo " NEMS_COMPILER = ${NEMS_COMPILER}" +echo " MODULES FILE = ${modFILE}" +if [[ :${component_ww3}: == *:"WW3":* ]]; then + echo " WW3_CONFOPT = ${WW3_CONFOPT}" + echo " WW3_COMP = ${WW3_COMP}" + echo " WWATCH3_NETCDF = ${WWATCH3_NETCDF}" +fi +echo " COMPONENTS = ${COMPONENT:-Undefined, Supported values are: [${MY_COMPONENT_LIST}]}" +echo " OS = ${OS}" +echo " PLATFORM = ${PLATFORM}" +echo " VERBOSE = ${VERBOSE}" +echo +echo " HDF5HOME = ${HDF5HOME}" +echo " NETCDFHOME = ${NETCDFHOME}" +echo " NETCDF_INCDIR = ${NETCDF_INCDIR}" +echo " NETCDF_LIBDIR = ${NETCDF_LIBDIR}" +echo +echo " ESMFMKFILE = ${ESMFMKFILE}" +echo + +module list + + +echo_response= +while [ -z "${echo_response}" ] ; do + echo -n "Are these values correct? [y/n]: " + read echo_response + echo_response="$( getYesNo "${echo_response}" )" +done + +if [ "${echo_response:-no}" = "no" ]; then + echo + echo "User responded: ${echo_response}" + echo "Exiting now ..." + echo + exit 1 +fi + +unset echo_response +########## + + +############################################################ +### START THE CALCULATIONS +############################################################ + +########## +# Compile the project +compileERR=0 +pushd ${nemsDIR} >/dev/null 2>&1 + case ${CLEAN:-0} in + -1 ) + compileNems clean + compileERR=$? + ;; + -2 ) + compileNems distclean + compileERR=$? + ;; + -3 ) + compileNems noclean + compileERR=$? + ;; + * ) + compileNems clean + compileERR=$? + ;; + esac + + if [ ${compileERR} -eq 0 ]; then + compileNems build + compileERR=$? + fi + + if [ ${compileERR} -eq 0 ]; then + if [ -f exe/NEMS.x ]; then + cp -p exe/NEMS.x exe/NEMS${compFNAME:+-${compFNAME}}.x + fi + fi +popd >/dev/null 2>&1 + +########## +# Install all data, executables, libraries in a common directory +[ ${compileERR:-0} -eq 0 ] && installNems +########## + +exit 0 diff --git a/scripts/functions_build b/scripts/functions_build new file mode 100644 index 00000000..ebb69270 --- /dev/null +++ b/scripts/functions_build @@ -0,0 +1,617 @@ +#!/bin/bash-*-Shell-script-functions*- + +########################################################################### +### Author: Panagiotis Velissariou +### +### Version - 1.0 Fri Dec 04 2020 +########################################################################### + +set +u + +MY_COMPILING_SYTEMS="gnu, intel, pgi" + +MY_ATM_MODS="ATMESH WRF HWRF PAHM" +MY_OCN_MODS="ADCIRC SCHISM FVCOM ROMS" +MY_HYD_MODS="NWM" +MY_WAV_MODS="WW3DATA WW3" + +MY_COMPONENT_LIST="${MY_ATM_MODS} ${MY_OCN_MODS} ${MY_HYD_MODS} ${MY_WAV_MODS} " + +################################################## +### MODELLING SYSTEM BUILD FUNCTIONS +################################################## + +###======================================== +### ParseArgs() +### Usage: ParseArgs args +### Parameters: args = the script options +### Returns: 0 +### Echoes: NONE +### +### Gets the supplied options to the script. +###======================================== +ParseArgs() +{ + local nm_func=$( basename ${BASH_SOURCE[${#BASH_SOURCE[@]}-1]} ) + + local opt_all opt_opt opt_arg opt_chk + + local t_VAR + local ans0 ans ival intN + local all_evars + + all_evars="MY_CLEAN MY_COMPILER MY_COMPONENT MY_OS MY_PARMAKE MY_PLATFORM MY_VERBOSE" + + for ival in ${all_evars}; do unset __${ival}; done + + + __MY_CLEAN=0 + __MY_COMPILER=intel + __MY_COMPONENT="ADCIRC WW3DATA ATMESH" + __MY_OS= + __MY_PARMAKE=1 + __MY_PLATFORM= + __MY_VERBOSE= + + + # ----- + # Process the function options + opt_all=( c clean compiler component j os plat v verbose h help ) + opt_all=":$( echo "${opt_all[@]/#/-} ${opt_all[@]/#/--}" | sed 's/ /:/g' ):" + + unset __OPTION_LIST + while test $# -gt 0; do + case "${1}" in + -[^-]*=* | --[^-]*=* ) + opt_opt="$( toLOWER "$( echo "${1}" | sed 's/=.*//' )" )" + len=$(( ${#opt_opt} + 1 )) + opt_arg="$( strTrim "$( echo "${1:${len}}" )" 2 )" + [ "$( echo "${opt_all}" | egrep -o ":${opt_arg}:" )" ] && \ + opt_arg= + ;; + -[^-]* | --[^-]* ) + opt_opt="$( toLOWER "${1}" )" + opt_chk="$( toLOWER "$( echo "${2}" | sed 's/=.*//' )" )" + if [ "$( echo "${opt_all}" | egrep -o ":${opt_chk}:" )" ]; then + opt_arg= + else + opt_arg="$( strTrim "$( echo "${2}" )" )" + fi + ;; + *) + opt_opt= + opt_arg= + ;; + esac + + case "${opt_opt}" in + -c | --c | -clean | --clean ) + checkFuncOpt "--clean" + if [ $? -eq 0 ]; then + __MY_CLEAN=1 + if [ "X${opt_arg}" != "X" ]; then + if `isInteger "${opt_arg}"` ; then + __MY_CLEAN=$( echo "${opt_arg}" ) + [ ${opt_arg} -le -3 ] && __MY_CLEAN=-3 + [ ${opt_arg} -ge 2 ] && __MY_CLEAN=2 + else + __MY_CLEAN=0 + [ "$( getYesNo "${opt_arg}" )" = "yes" ] && __MY_CLEAN=1 + fi + fi + fi + ;; + -compiler | --compiler ) + checkFuncOpt "--compiler" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_COMPILER="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" + fi + fi + ;; + -component | --component ) + checkFuncOpt "--component" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_COMPONENT="$( strTrim "${opt_arg}" )" + fi + fi + ;; + -j | --j ) + checkFuncOpt "--j" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_PARMAKE=1 + t_VAR="$( getPosInteger "${opt_arg}" )" + [ ! -z "${t_VAR}" ] && __MY_PARMAKE=${t_VAR} + fi + fi + ;; + -os | --os ) + checkFuncOpt "--os" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_OS="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" + fi + fi + ;; + -plat | --plat ) + checkFuncOpt "--plat" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_PLATFORM="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" + fi + fi + ;; + -v | --v | -verbose | --verbose ) + checkFuncOpt "--verbose" + if [ $? -eq 0 ]; then + __MY_VERBOSE=b + if [ "X${opt_arg}" != "X" ]; then + __MY_VERBOSE="$( echo "$( strTrim "${opt_arg}" 2 )" | sed 's/[[:space:]]/,/g' )" + fi + fi + ;; + -h | -help | --h | --help ) + UsageBuild ${nm_func} + ;; + *) ;; # DEFAULT + esac + shift + opt_opt= + opt_arg= + done + unset __OPTION_LIST + # ----- + + if [ -z "${__MY_OS}" ]; then + case "$(uname -s)" in + Darwin ) __MY_OS="macosx" ;; + Linux ) __MY_OS="linux" ;; + *) __MY_OS="UNDEFINED";; # DEFAULT + esac + fi + + # Export the values of all __* variables. + for ival in ${all_evars} + do + ans0="$( eval "echo \${$(echo ${ival}):-}" )" + ans="$( eval "echo \${$(echo __${ival}):-}" )" + ans=${ans:-${ans0:-}} + + eval "${ival}=\${ans}" + export ${ival} + + unset __${ival} + done + + return 0 +} + +UsageBuild() +{ + local nm="$( basename ${0} )" + + echo + echo "Usage: \"${nm}\" [{-|--}option1{=|space}[option_value1]] [{-|--}option2{=|space}[option_value2]] ..." + echo + + echo " -h|-help|--h|--help" + echo " Show this help screen." + echo + #--- + echo " -c|--c|-clean|--clean [=|space] \"0|1|yes|no\" (OPTIONAL)." + echo " Only clean the already compiled CMake build system." + echo " Default: 0|no." + echo + #--- + echo " -compiler|--compiler [=|space] \"compiling_system\" (OPTIONAL)." + echo " The compiling system to use (${MY_COMPILING_SYTEMS})." + echo " Default: intel." + echo + #--- + echo " -component|--component [=|space] \"component_list\" (OPTIONAL)." + echo " The component(s) to use (${MY_COMPONENT_LIST})." + echo " Default: \"ADCIRC WW3DATA ATMESH\"." + echo + #--- + echo " -j|--j [=|space] \"N\" (OPTIONAL)." + echo " Define the number of make jobs to run simultaneously." + echo " Default: 1." + echo + #--- + echo " -os|--os [=|space] \"OS string\" (OPTIONAL)." + echo " The name of the Operating system." + echo " Supported OSes: linux macosx." + echo " Default: current OS." + echo + #--- + echo " -plat|--plat [=|space] \"platform\" (OPTIONAL)." + echo " The name of the compute HPC platform to consider." + echo " Selecting a platform, environment modules specific to that platform are loaded" + echo " and corresponding environment variables are set." + echo " Supported platforms: cheyenne gaea hera jet orion stampede wcoss." + echo " Default: none." + echo + #--- + echo " -v|--v|-verbose|--verbose [=|space] \"a,b,v,i,j,m,n\" (any combination, OPTIONAL)." + echo " Enable verbosity in the make files during compilation." + echo " a (all) : all types of debugging output are enabled" + echo " n (none) : disable all debugging currently enabled" + echo " b (basic) : basic debugging and whether the build was successful or not" + echo " v (verbose) : a level above basic" + echo " i (implicit) : prints messages describing the implicit rule searches for each target" + echo " j (jobs) : prints messages giving details on the invocation of specific sub-commands" + echo " m (makefile) : enables messages while rebuilding makefiles" + echo " Default:none." + echo + #--- + + exit 0 +} + +###======================================== +### checkFuncOpt() +### Usage: checkFuncOpt opt_name +### Parameters: +### opt_name: The name of the option to a function +### +### Returns : Exits on error +### +### Exports : __OPTION_LIST +### +### Echoes : NONE +### +### checkFuncOpt: Checks if an option to a function is already supplied. +###======================================== +checkFuncOpt() { + local opt_inp opt_list + + [ $# -eq 0 ] && return -1 + + opt_inp="$( strTrim "${1}" 2 )" + opt_inp="$( echo "${opt_inp}" | sed 's/^[-]*//' )" + + opt_list="$( strTrim "${__OPTION_LIST}" 2 )" + [ -n ${opt_list:+1} ] && \ + opt_list=":$( echo "${opt_list}" | sed 's/ /:/g' ):" + + [ "$( echo "${opt_list}" | egrep -o ":${opt_inp}:" )" ] && return 1 + + __OPTION_LIST="${__OPTION_LIST} ${opt_inp}" + export __OPTION_LIST + + return 0 +} + +###======================================== +### isInteger() +### Usage: isInteger var +### Parameters: var +### Returns: 1 if var is not an integer (0 is an integer as well) +### 0 in any other case +### Echoes: NONE +###======================================== +isInteger() +{ + local -i retval=1 + + [ $# -eq 0 ] && return ${retval} + + if [ "${1:-UNDEF}" -eq "${1}" ] 2>/dev/null + then + retval=0 + fi + + return ${retval} +} + +###======================================== +### getInteger() +### Usage: getInteger int +### Parameters: int (int >=0 or, int < 0) +### Returns: 1 if var is not an integer +### 0 in any other case +### Echoes: int, if it is a valid integer (including 0), +### in any other case echoes an empty string +###======================================== +getInteger() +{ + local -i retval=0 + local echoval= minus= + + # strip spaces, '+' signs and '-' signs + # if the first character of the string is '-', set the minus variable + echoval="$( echo "${1}" | sed 's/[[:space:]+]//g' )" + [ "X$( echo "${echoval:0:1}" )" = "X-" ] && minus="-" + echoval="${minus}$( echo "${echoval}" | sed 's/[[:space:]-]//g' )" + + if isInteger ${echoval}; then + echoval="$(echo "scale=0; ${echoval} + 0" | bc -ql 2>/dev/null)" + retval=$? + echoval="${echoval:-0}" + else + echoval= + retval=1 + fi + + echo -n ${echoval} + + return ${retval} +} + +###======================================== +### getPosInteger() +### Usage: getPosInteger posint +### Parameters: posint (posint >= 0) +### Returns: 1 if var is not a positive integer +### 0 in any other case +### Echoes: posint if it is a valid positive integer +### (including 0), in any other case echoes an +### empty string +###======================================== +getPosInteger() +{ + local -i retval=0 + local echoval= + + echoval=$( getInteger "${1}" ) + retval=$? + + if [ ${retval} -ne 0 ] ; then + echoval= + retval=1 + else + if [ ${echoval} -lt 0 ]; then + echoval= + retval=1 + fi + fi + + echo -n ${echoval} + + return ${retval} +} + +###======================================== +### getYesNo() +### Usage: getYesNo value +### Parameters: +### value : The input value (the value of a parameter) +### The value of a bash parameter that is checked +### against TRUE/FALSE. If the value is one of: +### ">=1|y|yes|yea|yeah|yep" +### then the value of parameter is TRUE (answer = yes). +### If the value is one of: +### "<=0|n|no|not|nop|nope" +### then the value of parameter is FALSE (answer = no). +### If the value is empty then the value of parameter +### is FALSE (answer = no) +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : A "yes" or "no" answer. +### +### getYesNo: Checks if a parameter is assigned a TRUE/FALSE value. +###======================================== +getYesNo() +{ + local param answer + + param="$( echo "${1}" | tr '[:upper:]' '[:lower:]' )" + + if [ "${param}" -eq "${param}" ] 2>/dev/null + then + [ ${param} -le 0 ] && param=0 + [ ${param} -gt 0 ] && param=1 + fi + + case "${param}" in + 1|y|yes|yea|yeah|yep) answer="yes" ;; + 0|n|no|not|nop|nope) answer="no" ;; + *) answer="" ;; # DEFAULT + esac + + echo -n "${answer}" +} + +###======================================== +### toUPPER() +### Usage: toUPPER string +### Parameters: +### string : The string in to convert +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : The input string converted to an all upper case string +### +### toUPPER: Converts a string to an all upper case string +###======================================== +function toUPPER() +{ + echo "${1}" | tr '[:lower:]' '[:upper:]' +} + +###======================================== +### toLOWER() +### Usage: toLOWER string +### Parameters: +### string : The string in to convert +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : The input string converted to an all lower case string +### +### toLOWER: Converts a string to an all lower case string +###======================================== +function toLOWER() +{ + echo "${1}" | tr '[:upper:]' '[:lower:]' +} + +###======================================== +### strESC() +### Usage: strESC string +### Parameters: +### string : The input string +### The input string on which this function is applied +### to escape special characters used in bash/sed ... +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : The modified string with its special characters escaped +### +### strESC: Escapes special characters in a string: "'()/[]*. +###======================================== +strESC() +{ + echo -n "$( echo "${*}" | sed -e "s/[\"\'\(\)\/\*\!]/\\\&/g;s/\[/\\\&/g;s/\]/\\\&/g" )" +} + +strESC1() +{ + echo -n "$( echo "${*}" | sed -e "s/[\&\/\*\!]/\\\&/g;s/\[/\\\&/g;s/\]/\\\&/g" )" +} + +###======================================== +### strTrim() +### Usage: strTrim s1 flag +### Parameters: +### s1 : The input string +### flag : Integer +### A value that controls the action of strTrim. +### If flag is zero or not present, trailing blanks are removed. +### Leading blanks are removed if it is equal to 1. +### Both are removed if it is equal to 2. +### In any other case, trailing blanks are removed. +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : s1 with all leading and/or trailing +### white spaces removed. +### +### strTrim: Removes all leading and/or trailing white spaces +### from the input string +###======================================== +function strTrim () +{ + local trimFLG="${2:-0}" + local out_str= + + case ${trimFLG} in + 0) out_str="$(echo "${1}" | sed 's/[[:space:]]*$//')" ;; + 1) out_str="$(echo "${1}" | sed 's/^[[:space:]]*//')" ;; + 2) out_str="$(echo "${1}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" ;; + *) out_str="$(echo "${1}" | sed 's/[[:space:]]*$//')" ;; + esac + + echo -n ${out_str} +} + +compileNems() { + local cmp_type cmp_make cmp_comp cmp_mjob + local err=0 + + [ $# -eq 0 ] && return ${err} + + cmp_type="$( toLOWER "${1}" )" + cmp_make=GNUmakefile + cmp_comp="${COMPONENT:+COMPONENTS=\"${COMPONENT}\"}" + cmp_mjob="${PARMAKE:+-j ${PARMAKE}}" + cmp_verb="${VERBOSE:+--debug=${VERBOSE}}" + + case "${cmp_type}" in + "clean"|"distclean" ) + if [ -f "${cmp_make}" ]; then + echo + echo "compileNems :: Cleaning: make -f ${cmp_make} ${cmp_type} ${cmp_comp}" + eval "make ${cmp_verb} -f ${cmp_make} ${cmp_type} ${cmp_comp}" + err=$? + + if [ "${cmp_type}" == "distclean" ]; then + rm -f NEMS/exe/NEMS-*.x + fi + else + echo "compileNems :: Cleaning: no makefile found: makefile = ${cmp_make}" + err=1 + fi + ;; + "build"|"compile" ) + if [ -f "${cmp_make}" ]; then + echo + echo "compileNems :: Compiling: make ${cmp_mjob} -f ${cmp_make} ${cmp_type} ${cmp_comp}" + eval "make ${cmp_verb} ${cmp_mjob} -f ${cmp_make} ${cmp_type} ${cmp_comp}" + err=$? + else + echo "compileNems :: Compiling: no makefile found: makefile = ${cmp_make}" + err=1 + fi + ;; + * ) err=0 ;; # Do nothing + esac + + return ${err} +} + +installNems() { + local cmp_comp icmp + local instdir + local CPBIN="/bin/cp -fpv" + local RMBIN="/bin/rm -fv" + + instdir="ALLBIN_INSTALL" + + cmp_comp="${COMPONENT}" + + [ ! -d "${instdir}" ] && mkdir -p ${instdir} + + for icmp in ${cmp_comp} + do + indir="${icmp}_INSTALL" + + if [ -d ${indir} ]; then + echo + echo " --- Installing from: ${indir} to ${instdir} ---" + ${CPBIN} ${indir}/* ${instdir}/ + fi + + ###### Extra ADCIRC files + if [ "${icmp}" == "ADCIRC" ]; then + echo + echo " --- Installing from: ${icmp} to ${instdir} ---" + for iprog in adcprep + do + prog="$( find ${icmp} -type f -name ${iprog} | head -1 )" + if [ -n "${prog:+1}" ]; then + ${CPBIN} ${prog} ${instdir}/ + fi + done + fi + ###### + done + + ###### Install the NEMS/exe/NEMS* files + echo + echo " --- Installing from: NEMS/exe to ${instdir} ---" + for iprog in NEMS/exe/NEMS-*.x + do + if [ -f "${iprog}" ]; then + ${CPBIN} ${iprog} ${instdir}/ + fi + done + + ###### Remove un-needed files from instdir + echo + echo " --- Removing files that are not needed from: ${instdir} ---" + ${RMBIN} ${instdir}/*.mk ${instdir}/*.mod +} diff --git a/functions_build b/scripts/functions_build-v1.0 similarity index 100% rename from functions_build rename to scripts/functions_build-v1.0 diff --git a/scripts/functions_build.del b/scripts/functions_build.del new file mode 100644 index 00000000..ebb69270 --- /dev/null +++ b/scripts/functions_build.del @@ -0,0 +1,617 @@ +#!/bin/bash-*-Shell-script-functions*- + +########################################################################### +### Author: Panagiotis Velissariou +### +### Version - 1.0 Fri Dec 04 2020 +########################################################################### + +set +u + +MY_COMPILING_SYTEMS="gnu, intel, pgi" + +MY_ATM_MODS="ATMESH WRF HWRF PAHM" +MY_OCN_MODS="ADCIRC SCHISM FVCOM ROMS" +MY_HYD_MODS="NWM" +MY_WAV_MODS="WW3DATA WW3" + +MY_COMPONENT_LIST="${MY_ATM_MODS} ${MY_OCN_MODS} ${MY_HYD_MODS} ${MY_WAV_MODS} " + +################################################## +### MODELLING SYSTEM BUILD FUNCTIONS +################################################## + +###======================================== +### ParseArgs() +### Usage: ParseArgs args +### Parameters: args = the script options +### Returns: 0 +### Echoes: NONE +### +### Gets the supplied options to the script. +###======================================== +ParseArgs() +{ + local nm_func=$( basename ${BASH_SOURCE[${#BASH_SOURCE[@]}-1]} ) + + local opt_all opt_opt opt_arg opt_chk + + local t_VAR + local ans0 ans ival intN + local all_evars + + all_evars="MY_CLEAN MY_COMPILER MY_COMPONENT MY_OS MY_PARMAKE MY_PLATFORM MY_VERBOSE" + + for ival in ${all_evars}; do unset __${ival}; done + + + __MY_CLEAN=0 + __MY_COMPILER=intel + __MY_COMPONENT="ADCIRC WW3DATA ATMESH" + __MY_OS= + __MY_PARMAKE=1 + __MY_PLATFORM= + __MY_VERBOSE= + + + # ----- + # Process the function options + opt_all=( c clean compiler component j os plat v verbose h help ) + opt_all=":$( echo "${opt_all[@]/#/-} ${opt_all[@]/#/--}" | sed 's/ /:/g' ):" + + unset __OPTION_LIST + while test $# -gt 0; do + case "${1}" in + -[^-]*=* | --[^-]*=* ) + opt_opt="$( toLOWER "$( echo "${1}" | sed 's/=.*//' )" )" + len=$(( ${#opt_opt} + 1 )) + opt_arg="$( strTrim "$( echo "${1:${len}}" )" 2 )" + [ "$( echo "${opt_all}" | egrep -o ":${opt_arg}:" )" ] && \ + opt_arg= + ;; + -[^-]* | --[^-]* ) + opt_opt="$( toLOWER "${1}" )" + opt_chk="$( toLOWER "$( echo "${2}" | sed 's/=.*//' )" )" + if [ "$( echo "${opt_all}" | egrep -o ":${opt_chk}:" )" ]; then + opt_arg= + else + opt_arg="$( strTrim "$( echo "${2}" )" )" + fi + ;; + *) + opt_opt= + opt_arg= + ;; + esac + + case "${opt_opt}" in + -c | --c | -clean | --clean ) + checkFuncOpt "--clean" + if [ $? -eq 0 ]; then + __MY_CLEAN=1 + if [ "X${opt_arg}" != "X" ]; then + if `isInteger "${opt_arg}"` ; then + __MY_CLEAN=$( echo "${opt_arg}" ) + [ ${opt_arg} -le -3 ] && __MY_CLEAN=-3 + [ ${opt_arg} -ge 2 ] && __MY_CLEAN=2 + else + __MY_CLEAN=0 + [ "$( getYesNo "${opt_arg}" )" = "yes" ] && __MY_CLEAN=1 + fi + fi + fi + ;; + -compiler | --compiler ) + checkFuncOpt "--compiler" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_COMPILER="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" + fi + fi + ;; + -component | --component ) + checkFuncOpt "--component" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_COMPONENT="$( strTrim "${opt_arg}" )" + fi + fi + ;; + -j | --j ) + checkFuncOpt "--j" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_PARMAKE=1 + t_VAR="$( getPosInteger "${opt_arg}" )" + [ ! -z "${t_VAR}" ] && __MY_PARMAKE=${t_VAR} + fi + fi + ;; + -os | --os ) + checkFuncOpt "--os" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_OS="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" + fi + fi + ;; + -plat | --plat ) + checkFuncOpt "--plat" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_PLATFORM="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" + fi + fi + ;; + -v | --v | -verbose | --verbose ) + checkFuncOpt "--verbose" + if [ $? -eq 0 ]; then + __MY_VERBOSE=b + if [ "X${opt_arg}" != "X" ]; then + __MY_VERBOSE="$( echo "$( strTrim "${opt_arg}" 2 )" | sed 's/[[:space:]]/,/g' )" + fi + fi + ;; + -h | -help | --h | --help ) + UsageBuild ${nm_func} + ;; + *) ;; # DEFAULT + esac + shift + opt_opt= + opt_arg= + done + unset __OPTION_LIST + # ----- + + if [ -z "${__MY_OS}" ]; then + case "$(uname -s)" in + Darwin ) __MY_OS="macosx" ;; + Linux ) __MY_OS="linux" ;; + *) __MY_OS="UNDEFINED";; # DEFAULT + esac + fi + + # Export the values of all __* variables. + for ival in ${all_evars} + do + ans0="$( eval "echo \${$(echo ${ival}):-}" )" + ans="$( eval "echo \${$(echo __${ival}):-}" )" + ans=${ans:-${ans0:-}} + + eval "${ival}=\${ans}" + export ${ival} + + unset __${ival} + done + + return 0 +} + +UsageBuild() +{ + local nm="$( basename ${0} )" + + echo + echo "Usage: \"${nm}\" [{-|--}option1{=|space}[option_value1]] [{-|--}option2{=|space}[option_value2]] ..." + echo + + echo " -h|-help|--h|--help" + echo " Show this help screen." + echo + #--- + echo " -c|--c|-clean|--clean [=|space] \"0|1|yes|no\" (OPTIONAL)." + echo " Only clean the already compiled CMake build system." + echo " Default: 0|no." + echo + #--- + echo " -compiler|--compiler [=|space] \"compiling_system\" (OPTIONAL)." + echo " The compiling system to use (${MY_COMPILING_SYTEMS})." + echo " Default: intel." + echo + #--- + echo " -component|--component [=|space] \"component_list\" (OPTIONAL)." + echo " The component(s) to use (${MY_COMPONENT_LIST})." + echo " Default: \"ADCIRC WW3DATA ATMESH\"." + echo + #--- + echo " -j|--j [=|space] \"N\" (OPTIONAL)." + echo " Define the number of make jobs to run simultaneously." + echo " Default: 1." + echo + #--- + echo " -os|--os [=|space] \"OS string\" (OPTIONAL)." + echo " The name of the Operating system." + echo " Supported OSes: linux macosx." + echo " Default: current OS." + echo + #--- + echo " -plat|--plat [=|space] \"platform\" (OPTIONAL)." + echo " The name of the compute HPC platform to consider." + echo " Selecting a platform, environment modules specific to that platform are loaded" + echo " and corresponding environment variables are set." + echo " Supported platforms: cheyenne gaea hera jet orion stampede wcoss." + echo " Default: none." + echo + #--- + echo " -v|--v|-verbose|--verbose [=|space] \"a,b,v,i,j,m,n\" (any combination, OPTIONAL)." + echo " Enable verbosity in the make files during compilation." + echo " a (all) : all types of debugging output are enabled" + echo " n (none) : disable all debugging currently enabled" + echo " b (basic) : basic debugging and whether the build was successful or not" + echo " v (verbose) : a level above basic" + echo " i (implicit) : prints messages describing the implicit rule searches for each target" + echo " j (jobs) : prints messages giving details on the invocation of specific sub-commands" + echo " m (makefile) : enables messages while rebuilding makefiles" + echo " Default:none." + echo + #--- + + exit 0 +} + +###======================================== +### checkFuncOpt() +### Usage: checkFuncOpt opt_name +### Parameters: +### opt_name: The name of the option to a function +### +### Returns : Exits on error +### +### Exports : __OPTION_LIST +### +### Echoes : NONE +### +### checkFuncOpt: Checks if an option to a function is already supplied. +###======================================== +checkFuncOpt() { + local opt_inp opt_list + + [ $# -eq 0 ] && return -1 + + opt_inp="$( strTrim "${1}" 2 )" + opt_inp="$( echo "${opt_inp}" | sed 's/^[-]*//' )" + + opt_list="$( strTrim "${__OPTION_LIST}" 2 )" + [ -n ${opt_list:+1} ] && \ + opt_list=":$( echo "${opt_list}" | sed 's/ /:/g' ):" + + [ "$( echo "${opt_list}" | egrep -o ":${opt_inp}:" )" ] && return 1 + + __OPTION_LIST="${__OPTION_LIST} ${opt_inp}" + export __OPTION_LIST + + return 0 +} + +###======================================== +### isInteger() +### Usage: isInteger var +### Parameters: var +### Returns: 1 if var is not an integer (0 is an integer as well) +### 0 in any other case +### Echoes: NONE +###======================================== +isInteger() +{ + local -i retval=1 + + [ $# -eq 0 ] && return ${retval} + + if [ "${1:-UNDEF}" -eq "${1}" ] 2>/dev/null + then + retval=0 + fi + + return ${retval} +} + +###======================================== +### getInteger() +### Usage: getInteger int +### Parameters: int (int >=0 or, int < 0) +### Returns: 1 if var is not an integer +### 0 in any other case +### Echoes: int, if it is a valid integer (including 0), +### in any other case echoes an empty string +###======================================== +getInteger() +{ + local -i retval=0 + local echoval= minus= + + # strip spaces, '+' signs and '-' signs + # if the first character of the string is '-', set the minus variable + echoval="$( echo "${1}" | sed 's/[[:space:]+]//g' )" + [ "X$( echo "${echoval:0:1}" )" = "X-" ] && minus="-" + echoval="${minus}$( echo "${echoval}" | sed 's/[[:space:]-]//g' )" + + if isInteger ${echoval}; then + echoval="$(echo "scale=0; ${echoval} + 0" | bc -ql 2>/dev/null)" + retval=$? + echoval="${echoval:-0}" + else + echoval= + retval=1 + fi + + echo -n ${echoval} + + return ${retval} +} + +###======================================== +### getPosInteger() +### Usage: getPosInteger posint +### Parameters: posint (posint >= 0) +### Returns: 1 if var is not a positive integer +### 0 in any other case +### Echoes: posint if it is a valid positive integer +### (including 0), in any other case echoes an +### empty string +###======================================== +getPosInteger() +{ + local -i retval=0 + local echoval= + + echoval=$( getInteger "${1}" ) + retval=$? + + if [ ${retval} -ne 0 ] ; then + echoval= + retval=1 + else + if [ ${echoval} -lt 0 ]; then + echoval= + retval=1 + fi + fi + + echo -n ${echoval} + + return ${retval} +} + +###======================================== +### getYesNo() +### Usage: getYesNo value +### Parameters: +### value : The input value (the value of a parameter) +### The value of a bash parameter that is checked +### against TRUE/FALSE. If the value is one of: +### ">=1|y|yes|yea|yeah|yep" +### then the value of parameter is TRUE (answer = yes). +### If the value is one of: +### "<=0|n|no|not|nop|nope" +### then the value of parameter is FALSE (answer = no). +### If the value is empty then the value of parameter +### is FALSE (answer = no) +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : A "yes" or "no" answer. +### +### getYesNo: Checks if a parameter is assigned a TRUE/FALSE value. +###======================================== +getYesNo() +{ + local param answer + + param="$( echo "${1}" | tr '[:upper:]' '[:lower:]' )" + + if [ "${param}" -eq "${param}" ] 2>/dev/null + then + [ ${param} -le 0 ] && param=0 + [ ${param} -gt 0 ] && param=1 + fi + + case "${param}" in + 1|y|yes|yea|yeah|yep) answer="yes" ;; + 0|n|no|not|nop|nope) answer="no" ;; + *) answer="" ;; # DEFAULT + esac + + echo -n "${answer}" +} + +###======================================== +### toUPPER() +### Usage: toUPPER string +### Parameters: +### string : The string in to convert +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : The input string converted to an all upper case string +### +### toUPPER: Converts a string to an all upper case string +###======================================== +function toUPPER() +{ + echo "${1}" | tr '[:lower:]' '[:upper:]' +} + +###======================================== +### toLOWER() +### Usage: toLOWER string +### Parameters: +### string : The string in to convert +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : The input string converted to an all lower case string +### +### toLOWER: Converts a string to an all lower case string +###======================================== +function toLOWER() +{ + echo "${1}" | tr '[:upper:]' '[:lower:]' +} + +###======================================== +### strESC() +### Usage: strESC string +### Parameters: +### string : The input string +### The input string on which this function is applied +### to escape special characters used in bash/sed ... +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : The modified string with its special characters escaped +### +### strESC: Escapes special characters in a string: "'()/[]*. +###======================================== +strESC() +{ + echo -n "$( echo "${*}" | sed -e "s/[\"\'\(\)\/\*\!]/\\\&/g;s/\[/\\\&/g;s/\]/\\\&/g" )" +} + +strESC1() +{ + echo -n "$( echo "${*}" | sed -e "s/[\&\/\*\!]/\\\&/g;s/\[/\\\&/g;s/\]/\\\&/g" )" +} + +###======================================== +### strTrim() +### Usage: strTrim s1 flag +### Parameters: +### s1 : The input string +### flag : Integer +### A value that controls the action of strTrim. +### If flag is zero or not present, trailing blanks are removed. +### Leading blanks are removed if it is equal to 1. +### Both are removed if it is equal to 2. +### In any other case, trailing blanks are removed. +### +### Returns : NONE +### +### Exports : NONE +### +### Echoes : s1 with all leading and/or trailing +### white spaces removed. +### +### strTrim: Removes all leading and/or trailing white spaces +### from the input string +###======================================== +function strTrim () +{ + local trimFLG="${2:-0}" + local out_str= + + case ${trimFLG} in + 0) out_str="$(echo "${1}" | sed 's/[[:space:]]*$//')" ;; + 1) out_str="$(echo "${1}" | sed 's/^[[:space:]]*//')" ;; + 2) out_str="$(echo "${1}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" ;; + *) out_str="$(echo "${1}" | sed 's/[[:space:]]*$//')" ;; + esac + + echo -n ${out_str} +} + +compileNems() { + local cmp_type cmp_make cmp_comp cmp_mjob + local err=0 + + [ $# -eq 0 ] && return ${err} + + cmp_type="$( toLOWER "${1}" )" + cmp_make=GNUmakefile + cmp_comp="${COMPONENT:+COMPONENTS=\"${COMPONENT}\"}" + cmp_mjob="${PARMAKE:+-j ${PARMAKE}}" + cmp_verb="${VERBOSE:+--debug=${VERBOSE}}" + + case "${cmp_type}" in + "clean"|"distclean" ) + if [ -f "${cmp_make}" ]; then + echo + echo "compileNems :: Cleaning: make -f ${cmp_make} ${cmp_type} ${cmp_comp}" + eval "make ${cmp_verb} -f ${cmp_make} ${cmp_type} ${cmp_comp}" + err=$? + + if [ "${cmp_type}" == "distclean" ]; then + rm -f NEMS/exe/NEMS-*.x + fi + else + echo "compileNems :: Cleaning: no makefile found: makefile = ${cmp_make}" + err=1 + fi + ;; + "build"|"compile" ) + if [ -f "${cmp_make}" ]; then + echo + echo "compileNems :: Compiling: make ${cmp_mjob} -f ${cmp_make} ${cmp_type} ${cmp_comp}" + eval "make ${cmp_verb} ${cmp_mjob} -f ${cmp_make} ${cmp_type} ${cmp_comp}" + err=$? + else + echo "compileNems :: Compiling: no makefile found: makefile = ${cmp_make}" + err=1 + fi + ;; + * ) err=0 ;; # Do nothing + esac + + return ${err} +} + +installNems() { + local cmp_comp icmp + local instdir + local CPBIN="/bin/cp -fpv" + local RMBIN="/bin/rm -fv" + + instdir="ALLBIN_INSTALL" + + cmp_comp="${COMPONENT}" + + [ ! -d "${instdir}" ] && mkdir -p ${instdir} + + for icmp in ${cmp_comp} + do + indir="${icmp}_INSTALL" + + if [ -d ${indir} ]; then + echo + echo " --- Installing from: ${indir} to ${instdir} ---" + ${CPBIN} ${indir}/* ${instdir}/ + fi + + ###### Extra ADCIRC files + if [ "${icmp}" == "ADCIRC" ]; then + echo + echo " --- Installing from: ${icmp} to ${instdir} ---" + for iprog in adcprep + do + prog="$( find ${icmp} -type f -name ${iprog} | head -1 )" + if [ -n "${prog:+1}" ]; then + ${CPBIN} ${prog} ${instdir}/ + fi + done + fi + ###### + done + + ###### Install the NEMS/exe/NEMS* files + echo + echo " --- Installing from: NEMS/exe to ${instdir} ---" + for iprog in NEMS/exe/NEMS-*.x + do + if [ -f "${iprog}" ]; then + ${CPBIN} ${iprog} ${instdir}/ + fi + done + + ###### Remove un-needed files from instdir + echo + echo " --- Removing files that are not needed from: ${instdir} ---" + ${RMBIN} ${instdir}/*.mk ${instdir}/*.mod +}