diff --git a/.gitmodules b/.gitmodules index 53771378..f9b6d62a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,7 @@ path = NWM url = https://github.com/noaa-ocs-modeling/nwm_public_nuopc.git branch = master +[submodule "PAHM"] + path = PAHM + url = https://github.com/noaa-ocs-modeling/PaHM + branch = main diff --git a/ADCIRC b/ADCIRC index 21341677..ff63e07a 160000 --- a/ADCIRC +++ b/ADCIRC @@ -1 +1 @@ -Subproject commit 21341677cac14dece960623b5a5b74323339fae9 +Subproject commit ff63e07a3563448582c7ca01c6ed19df96d23fc0 diff --git a/ATMESH b/ATMESH index da054839..7aab919a 160000 --- a/ATMESH +++ b/ATMESH @@ -1 +1 @@ -Subproject commit da054839ce8277049413bcdcd84a98952095952c +Subproject commit 7aab919a12b165cf9a65498d566575cd86659cbc diff --git a/NEMS b/NEMS index 7cf93063..33bfd89e 160000 --- a/NEMS +++ b/NEMS @@ -1 +1 @@ -Subproject commit 7cf930637f6bc49d1974c354800eb1d25d3ba641 +Subproject commit 33bfd89e15ae332e786fcb1677dd74dde8fe2eba diff --git a/PAHM b/PAHM new file mode 160000 index 00000000..7fe688fb --- /dev/null +++ b/PAHM @@ -0,0 +1 @@ +Subproject commit 7fe688fbf3e12e1e3406935aa87a73ef24411e4f diff --git a/WW3 b/WW3 index 60610eb5..9726c8b6 160000 --- a/WW3 +++ b/WW3 @@ -1 +1 @@ -Subproject commit 60610eb5f7a79b8d8bf41a02f078a691bf0506c8 +Subproject commit 9726c8b6757b3578493b4ed1653abc90a76fcf0d diff --git a/build.sh b/build.sh index 7def0452..8538245c 120000 --- a/build.sh +++ b/build.sh @@ -1 +1 @@ -scripts/build-v1.1.sh \ No newline at end of file +scripts/build.sh \ No newline at end of file diff --git a/conf/configure.coastal_app.hera b/conf/configure.coastal_app.hera deleted file mode 100755 index f18a4701..00000000 --- a/conf/configure.coastal_app.hera +++ /dev/null @@ -1,168 +0,0 @@ -## NEMS configuration file -## -## Platform: Theia -## Compiler: Intel with IntelMPI - -SHELL=/bin/sh - -################################################################################ -## Include the common configuration parts - -ifdef InNemsMakefile -include $(TOP)/conf/configure.nems.NUOPC -endif - -###################### PHYS_MODE ##### CHEM_MODE ############################### -# -# -# - -PHYS_MODE =compile -CHEM_MODE =compile -ifeq ($(PHYS_MODE),compile) - PHYS_LIB = $(TOP)/atmos/gsm/gsmphys - PHYS_INC = $(TOP)/atmos/gsm/gsmphys - PHYS_DIR = $(TOP)/atmos/gsm/gsmphys -endif -ifeq ($(CHEM_MODE),compile) - CHEM_LIB = $(TOP)/chem - CHEM_INC = $(TOP)/chem/gocart/src/Config/ - CHEM_DIR = $(TOP)/chem - CHEM_MOD = $(TOP)/chem/gocart/${ARCH}/include - ESMADIR = chem/gocart -endif - -############ -# commands # -############ -FC = mpiifort -CC = mpiicc -CXX = mpiicpc -LD = mpiifort -mkl=sequential - -######### -# flags # -######### -# default is 64-bit OpenMP non-hydrostatic build using AVX2 -DEBUG = -REPRO = -VERBOSE = -OPENMP = Y -AVX2 = Y -HYDRO = N - -include $(ESMFMKFILE) -ESMF_INC = $(ESMF_F90COMPILEPATHS) - -NCEPLIBS = $(BACIO_LIB4) $(SP_LIBd) $(W3EMC_LIBd) $(W3NCO_LIBd) - -############################################## -# Need to use at least GNU Make version 3.81 # -############################################## -need := 3.81 -ok := $(filter $(need),$(firstword $(sort $(MAKE_VERSION) $(need)))) -ifneq ($(need),$(ok)) -$(error Need at least make version $(need). Load module gmake/3.81) -endif - -NETCDF_ROOT = $(NETCDF) -INCLUDE = -I$(NETCDF_ROOT)/include -NETCDF_INC = -I$(NETCDF_ROOT)/include -ifneq ($(findstring netcdf/4,$(LOADEDMODULES)),) - NETCDF_LIB += -L$(NETCDF)/lib -lnetcdff -lnetcdf -else - NETCDF_LIB += -L$(NETCDF)/lib -lnetcdff -lnetcdf -endif - -FPPFLAGS := -fpp -Wp,-w $(INCLUDE) -CFLAGS := $(INCLUDE) - -FFLAGS := $(INCLUDE) -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte - -ifeq ($(HYDRO),Y) -CPPDEFS += -Duse_libMPI -Duse_netCDF -DSPMD -DUSE_LOG_DIAG_FIELD_INFO -Duse_LARGEFILE -DUSE_GFSL63 -DGFS_PHYS -else -CPPDEFS += -Duse_libMPI -Duse_netCDF -DSPMD -DUSE_LOG_DIAG_FIELD_INFO -Duse_LARGEFILE -DUSE_GFSL63 -DGFS_PHYS -DMOIST_CAPPA -DUSE_COND -endif - -CPPDEFS += -DNEW_TAUCTMAX - -ifeq ($(32BIT),Y) -CPPDEFS += -DOVERLOAD_R4 -FFLAGS += -i4 -real-size 32 -else -FFLAGS += -i4 -real-size 64 -no-prec-div -no-prec-sqrt -endif - -ifeq ($(AVX2),Y) -FFLAGS += -xCORE-AVX2 -qno-opt-dynamic-align -CFLAGS += -xCORE-AVX2 -qno-opt-dynamic-align -else -FFLAGS += -xHOST -qno-opt-dynamic-align -CFLAGS += -xHOST -qno-opt-dynamic-align -endif - -FFLAGS_OPT = -O2 -debug minimal -fp-model source -qoverride-limits -qopt-prefetch=3 -FFLAGS_REPRO = -O2 -debug minimal -fp-model source -qoverride-limits -g -traceback -FFLAGS_DEBUG = -g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fp-stack-check -fstack-protector-all -fpe0 -debug -traceback -ftrapuv - -TRANSCENDENTALS := -fast-transcendentals -FFLAGS_OPENMP = -qopenmp -FFLAGS_VERBOSE = -v -V -what - -CFLAGS += -D__IFC -sox -fp-model source - -CFLAGS_OPT = -O2 -debug minimal -CFLAGS_REPRO = -O2 -debug minimal -CFLAGS_OPENMP = -qopenmp -CFLAGS_DEBUG = -O0 -g -ftrapuv -traceback - -# Optional Testing compile flags. Mutually exclusive from DEBUG, REPRO, and OPT -# *_TEST will match the production if no new option(s) is(are) to be tested. -FFLAGS_TEST = -O3 -debug minimal -fp-model source -qoverride-limits -CFLAGS_TEST = -O2 - -LDFLAGS := -LDFLAGS_OPENMP := -qopenmp -LDFLAGS_VERBOSE := -Wl,-V,--verbose,-cref,-M - -# start with blank LIBS -LIBS := - -ifneq ($(REPRO),) -CFLAGS += $(CFLAGS_REPRO) -FFLAGS += $(FFLAGS_REPRO) -FAST := -else ifneq ($(DEBUG),) -CFLAGS += $(CFLAGS_DEBUG) -FFLAGS += $(FFLAGS_DEBUG) -FAST := -else ifneq ($(TEST),) -CFLAGS += $(CFLAGS_TEST) -FFLAGS += $(FFLAGS_TEST) -FAST := -else -CFLAGS += $(CFLAGS_OPT) -FFLAGS += $(FFLAGS_OPT) -FAST := $(TRANSCENDENTALS) -endif - -ifneq ($(OPENMP),) -CFLAGS += $(CFLAGS_OPENMP) -FFLAGS += $(FFLAGS_OPENMP) -LDFLAGS += $(LDFLAGS_OPENMP) -endif - -ifneq ($(VERBOSE),) -CFLAGS += $(CFLAGS_VERBOSE) -FFLAGS += $(FFLAGS_VERBOSE) -LDFLAGS += $(LDFLAGS_VERBOSE) -endif - -LDFLAGS += $(LIBS) - -ifdef InNemsMakefile -FFLAGS += $(ESMF_INC) -CPPFLAGS += -traditional -EXTLIBS = $(NCEPLIBS) $(ESMF_LIB) $(LDFLAGS) $(NETCDF_LIB) -endif \ No newline at end of file diff --git a/conf/configure.nems.hera.intel b/conf/configure.nems.hera.intel index 66a3ab3d..5cb63fba 100644 --- a/conf/configure.nems.hera.intel +++ b/conf/configure.nems.hera.intel @@ -12,11 +12,15 @@ include $(TOP)/conf/configure.nems.NUOPC ################################################################################ ## Other settings -NETCDF_INC = -I$(NETCDF)/include -NETCDF_LIB = -L$(NETCDF)/lib -lnetcdf +LIBDIR ?= . -NEMSIO_INC = -I${LIBDIR}/incmod/nemsio -NEMSIO_LIB = -L${LIBDIR} -lnemsio +NETCDF_INC = -I${NETCDF_INCDIR} +NETCDF_LIB = -L${NETCDF_LIBDIR} -lnetcdf + +#NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +#NEMSIO_LIB = -L${LIBDIR} -lnemsio +NEMSIO_INC = +NEMSIO_LIB = SYS_LIB = EXTLIBS = $(NEMSIO_LIB) \ diff --git a/conf/configure.nems.linux.gnu b/conf/configure.nems.linux.gnu index d1aee7e4..84c33b55 100644 --- a/conf/configure.nems.linux.gnu +++ b/conf/configure.nems.linux.gnu @@ -12,11 +12,15 @@ include $(TOP)/conf/configure.nems.NUOPC ################################################################################ ## Other settings -NETCDF_INC = -I$(NETCDF_INCDIR) -NETCDF_LIB = -L$(NETCDF_LIBDIR) -lnetcdf +LIBDIR ?= . -NEMSIO_INC = -I${LIBDIR}/incmod/nemsio -NEMSIO_LIB = -L${LIBDIR} -lnemsio +NETCDF_INC = -I${NETCDF_INCDIR} +NETCDF_LIB = -L${NETCDF_LIBDIR} -lnetcdf + +#NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +#NEMSIO_LIB = -L${LIBDIR} -lnemsio +NEMSIO_INC = +NEMSIO_LIB = SYS_LIB = EXTLIBS = $(NEMSIO_LIB) \ @@ -30,7 +34,7 @@ EXTLIBS_POST = $(NEMSIO_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 +F77 = mpifort -g -ffree-line-length-none -fno-range-check -fbacktrace FREE = -free FIXED = -fixed R8 = -r8 @@ -38,7 +42,7 @@ R8 = -r8 FINCS = $(ESMF_INC) $(NEMSIO_INC) $(NETCDF_INC) #TRAPS = ??? -FFLAGS = $(TRAPS) $(FINCS) -fp-model strict +FFLAGS = $(TRAPS) $(FINCS) OPTS_NMM = -g -ffree-line-length-none -fno-range-check -fbacktrace $(FREE) diff --git a/conf/configure.nems.linux.intel b/conf/configure.nems.linux.intel index a3229932..f603e401 100644 --- a/conf/configure.nems.linux.intel +++ b/conf/configure.nems.linux.intel @@ -12,11 +12,15 @@ include $(TOP)/conf/configure.nems.NUOPC ################################################################################ ## Other settings -NETCDF_INC = -I$(NETCDF_INCDIR) -NETCDF_LIB = -L$(NETCDF_LIBDIR) -lnetcdf +LIBDIR ?= . -NEMSIO_INC = -I${LIBDIR}/incmod/nemsio -NEMSIO_LIB = -L${LIBDIR} -lnemsio +NETCDF_INC = -I${NETCDF_INCDIR} +NETCDF_LIB = -L${NETCDF_LIBDIR} -lnetcdf + +#NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +#NEMSIO_LIB = -L${LIBDIR} -lnemsio +NEMSIO_INC = +NEMSIO_LIB = SYS_LIB = EXTLIBS = $(NEMSIO_LIB) \ diff --git a/conf/configure.nems.linux.pgi b/conf/configure.nems.linux.pgi index 81674d2d..30e35ca3 100644 --- a/conf/configure.nems.linux.pgi +++ b/conf/configure.nems.linux.pgi @@ -12,11 +12,15 @@ include $(TOP)/conf/configure.nems.NUOPC ################################################################################ ## Other settings -NETCDF_INC = -I$(NETCDF_INCDIR) -NETCDF_LIB = -L$(NETCDF_LIBDIR) -lnetcdf +LIBDIR ?= . -NEMSIO_INC = -I${LIBDIR}/incmod/nemsio -NEMSIO_LIB = -L${LIBDIR} -lnemsio +NETCDF_INC = -I${NETCDF_INCDIR} +NETCDF_LIB = -L${NETCDF_LIBDIR} -lnetcdf + +#NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +#NEMSIO_LIB = -L${LIBDIR} -lnemsio +NEMSIO_INC = +NEMSIO_LIB = SYS_LIB = EXTLIBS = $(NEMSIO_LIB) \ diff --git a/conf/configure.nems.ndcrc.intel b/conf/configure.nems.ndcrc.intel index ce0df05b..d50c84b4 100644 --- a/conf/configure.nems.ndcrc.intel +++ b/conf/configure.nems.ndcrc.intel @@ -14,8 +14,10 @@ include $(TOP)/conf/configure.nems.NUOPC ################################################################################ ## Other settings -NETCDF_INC = -I$(NETCDF)/include -NETCDF_LIB = -L$(NETCDF)/lib -lnetcdff +LIBDIR ?= . + +NETCDF_INC = -I${NETCDF_INCDIR} +NETCDF_LIB = -L${NETCDF_LIBDIR} -lnetcdf NEMSIO_INC = -I${LIBDIR}/incmod/nemsio NEMSIO_LIB = -L${LIBDIR} -lnemsio diff --git a/conf/configure.nems.orion.gnu b/conf/configure.nems.orion.gnu new file mode 100644 index 00000000..8b2158ef --- /dev/null +++ b/conf/configure.nems.orion.gnu @@ -0,0 +1,61 @@ +## 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 + +LIBDIR ?= . + +NETCDF_INC = -I${NETCDF_INCDIR} +NETCDF_LIB = -L${NETCDF_LIBDIR} -lnetcdf + +#NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +#NEMSIO_LIB = -L${LIBDIR} -lnemsio +NEMSIO_INC = +NEMSIO_LIB = +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 +FFLAGS = $(TRAPS) $(FINCS) + +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.orion.intel b/conf/configure.nems.orion.intel new file mode 100644 index 00000000..acaa296c --- /dev/null +++ b/conf/configure.nems.orion.intel @@ -0,0 +1,61 @@ +## 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 + +LIBDIR ?= . + +NETCDF_INC = -I${NETCDF_INCDIR} +NETCDF_LIB = -L${NETCDF_LIBDIR} -lnetcdf + +#NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +#NEMSIO_LIB = -L${LIBDIR} -lnemsio +NEMSIO_INC = +NEMSIO_LIB = +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 +FFLAGS = $(TRAPS) $(FINCS) + +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.orion.pgi b/conf/configure.nems.orion.pgi new file mode 100644 index 00000000..d07eff29 --- /dev/null +++ b/conf/configure.nems.orion.pgi @@ -0,0 +1,61 @@ +## 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 + +LIBDIR ?= . + +NETCDF_INC = -I${NETCDF_INCDIR} +NETCDF_LIB = -L${NETCDF_LIBDIR} -lnetcdf + +#NEMSIO_INC = -I${LIBDIR}/incmod/nemsio +#NEMSIO_LIB = -L${LIBDIR} -lnemsio +NEMSIO_INC = +NEMSIO_LIB = +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 +FFLAGS = $(TRAPS) $(FINCS) + +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/externals.nems b/conf/externals.nems index 7d3e85ad..ddd36b87 100644 --- a/conf/externals.nems +++ b/conf/externals.nems @@ -1,2 +1 @@ # Location of external components - diff --git a/conf/externals.nems.hera b/conf/externals.nems.hera old mode 100755 new mode 100644 diff --git a/conf/externals.nems.hera.rej b/conf/externals.nems.hera.rej deleted file mode 100644 index a8f60eee..00000000 --- a/conf/externals.nems.hera.rej +++ /dev/null @@ -1,8 +0,0 @@ ---- 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/modulefiles/PlatformFuncs b/modulefiles/PlatformFuncs index 32316f65..26759173 100644 --- a/modulefiles/PlatformFuncs +++ b/modulefiles/PlatformFuncs @@ -3,99 +3,148 @@ ### PlatformFuncs :: Utility functions ### ### Author: Panagiotis Velissariou +### Date: June 26 2021 ########################################################################### +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} +} + 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 + local _DEFINED_HDF5 + local _hdf5_env_name + local _name _var _var_val + + _DEFINED_HDF5=FALSE + _hdf5_env_name="$( strTrim "$( echo "${1:-}" )" 2 )" + + if [ -n "${_hdf5_env_name:+1}" ]; then + _hdf5_env_name="$( eval echo "\$${_hdf5_env_name}" )" + if [ -n "${_hdf5_env_name:+1}" ]; then + export HDF5="${_hdf5_env_name}" + export HDF5HOME="${_hdf5_env_name}" + export HDF5_DIR="${_hdf5_env_name}" + export HDF5_PATH="${_hdf5_env_name}" + export HDF5_ROOT="${_hdf5_env_name}" + _DEFINED_HDF5=TRUE + fi + fi + + if [ "${_DEFINED_HDF5:-FALSE}" != "TRUE" ]; then + _hdf5_env_name="${HDF5}" + if [ -n "${_hdf5_env_name:+1}" ]; then + export HDF5HOME="${_hdf5_env_name}" + export HDF5_DIR="${_hdf5_env_name}" + export HDF5_PATH="${_hdf5_env_name}" + export HDF5_ROOT="${_hdf5_env_name}" + _DEFINED_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 + _hdf5_env_name="$(eval "echo \"\$HDF5${_var}\"")" + if [ -n "${_hdf5_env_name:+1}" ]; then + export HDF5="${_hdf5_env_name}" + export HDF5HOME="${_hdf5_env_name}" + export HDF5_DIR="${_hdf5_env_name}" + export HDF5_PATH="${_hdf5_env_name}" + export HDF5_ROOT="${_hdf5_env_name}" + _DEFINED_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 + _hdf5_env_name="$(eval "echo \"\$HDF5_${_var}\"")" + if [ -n "${_hdf5_env_name:+1}" ]; then + export HDF5="${_hdf5_env_name}" + export HDF5HOME="${_hdf5_env_name}" + export HDF5_DIR="${_hdf5_env_name}" + export HDF5_PATH="${_hdf5_env_name}" + export HDF5_ROOT="${_hdf5_env_name}" + _DEFINED_HDF5=TRUE break fi fi done fi - unset _name _var _var_val -# fi + fi return 0 } - get_env_netcdf() { -# if [ "${_found_netcdf:-FALSE}" = "FALSE" ]; then - export _found_netcdf=FALSE + local _DEFINED_NETCDF + local _netcdf_env_name + local _name _var _var_val + + _DEFINED_NETCDF=FALSE + _netcdf_env_name="$( strTrim "$( echo "${1:-}" )" 2 )" + + if [ -n "${_netcdf_env_name:+1}" ]; then + _netcdf_env_name="$( eval echo "\$${_netcdf_env_name}" )" + if [ -n "${_netcdf_env_name:+1}" ]; then + export netcdf="${_netcdf_env_name}" + export netcdfHOME="${_netcdf_env_name}" + export netcdf_DIR="${_netcdf_env_name}" + export netcdf_PATH="${_netcdf_env_name}" + export netcdf_ROOT="${_netcdf_env_name}" + _DEFINED_NETCDF=TRUE + fi + fi + + if [ "${_DEFINED_NETCDF:-FALSE}" != "TRUE" ]; then for _name in NETCDF NETCDF4 NetCDF NetCDF4 do - if [ "${_found_netcdf}" = "TRUE" ]; then + if [ "${_DEFINED_NETCDF:-FALSE}" = "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 + _netcdf_env_name="$(eval "echo \"\$${_name}\"")" + if [ -n "${_netcdf_env_name:+1}" ]; then + export NETCDF="${_netcdf_env_name}" + export NETCDFHOME="${_netcdf_env_name}" + export NETCDF_DIR="${_netcdf_env_name}" + export NETCDF_PATH="${_netcdf_env_name}" + export NETCDF_ROOT="${_netcdf_env_name}" + _DEFINED_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 + _netcdf_env_name="$(eval "echo \"\$${_name}${_var}\"")" + if [ -n "${_netcdf_env_name:+1}" ]; then + export NETCDF="${_netcdf_env_name}" + export NETCDFHOME="${_netcdf_env_name}" + export NETCDF_DIR="${_netcdf_env_name}" + export NETCDF_PATH="${_netcdf_env_name}" + export NETCDF_ROOT="${_netcdf_env_name}" + _DEFINED_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 + _netcdf_env_name="$(eval "echo \"\$${_name}_${_var}\"")" + if [ -n "${_netcdf_env_name:+1}" ]; then + export NETCDF="${_netcdf_env_name}" + export NETCDFHOME="${_netcdf_env_name}" + export NETCDF_DIR="${_netcdf_env_name}" + export NETCDF_PATH="${_netcdf_env_name}" + export NETCDF_ROOT="${_netcdf_env_name}" + _DEFINED_NETCDF=TRUE break fi fi done fi done - unset _name _var _var_val -# fi + fi return 0 } diff --git a/modulefiles/envmodules_gnu.cheyenne b/modulefiles/envmodules_gnu.cheyenne index 23899380..60bdd6c5 100644 --- a/modulefiles/envmodules_gnu.cheyenne +++ b/modulefiles/envmodules_gnu.cheyenne @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.custom b/modulefiles/envmodules_gnu.custom new file mode 100644 index 00000000..c874cd5f --- /dev/null +++ b/modulefiles/envmodules_gnu.custom @@ -0,0 +1,53 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + +# 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 gnu openmpi +module load hdf5 netcdf + +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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.gaea b/modulefiles/envmodules_gnu.gaea index b7e83e4a..60bdd6c5 100644 --- a/modulefiles/envmodules_gnu.gaea +++ b/modulefiles/envmodules_gnu.gaea @@ -1,8 +1,23 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 @@ -17,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.hera b/modulefiles/envmodules_gnu.hera index 23899380..60bdd6c5 100644 --- a/modulefiles/envmodules_gnu.hera +++ b/modulefiles/envmodules_gnu.hera @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.jet b/modulefiles/envmodules_gnu.jet index 23899380..60bdd6c5 100644 --- a/modulefiles/envmodules_gnu.jet +++ b/modulefiles/envmodules_gnu.jet @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.linux b/modulefiles/envmodules_gnu.linux index d8646ca5..c2152050 100644 --- a/modulefiles/envmodules_gnu.linux +++ b/modulefiles/envmodules_gnu.linux @@ -1,12 +1,21 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # 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 gnu openmpi #module load szip hdf5 module load netcdf @@ -17,15 +26,29 @@ 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}" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi unset funcs -get_env_hdf5 -get_env_netcdf +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.local b/modulefiles/envmodules_gnu.local deleted file mode 100644 index b7e83e4a..00000000 --- a/modulefiles/envmodules_gnu.local +++ /dev/null @@ -1,28 +0,0 @@ -#!/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.macosx b/modulefiles/envmodules_gnu.macosx index 5cb700e1..82b1f8e1 100644 --- a/modulefiles/envmodules_gnu.macosx +++ b/modulefiles/envmodules_gnu.macosx @@ -1,27 +1,60 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 purge +module load gcc openmpi +module load szip hdf5 +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. - -export HDF5HOME=${HDF5} -export NETCDFHOME=${NETCDF} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.mistral b/modulefiles/envmodules_gnu.mistral new file mode 100644 index 00000000..96fc8762 --- /dev/null +++ b/modulefiles/envmodules_gnu.mistral @@ -0,0 +1,65 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 cmake/3.17.1-gcc-9.1.0 +module load gcc openmpi +module load netcdf-c +module load netcdf-fortran + +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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +# use this more complicated one to address ADCIRC demands +export NETCDFHOME="$(nf-config --prefix)/include $(nf-config --flibs) $(nc-config --prefix)" +export NETCDFPATH=$(nc-config --prefix) +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} + +export NETCDF_INCDIR="$(nc-config --includedir) -I$(nf-config --includedir)" +export NETCDF_LIBDIR="$(nc-config --prefix)/lib $(nf-config --flibs)" + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.orion b/modulefiles/envmodules_gnu.orion index d90402b3..9d2c6d4d 100644 --- a/modulefiles/envmodules_gnu.orion +++ b/modulefiles/envmodules_gnu.orion @@ -1,8 +1,17 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # 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 @@ -16,12 +25,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDF_INCLUDE_DIRS} export NETCDF_LIBDIR=${NETCDF_LIBRARY_DIRS} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.stampede b/modulefiles/envmodules_gnu.stampede index 2cc88d56..b9e1ea4a 100644 --- a/modulefiles/envmodules_gnu.stampede +++ b/modulefiles/envmodules_gnu.stampede @@ -1,8 +1,23 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 @@ -17,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 TACC_HDF5_DIR + get_env_netcdf TACC_NETCDF_DIR +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${TACC_NETCDF_BIN}/nc-config export NETCDF_INCDIR=${TACC_NETCDF_INC} export NETCDF_LIBDIR=${TACC_NETCDF_LIB} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.strand b/modulefiles/envmodules_gnu.strand new file mode 100644 index 00000000..acbdd14a --- /dev/null +++ b/modulefiles/envmodules_gnu.strand @@ -0,0 +1,61 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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. + + +#################### +### Load all needed environment modules. +module purge +module load applications/utils/cmake3-20.0 +module load gcc openmpi +module load hdf5/1.10.5 netcdf/4.7.0 + +module load esmf/8.1.0 + + +#################### +### (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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDFHOME=$(nc-config --prefix) +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_gnu.wcoss b/modulefiles/envmodules_gnu.wcoss index 55c30263..60bdd6c5 100644 --- a/modulefiles/envmodules_gnu.wcoss +++ b/modulefiles/envmodules_gnu.wcoss @@ -1,28 +1,61 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 load gcc impi +module load szip hdf5 +module load netcdf -#module use /contrib/modulefiles -#module load esmf +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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.cheyenne b/modulefiles/envmodules_intel.cheyenne index 4358bc8a..88e3f49c 100644 --- a/modulefiles/envmodules_intel.cheyenne +++ b/modulefiles/envmodules_intel.cheyenne @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.custom b/modulefiles/envmodules_intel.custom new file mode 100644 index 00000000..884a8242 --- /dev/null +++ b/modulefiles/envmodules_intel.custom @@ -0,0 +1,53 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + +# 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 netcdf + +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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.gaea b/modulefiles/envmodules_intel.gaea index 4358bc8a..88e3f49c 100644 --- a/modulefiles/envmodules_intel.gaea +++ b/modulefiles/envmodules_intel.gaea @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.hera b/modulefiles/envmodules_intel.hera index fb958359..93055c25 100644 --- a/modulefiles/envmodules_intel.hera +++ b/modulefiles/envmodules_intel.hera @@ -1,29 +1,58 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # 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 cmake 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.0bs25g_ParallelNetCDF.release +# Points always to the latest compiled version of ESMF. It uses the following +# HDF5/NetCDF libraries (not the system ones) +module use /scratch1/NCEPDEV/nems/emc.nemspara/soft/modulefiles +module load hdf5_parallel/1.10.6.release netcdf_parallel/4.7.4.release +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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## + diff --git a/modulefiles/envmodules_intel.hera-pre10172021 b/modulefiles/envmodules_intel.hera-pre10172021 new file mode 100644 index 00000000..190e58ee --- /dev/null +++ b/modulefiles/envmodules_intel.hera-pre10172021 @@ -0,0 +1,56 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + +# 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.0bs25g_ParallelNetCDF.release + + +################### +### (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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.hera.hpc-stack b/modulefiles/envmodules_intel.hera.hpc-stack new file mode 100644 index 00000000..fdce8062 --- /dev/null +++ b/modulefiles/envmodules_intel.hera.hpc-stack @@ -0,0 +1,62 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + +# This script is responsible for loading modules that are +# compatible with the NUOPC Layer version used in NEMS. + + +#################### +### (1) Load all needed environment modules. +use_defaults=0 +module purge +module use /scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/modulefiles/stack +module load hpc +module load cmake +if [ ${use_defaults:-0} -le 0 ]; then + module load hpc-intel/18.0.5.274 hpc-impi + module load szip hdf5 netcdf + module load esmf/8_1_1 +else + module load hpc-intel hpc-impi + module load szip hdf5 netcdf + module load esmf +fi + + +################### +### (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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.hera.orig b/modulefiles/envmodules_intel.hera.orig new file mode 100644 index 00000000..92458e30 --- /dev/null +++ b/modulefiles/envmodules_intel.hera.orig @@ -0,0 +1,54 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + +# 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. +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.hera.sys b/modulefiles/envmodules_intel.hera.sys new file mode 100644 index 00000000..190e58ee --- /dev/null +++ b/modulefiles/envmodules_intel.hera.sys @@ -0,0 +1,56 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + +# 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.0bs25g_ParallelNetCDF.release + + +################### +### (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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.jet b/modulefiles/envmodules_intel.jet index 4358bc8a..88e3f49c 100644 --- a/modulefiles/envmodules_intel.jet +++ b/modulefiles/envmodules_intel.jet @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.linux b/modulefiles/envmodules_intel.linux index d8646ca5..10a8cdb1 100644 --- a/modulefiles/envmodules_intel.linux +++ b/modulefiles/envmodules_intel.linux @@ -1,8 +1,17 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # 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 @@ -17,15 +26,29 @@ 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}" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi unset funcs -get_env_hdf5 -get_env_netcdf +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.local b/modulefiles/envmodules_intel.local deleted file mode 100644 index 6f8b0aa5..00000000 --- a/modulefiles/envmodules_intel.local +++ /dev/null @@ -1,29 +0,0 @@ -#!/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_intel.macosx b/modulefiles/envmodules_intel.macosx index 3b61d299..181c01e8 100644 --- a/modulefiles/envmodules_intel.macosx +++ b/modulefiles/envmodules_intel.macosx @@ -1,27 +1,60 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 purge +module load intel impi +module load szip hdf5 +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. - -export HDF5HOME=${HDF5} -export NETCDFHOME=${NETCDF} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.mistral b/modulefiles/envmodules_intel.mistral index bdafef0c..dd148d62 100644 --- a/modulefiles/envmodules_intel.mistral +++ b/modulefiles/envmodules_intel.mistral @@ -1,31 +1,54 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # This script is responsible for loading modules that are # compatible with the NUOPC Layer version used in NEMS. # # Adopted for DKRZ/mistral by Carsten Lemmen + #################### ### (1) Load all needed environment modules. module purge -module load intel -module load intelmpi -module load esmf +module load cmake/3.17.1-gcc-9.1.0 +module load intel intelmpi module load netcdf-c/4.7.4-intel-17.0.6 module load netcdf-fortran/4.5.3-intel-17.0.6 -module load cmake/3.17.1-gcc-9.1.0 + +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}" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi unset funcs -get_env_hdf5 -get_env_netcdf -#export NETCDFHOME=$(nc-config --prefix) +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + # use this more complicated one to address ADCIRC demands export NETCDFHOME="$(nf-config --prefix)/include $(nf-config --flibs) $(nc-config --prefix)" export NETCDFPATH=$(nc-config --prefix) @@ -35,3 +58,4 @@ export NETCDF_INCDIR="$(nc-config --includedir) -I$(nf-config --includedir)" export NETCDF_LIBDIR="$(nc-config --prefix)/lib $(nf-config --flibs)" export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.orion b/modulefiles/envmodules_intel.orion index 0e915c9f..bef335de 100644 --- a/modulefiles/envmodules_intel.orion +++ b/modulefiles/envmodules_intel.orion @@ -1,27 +1,55 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # 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 cmake +module load intel/2020 impi/2020 +module load szip hdf5/1.10.5-parallel +module load netcdf/4.7.2-parallel -module load esmf +module load esmf/8.0.0 #################### ### (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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDF_INCLUDE_DIRS} export NETCDF_LIBDIR=${NETCDF_LIBRARY_DIRS} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.orion.hpc-stack b/modulefiles/envmodules_intel.orion.hpc-stack new file mode 100644 index 00000000..95b00e7e --- /dev/null +++ b/modulefiles/envmodules_intel.orion.hpc-stack @@ -0,0 +1,61 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + +# This script is responsible for loading modules that are +# compatible with the NUOPC Layer version used in NEMS. + + +#################### +### (1) Load all needed environment modules. +use_defaults=0 +module purge +module use /apps/contrib/NCEP/libs/hpc-stack/modulefiles/stack +module load hpc +module load cmake +if [ ${use_defaults:-0} -le 0 ]; then + module load hpc-intel/2018.4 hpc-impi + module load szip hdf5 netcdf + module load esmf/8_1_1 +else + module load hpc-intel hpc-impi + module load szip hdf5 netcdf + module load esmf +fi + +#################### +### (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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDF_INCLUDES} +export NETCDF_LIBDIR=${NETCDF_LIBRARIES} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.orion.orig b/modulefiles/envmodules_intel.orion.orig new file mode 100644 index 00000000..5e850d15 --- /dev/null +++ b/modulefiles/envmodules_intel.orion.orig @@ -0,0 +1,54 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + +# 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. +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDF_INCLUDE_DIRS} +export NETCDF_LIBDIR=${NETCDF_LIBRARY_DIRS} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.orion.sys b/modulefiles/envmodules_intel.orion.sys new file mode 100644 index 00000000..9b174692 --- /dev/null +++ b/modulefiles/envmodules_intel.orion.sys @@ -0,0 +1,55 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + +# 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 cmake +module load intel/2019.5 impi +module load szip hdf5/1.10.5-parallel +module load netcdf/4.7.2-parallel + +module load esmf/7.1.0r + + +#################### +### (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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDF_INCLUDE_DIRS} +export NETCDF_LIBDIR=${NETCDF_LIBRARY_DIRS} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.stampede b/modulefiles/envmodules_intel.stampede index e613292e..d2d1cd48 100644 --- a/modulefiles/envmodules_intel.stampede +++ b/modulefiles/envmodules_intel.stampede @@ -1,5 +1,13 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # This script is responsible for loading modules that are # compatible with the NUOPC Layer version used in NEMS. @@ -17,12 +25,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 TACC_HDF5_DIR + get_env_netcdf TACC_NETCDF_DIR +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${TACC_NETCDF_BIN}/nc-config export NETCDF_INCDIR=${TACC_NETCDF_INC} export NETCDF_LIBDIR=${TACC_NETCDF_LIB} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.strand b/modulefiles/envmodules_intel.strand index 1117d0ea..d875ec7d 100644 --- a/modulefiles/envmodules_intel.strand +++ b/modulefiles/envmodules_intel.strand @@ -1,29 +1,54 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # This script is responsible for loading modules that are # compatible with the NUOPC Layer version used in NEMS. # # Adapted for hereon/strand by Carsten Lemmen -# Call with ./build.sh -plat strand from top directory # + + #################### ### Load all needed environment modules. module purge +module load applications/utils/cmake3-20.0 module load compilers/intel/2020.1.217 module load intelmpi/2020.1.217 -module load netcdf/4.7.0 hdf5/1.10.5 +module load hdf5/1.10.5 netcdf/4.7.0 + module load esmf/8.1.0 -module load applications/utils/cmake3-20.0 + #################### ### (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}" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi unset funcs -get_env_hdf5 -get_env_netcdf + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDFHOME=$(nc-config --prefix) export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} @@ -31,3 +56,4 @@ export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_intel.wcoss b/modulefiles/envmodules_intel.wcoss index 9f0662ad..88e3f49c 100644 --- a/modulefiles/envmodules_intel.wcoss +++ b/modulefiles/envmodules_intel.wcoss @@ -1,28 +1,61 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 load intel impi +module load szip hdf5 +module load netcdf -#module use /contrib/modulefiles -#module load esmf +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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.cheyenne b/modulefiles/envmodules_pgi.cheyenne index ecc1c9f0..9aee252b 100644 --- a/modulefiles/envmodules_pgi.cheyenne +++ b/modulefiles/envmodules_pgi.cheyenne @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.custom b/modulefiles/envmodules_pgi.custom new file mode 100644 index 00000000..841c3025 --- /dev/null +++ b/modulefiles/envmodules_pgi.custom @@ -0,0 +1,59 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 openmpi +module load hdf5 netcdf + +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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.gaea b/modulefiles/envmodules_pgi.gaea index b3f09057..9aee252b 100644 --- a/modulefiles/envmodules_pgi.gaea +++ b/modulefiles/envmodules_pgi.gaea @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -6,6 +14,10 @@ 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 @@ -20,12 +32,30 @@ 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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + -export HDF5HOME=${HDF5} -export NETCDFHOME=${NETCDF} +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.hera b/modulefiles/envmodules_pgi.hera index ecc1c9f0..4317ec8d 100644 --- a/modulefiles/envmodules_pgi.hera +++ b/modulefiles/envmodules_pgi.hera @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -20,15 +29,33 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.jet b/modulefiles/envmodules_pgi.jet index ecc1c9f0..9aee252b 100644 --- a/modulefiles/envmodules_pgi.jet +++ b/modulefiles/envmodules_pgi.jet @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.linux b/modulefiles/envmodules_pgi.linux index ca6adc62..a055dab9 100644 --- a/modulefiles/envmodules_pgi.linux +++ b/modulefiles/envmodules_pgi.linux @@ -1,12 +1,20 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # 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 pgi openmpi #module load szip hdf5 module load netcdf @@ -17,16 +25,29 @@ 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}" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi unset funcs -get_env_hdf5 -get_env_netcdf +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} - +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.local b/modulefiles/envmodules_pgi.local deleted file mode 100644 index ecc1c9f0..00000000 --- a/modulefiles/envmodules_pgi.local +++ /dev/null @@ -1,34 +0,0 @@ -#!/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.macosx b/modulefiles/envmodules_pgi.macosx index e0e25e47..00603696 100644 --- a/modulefiles/envmodules_pgi.macosx +++ b/modulefiles/envmodules_pgi.macosx @@ -1,27 +1,60 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 purge +module load pgi impi +module load szip hdf5 +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. - -export HDF5HOME=${HDF5} -export NETCDFHOME=${NETCDF} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.mistral b/modulefiles/envmodules_pgi.mistral new file mode 100644 index 00000000..6980312d --- /dev/null +++ b/modulefiles/envmodules_pgi.mistral @@ -0,0 +1,65 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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 cmake/3.17.1-gcc-9.1.0 +module load pgi openmpi +module load netcdf-c +module load netcdf-fortran + +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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +# use this more complicated one to address ADCIRC demands +export NETCDFHOME="$(nf-config --prefix)/include $(nf-config --flibs) $(nc-config --prefix)" +export NETCDFPATH=$(nc-config --prefix) +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} + +export NETCDF_INCDIR="$(nc-config --includedir) -I$(nf-config --includedir)" +export NETCDF_LIBDIR="$(nc-config --prefix)/lib $(nf-config --flibs)" + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.orion b/modulefiles/envmodules_pgi.orion index 437d2940..d95bb5b0 100644 --- a/modulefiles/envmodules_pgi.orion +++ b/modulefiles/envmodules_pgi.orion @@ -1,5 +1,13 @@ #!/bin/bash-*-Shell-script-modules*- +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + + # This script is responsible for loading modules that are # compatible with the NUOPC Layer version used in NEMS. @@ -16,12 +24,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDF_INCLUDE_DIRS} export NETCDF_LIBDIR=${NETCDF_LIBRARY_DIRS} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.stampede b/modulefiles/envmodules_pgi.stampede index 1effcc1e..7f80ee3a 100644 --- a/modulefiles/envmodules_pgi.stampede +++ b/modulefiles/envmodules_pgi.stampede @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ 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} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 TACC_HDF5_DIR + get_env_netcdf TACC_NETCDF_DIR +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${TACC_NETCDF_BIN}/nc-config export NETCDF_INCDIR=${TACC_NETCDF_INC} export NETCDF_LIBDIR=${TACC_NETCDF_LIB} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.strand b/modulefiles/envmodules_pgi.strand new file mode 100644 index 00000000..20c233d9 --- /dev/null +++ b/modulefiles/envmodules_pgi.strand @@ -0,0 +1,61 @@ +#!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + +#---------- +[[ "$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. + + +#################### +### Load all needed environment modules. +module purge +module load applications/utils/cmake3-20.0 +module load pgi openmpi +module load hdf5/1.10.5 netcdf/4.7.0 + +module load esmf/8.1.0 + + +#################### +### (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 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE + +export NETCDFHOME=$(nc-config --prefix) +export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} +export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} +export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} + +export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/modulefiles/envmodules_pgi.wcoss b/modulefiles/envmodules_pgi.wcoss index 93b0c6d4..e679f347 100644 --- a/modulefiles/envmodules_pgi.wcoss +++ b/modulefiles/envmodules_pgi.wcoss @@ -1,4 +1,12 @@ #!/bin/bash-*-Shell-script-modules*- + +########################################################################### +### Module File to load the required environment modules for the NEMS application +### +### Author: Panagiotis Velissariou +### Date: June 26 2021 +########################################################################### + #---------- [[ "$0" == "bash" || "$0" == "-bash" ]] && retv=return || retv=exit echo "$(basename ${BASH_SOURCE[0]}) :: This environment is either not configured or not supported" @@ -9,6 +17,7 @@ ${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 @@ -23,12 +32,30 @@ module purge #################### ### (2) Set some environments varaiables related to the loaded ### modules and required to compile the NEMS application properly. - -export HDF5HOME=${HDF5} -export NETCDFHOME=${NETCDF} +funcs="$( find . -type f -name "PlatformFuncs" | head -n 1 )" +if [ -f "${funcs}" ]; then + source "${funcs}" + + get_env_hdf5 + get_env_netcdf +fi +unset funcs + + +########## BEG:: PLATFORM CUSTOMIZED SETTINGS ########## +# Is this needed in all systems? +# If file locking is not allowed in the filesystem, or the +# HDF5 locking mechanism is not compatible with the +# OS locking mechanism, then HDF5 (>=1.10.x) throws errors like +# access denied when trying to READ/WRITE NetCDF files. +# On some platforms HDF5 locking is disabled on other it is not. +# If you experience these problems uncomment the next line +# (this should be done automatically when loading this file - todo). +#export HDF5_USE_FILE_LOCKING=FALSE export NETCDF_CONFIG=${NETCDFHOME:+${NETCDFHOME}/bin/nc-config} export NETCDF_INCDIR=${NETCDFHOME:+${NETCDFHOME}/include} export NETCDF_LIBDIR=${NETCDFHOME:+${NETCDFHOME}/lib} export ESMFMKFILE=${ESMFMKFILE} +########## END:: PLATFORM CUSTOMIZED SETTINGS ########## diff --git a/scripts/build-v1.0.sh b/scripts/build-v1.0.sh deleted file mode 100644 index ba6f6cb4..00000000 --- a/scripts/build-v1.0.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/scripts/build-v1.1.sh b/scripts/build.sh old mode 100644 new mode 100755 similarity index 61% rename from scripts/build-v1.1.sh rename to scripts/build.sh index 30f8880e..df8eb709 --- a/scripts/build-v1.1.sh +++ b/scripts/build.sh @@ -24,18 +24,27 @@ else 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 +lst="${scrDIR}/functions_build ${scrDIR}/scripts/functions_build functions_build " +funcs= +for ilst in ${lst} +do + if [ -f "${ilst:-}" ]; then + funcs="${ilst}" + break + fi +done + +if [ -n "${funcs:+1}" ]; then source "${funcs}" else echo " ### ERROR :: in ${scrNAME}" - echo " Cannot load the required file: ${funcs}" + echo " Cannot load the required file: functions_build" echo " Exiting now ..." echo exit 1 fi -unset funcs +unset ilst funcs ###==================== @@ -48,26 +57,33 @@ ParseArgs "${@}" # Set the variables for this script CLEAN=${MY_CLEAN:-0} -[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "${MY_COMPILER}" )" +[ -n "${MY_COMPILER:+1}" ] && COMPILER="$( toLOWER "$( basename "${MY_COMPILER}" )" )" [ -n "${MY_COMPONENT:+1}" ] && COMPONENT="$( toUPPER "${MY_COMPONENT}" )" +PARALLEL=${MY_PARALLEL:-1} + +BUILD_EXECS="${MY_EXECUTABLES}" [ -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}}" +########## + + +########## +# Customizations and environment variables for NEMS and other models +export BUILD_EXECS="${BUILD_EXECS}" # Customize the NEMS.x filename to include the component names if [ -n "${COMPONENT:+1}" ]; then @@ -75,8 +91,24 @@ if [ -n "${COMPONENT:+1}" ]; then compFNAME="$( echo "${compFNAME}" | sed 's/ /_/g' )" fi -# Export some environment variables for NEMS +# Export some important environment variables for NEMS and for other models export NEMS_COMPILER=${COMPILER} +export NEMS_PARALLEL=${PARALLEL} +export NEMS_PLATFORM=${PLATFORM} +export MACHINE_ID=${PLATFORM} +export FULL_MACHINE_ID=${PLATFORM} + +# This used in NEMS to get the configuration flags for the chosen compiler +# in the top level conf directory. Supported OSes are linux and macosx. +# Sometimes we might need to specify special flags not founf in the default +# files for s pecific platform +if [ ! -f "conf/configure.nems.${FULL_MACHINE_ID}.${NEMS_COMPILER}" ]; then + export BUILD_TARGET=${OS}.${NEMS_COMPILER} +fi + +if [ ! -f "conf/externals.nems.${FULL_MACHINE_ID}" ]; then + export EXTERNALS_NEMS="externals.nems" +fi ########## @@ -100,6 +132,9 @@ if [ ! -f "${modDIR}/${modFILE}" ]; then echo "Exiting ..." echo exit 1 +else + # Source the environment module + source ${modDIR}/${modFILE} fi ########## @@ -120,9 +155,60 @@ fi ########## -# Source the environment module -source ${modDIR}/${modFILE} +# Get the compilers to use for this project compilation +case "${COMPILER}" in + gnu) + CC=gcc + CXX=g++ + FC=gfortran + F90=gfortran + PCC=${PCC:-mpicc} + PCXX=${PCXX:-mpicxx} + PFC=${PFC:-mpif90} + PF90=${PF90:-${PFC}} + ;; + intel) + CC=icc + CXX=icpc + FC=ifort + F90=ifort + PCC=${PCC:-mpiicc} + PCXX=${PCXX:-mpiicpc} + PFC=${PFC:-mpiifort} + PF90=${PF90:-${PFC}} + ;; + pgi) + CC=pgcc + CXX=pgc++ + FC=pgfortran + F90=pgfortran + PCC=${PCC:-pgcc} + PCXX=${PCXX:-pgc++} + PFC==${PFC:-pgfortran} + PF90=${PF90:-${PFC}} + ;; + *) # No defaults. Give the user the option to define the environment variables + # CC, CXX, FC, F90 before running this script. + #echo "WARNING: The supplied compiling system \"${COMPILER}\", is not suported." + #echo " Supported systems are anyone of: compiling_system=[${MY_COMPILING_SYTEMS}]" + #echo " Use: --compiler=compiling_system." + #echo " Will continue with OS defaults." + CC=${CC:-} + CXX=${CXX:-} + FC=${FC:-} + F90=${F90:-} + PCC=${CC:-} + PCXX=${CXX:-} + PFC=${FC:-} + PF90=${F90:-} + ;; +esac + +export CC CXX FC F90 PCC PCXX PFC PF90 +########## + +########## component_ww3="$( echo "${COMPONENT}" | sed 's/ /:/g' )" if [[ :${component_ww3}: == *:"WW3":* ]]; then export WW3_CONFOPT="${COMPILER}" @@ -139,6 +225,16 @@ 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 " NEMS_PARALLEL = ${PARALLEL:-0}" +echo " NEMS_PLATFORM = ${NEMS_PLATFORM}" +echo " CC = ${CC:-UNDEF}" +echo " CXX = ${CXX:-UNDEF}" +echo " FC = ${FC:-UNDEF}" +echo " F90 = ${F90:-UNDEF}" +echo " PCC = ${PCC:-UNDEF}" +echo " PCXX = ${PCXX:-UNDEF}" +echo " PFC = ${PFC:-UNDEF}" +echo " PF90 = ${PF90:-UNDEF}" echo " MODULES FILE = ${modFILE}" if [[ :${component_ww3}: == *:"WW3":* ]]; then echo " WW3_CONFOPT = ${WW3_CONFOPT}" @@ -146,8 +242,13 @@ if [[ :${component_ww3}: == *:"WW3":* ]]; then echo " WWATCH3_NETCDF = ${WWATCH3_NETCDF}" fi echo " COMPONENTS = ${COMPONENT:-Undefined, Supported values are: [${MY_COMPONENT_LIST}]}" +echo " BUILD_EXECS = ${BUILD_EXECS}" echo " OS = ${OS}" echo " PLATFORM = ${PLATFORM}" +echo " MACHINE_ID = ${MACHINE_ID}" +echo " FULL_MACHINE_ID= ${FULL_MACHINE_ID}" +echo " BUILD_TARGET = ${BUILD_TARGET:-${PLATFORM}.${NEMS_COMPILER}}" +echo " EXTERNALS_NEMS = ${EXTERNALS_NEMS}" echo " VERBOSE = ${VERBOSE}" echo echo " HDF5HOME = ${HDF5HOME}" @@ -157,10 +258,13 @@ echo " NETCDF_LIBDIR = ${NETCDF_LIBDIR}" echo echo " ESMFMKFILE = ${ESMFMKFILE}" echo +echo "NOTE: If the parallel compiler names are different in your platform, you may pass one or more" +echo " of the environment variables: PCC, PCXX, PFC, PF90 to $(basename ${scrNAME}) and run the script as:" +echo " PCC=yourPCC PCXX=yourPCXX PFC=yourPFC PF90=yourPF90 $(basename ${scrNAME}) [options]" +echo module list - echo_response= while [ -z "${echo_response}" ] ; do echo -n "Are these values correct? [y/n]: " diff --git a/scripts/functions_build b/scripts/functions_build index ebb69270..57d8acaf 100644 --- a/scripts/functions_build +++ b/scripts/functions_build @@ -9,6 +9,7 @@ set +u MY_COMPILING_SYTEMS="gnu, intel, pgi" +MY_COMPILING_PLATFORMS="custom, linux, macosx, cheyenne, gaea, hera, jet, orion, stampede, wcoss, mistral, strand" MY_ATM_MODS="ATMESH WRF HWRF PAHM" MY_OCN_MODS="ADCIRC SCHISM FVCOM ROMS" @@ -40,15 +41,17 @@ ParseArgs() local ans0 ans ival intN local all_evars - all_evars="MY_CLEAN MY_COMPILER MY_COMPONENT MY_OS MY_PARMAKE MY_PLATFORM MY_VERBOSE" + all_evars="MY_CLEAN MY_COMPILER MY_COMPONENT MY_EXECUTABLES MY_OS MY_PARALLEL MY_PARMAKE MY_PLATFORM MY_VERBOSE" for ival in ${all_evars}; do unset __${ival}; done __MY_CLEAN=0 + __MY_EXECUTABLES= __MY_COMPILER=intel __MY_COMPONENT="ADCIRC WW3DATA ATMESH" __MY_OS= + __MY_PARALLEL=1 __MY_PARMAKE=1 __MY_PLATFORM= __MY_VERBOSE= @@ -56,7 +59,7 @@ ParseArgs() # ----- # Process the function options - opt_all=( c clean compiler component j os plat v verbose h help ) + opt_all=( build_exec c clean compiler component j par parallel os plat platform v verbose h help ) opt_all=":$( echo "${opt_all[@]/#/-} ${opt_all[@]/#/--}" | sed 's/ /:/g' ):" unset __OPTION_LIST @@ -85,6 +88,14 @@ ParseArgs() esac case "${opt_opt}" in + -build_exec | --build_exec ) + checkFuncOpt "--build_exec" + if [ $? -eq 0 ]; then + if [ "X${opt_arg}" != "X" ]; then + __MY_EXECUTABLES="$( strTrim "${opt_arg}" )" + fi + fi + ;; -c | --c | -clean | --clean ) checkFuncOpt "--clean" if [ $? -eq 0 ]; then @@ -127,6 +138,21 @@ ParseArgs() fi fi ;; + -par | --par | -parallel | --parallel ) + checkFuncOpt "--parallel" + if [ $? -eq 0 ]; then + __MY_PARALLEL=1 + if [ "X${opt_arg}" != "X" ]; then + if `isInteger "${opt_arg}"` ; then + __MY_PARALLEL=0 + [ ${opt_arg} -ge 1 ] && __MY_PARALLEL=1 + else + __MY_PARALLEL=0 + [ "$( getYesNo "${opt_arg}" )" = "yes" ] && __MY_PARALLEL=1 + fi + fi + fi + ;; -os | --os ) checkFuncOpt "--os" if [ $? -eq 0 ]; then @@ -135,8 +161,8 @@ ParseArgs() fi fi ;; - -plat | --plat ) - checkFuncOpt "--plat" + -plat | --plat | -platform | --platform) + checkFuncOpt "--platform" if [ $? -eq 0 ]; then if [ "X${opt_arg}" != "X" ]; then __MY_PLATFORM="$( echo "${opt_arg}" | sed 's/[[:space:]]//g' )" @@ -172,6 +198,14 @@ ParseArgs() esac fi + if [ -z "${__MY_PLATFORM}" ]; then + case "$(uname -s)" in + Darwin ) __MY_PLATFORM="macosx" ;; + Linux ) __MY_PLATFORM="linux" ;; + *) __MY_PLATFORM="linux";; # DEFAULT + esac + fi + # Export the values of all __* variables. for ival in ${all_evars} do @@ -215,23 +249,33 @@ UsageBuild() echo " Default: \"ADCIRC WW3DATA ATMESH\"." echo #--- + echo " -build_exec|--build_exec [=|space] \"executable_list\" (OPTIONAL)." + echo " The executables(s) to build (e.g. --build_exec=\"padcirc pahm\")." + echo " Default: none." + echo + #--- echo " -j|--j [=|space] \"N\" (OPTIONAL)." echo " Define the number of make jobs to run simultaneously." echo " Default: 1." echo #--- + echo " -par|--par|-parallel|--parallel [=|space] \"0|1|yes|no\" (OPTIONAL)." + echo " Activate the use of parallel compilers." + echo " Default: 1|yes." + 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 " -plat|--plat|-platform|--platform [=|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 " Supported platforms: ${MY_COMPILING_PLATFORMS}." + echo " Default: OS." echo #--- echo " -v|--v|-verbose|--verbose [=|space] \"a,b,v,i,j,m,n\" (any combination, OPTIONAL)." @@ -537,9 +581,8 @@ compileNems() { 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 + if [ "${cmp_type}" = "distclean" ]; then + rm -fv exe/NEMS*.x fi else echo "compileNems :: Cleaning: no makefile found: makefile = ${cmp_make}" @@ -563,6 +606,8 @@ compileNems() { return ${err} } +# Need to have specific model components install functions +# TODO - Panagiotis Velissariou installNems() { local cmp_comp icmp local instdir @@ -589,9 +634,10 @@ installNems() { if [ "${icmp}" == "ADCIRC" ]; then echo echo " --- Installing from: ${icmp} to ${instdir} ---" - for iprog in adcprep + for iprog in adcprep aswip adcirc padcirc tide_fac do - prog="$( find ${icmp} -type f -name ${iprog} | head -1 )" + prog="$( find -L ${icmp} -type f -name ${iprog} | head -1 )" + if [ -n "${prog:+1}" ]; then ${CPBIN} ${prog} ${instdir}/ fi @@ -603,7 +649,7 @@ installNems() { ###### Install the NEMS/exe/NEMS* files echo echo " --- Installing from: NEMS/exe to ${instdir} ---" - for iprog in NEMS/exe/NEMS-*.x + for iprog in NEMS/exe/NEMS*.x do if [ -f "${iprog}" ]; then ${CPBIN} ${iprog} ${instdir}/ diff --git a/scripts/functions_build-v1.0 b/scripts/functions_build-v1.0 deleted file mode 100644 index 05111ddc..00000000 --- a/scripts/functions_build-v1.0 +++ /dev/null @@ -1,611 +0,0 @@ -#!/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/scripts/functions_build.del b/scripts/functions_build.del deleted file mode 100644 index ebb69270..00000000 --- a/scripts/functions_build.del +++ /dev/null @@ -1,617 +0,0 @@ -#!/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 -}