diff --git a/modulefiles/gfsutils_hera.intel.lua b/modulefiles/gfsutils_hera.intel.lua index 16a82c00..c4c56935 100644 --- a/modulefiles/gfsutils_hera.intel.lua +++ b/modulefiles/gfsutils_hera.intel.lua @@ -14,10 +14,4 @@ load(pathJoin("cmake", cmake_ver)) load("gfsutils_common") -local gempak_ver=os.getenv("gempak_ver") or "7.4.2" --- load(pathJoin("gempak", gempak_ver)) - --- Used in rdbfmsua.f -setenv("gfortran_ROOT", "/apps/gnu/gcc-9.2.0") - whatis("Description: GFS utilities environment on Hera with Intel Compilers") diff --git a/modulefiles/gfsutils_orion.intel.lua b/modulefiles/gfsutils_orion.intel.lua index 985051ca..8eb29c2b 100644 --- a/modulefiles/gfsutils_orion.intel.lua +++ b/modulefiles/gfsutils_orion.intel.lua @@ -14,10 +14,4 @@ load(pathJoin("cmake", cmake_ver)) load("gfsutils_common") -local gempak_ver=os.getenv("gempak_ver") or "7.5.1" --- load(pathJoin("gempak", gempak_ver)) - --- Used in rdbfmsua.f -setenv("gfortran_ROOT", "/apps/gcc-8/gcc-8.3.0") - whatis("Description: GFS utilities environment on Orion with Intel Compilers") diff --git a/modulefiles/gfsutils_wcoss2.intel.lua b/modulefiles/gfsutils_wcoss2.intel.lua index 4f9df05b..a3219117 100644 --- a/modulefiles/gfsutils_wcoss2.intel.lua +++ b/modulefiles/gfsutils_wcoss2.intel.lua @@ -24,7 +24,6 @@ local nemsiogfs_ver=os.getenv("nemsiogfs_ver") or "2.5.3" local wrf_io_ver=os.getenv("wrf_io_ver") or "1.2.0" local g2_ver=os.getenv("g2_ver") or "3.4.5" local landsfcutil_ver=os.getenv("landsfcutil_ver") or "2.4.1" -local gempak_ver=os.getenv("gempak_ver") or "7.14.1" local wgrib2_ver=os.getenv("wgrib2_ver") or "2.0.8" load(pathJoin("PrgEnv-intel", PrgEnv_intel_ver)) @@ -50,12 +49,8 @@ load(pathJoin("nemsio", nemsio_ver)) load(pathJoin("wrf_io", wrf_io_ver)) load(pathJoin("g2", g2_ver)) load(pathJoin("landsfcutil", landsfcutil_ver)) --- load(pathJoin("gempak", gempak_ver)) load(pathJoin("wgrib2", wgrib2_ver)) --- Used in rdbfmsua.f -setenv("gfortran_ROOT", "//opt/cray/pe/gcc/10.3.0/snos") - pushenv("HPC_OPT", "/apps/ops/para/libs") prepend_path("MODULEPATH", "/apps/ops/para/libs/modulefiles/compiler/intel/19.1.3.304") prepend_path("MODULEPATH", "/apps/ops/para/libs/modulefiles/mpi/intel/19.1.3.304/cray-mpich/8.1.7") diff --git a/modulefiles/rdbfmsua_hera.intel.lua b/modulefiles/rdbfmsua_hera.intel.lua new file mode 100644 index 00000000..69dda265 --- /dev/null +++ b/modulefiles/rdbfmsua_hera.intel.lua @@ -0,0 +1,26 @@ +help([[ +Build environment for GFS utilities on Hera +]]) + +prepend_path("MODULEPATH", "/scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.6.0/envs/gsi-addon-dev/install/modulefiles/Core") + +local stack_intel_ver=os.getenv("stack_intel_ver") or "2021.5.0" +local stack_impi_ver=os.getenv("stack_impi_ver") or "2021.5.1" +local cmake_ver=os.getenv("cmake_ver") or "3.23.1" + +load(pathJoin("stack-intel", stack_intel_ver)) +load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver)) + +local bufr_ver=os.getenv("bufr_ver") or "11.7.0" +local bacio_ver=os.getenv("bacio_ver") or "2.4.1" +local w3emc_ver=os.getenv("w3emc_ver") or "2.10.0" +local gempak_ver=os.getenv("gempak_ver") or "7.4.2" + +load(pathJoin("bufr", bufr_ver)) +load(pathJoin("bacio", bacio_ver)) +load(pathJoin("w3emc", w3emc_ver)) +load(pathJoin("gempak", gempak_ver)) + +setenv("gfortran_ROOT", "/apps/gnu/gcc-9.2.0") + +whatis("Description: GFS utilities environment on Hera with Intel Compilers") diff --git a/modulefiles/rdbfmsua_orion.intel.lua b/modulefiles/rdbfmsua_orion.intel.lua new file mode 100644 index 00000000..5a80bee4 --- /dev/null +++ b/modulefiles/rdbfmsua_orion.intel.lua @@ -0,0 +1,25 @@ +help([[ +Build environment for GFS utilities on Orion +]]) + +prepend_path("MODULEPATH", "/work/noaa/epic/role-epic/spack-stack/orion/spack-stack-1.6.0/envs/gsi-addon-env/install/modulefiles/Core") + +local stack_intel_ver=os.getenv("stack_intel_ver") or "2022.0.2" +local stack_impi_ver=os.getenv("stack_impi_ver") or "2021.5.1" + +load(pathJoin("stack-intel", stack_intel_ver)) +load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver)) + +local bufr_ver=os.getenv("bufr_ver") or "11.7.0" +local bacio_ver=os.getenv("bacio_ver") or "2.4.1" +local w3emc_ver=os.getenv("w3emc_ver") or "2.10.0" +local gempak_ver=os.getenv("gempak_ver") or "7.5.1" + +load(pathJoin("bufr", bufr_ver)) +load(pathJoin("bacio", bacio_ver)) +load(pathJoin("w3emc", w3emc_ver)) +load(pathJoin("gempak", gempak_ver)) + +setenv("gfortran_ROOT", "/apps/gcc-8/gcc-8.3.0") + +whatis("Description: GFS utilities environment on Orion with Intel Compilers") diff --git a/modulefiles/rdbfmsua_wcoss2.intel.lua b/modulefiles/rdbfmsua_wcoss2.intel.lua new file mode 100644 index 00000000..43e7d204 --- /dev/null +++ b/modulefiles/rdbfmsua_wcoss2.intel.lua @@ -0,0 +1,25 @@ +help([[ +Build environment for GFS utilities on WCOSS2 +]]) + +local PrgEnv_intel_ver=os.getenv("PrgEnv_intel_ver") or "8.1.0" +local intel_ver=os.getenv("intel_ver") or "19.1.3.304" +local craype_ver=os.getenv("craype_ver") or "2.7.10" + +local bufr_ver=os.getenv("bufr_ver") or "11.7.0" +local bacio_ver=os.getenv("bacio_ver") or "2.4.1" +local w3emc_ver=os.getenv("w3emc_ver") or "2.9.2" +local gempak_ver=os.getenv("gempak_ver") or "7.14.1" + +load(pathJoin("PrgEnv-intel", PrgEnv_intel_ver)) +load(pathJoin("intel", intel_ver)) +load(pathJoin("craype", craype_ver)) + +load(pathJoin("bufr", bufr_ver)) +load(pathJoin("bacio", bacio_ver)) +load(pathJoin("w3emc", w3emc_ver)) +load(pathJoin("gempak", gempak_ver)) + +setenv("gfortran_ROOT", "/opt/cray/pe/gcc/10.3.0/snos") + +whatis("Description: GFS utilities environment on WCOSS2 with Intel Compilers") diff --git a/src/rdbfmsua.fd/makefile b/src/rdbfmsua.fd/makefile new file mode 100644 index 00000000..a83c0fd4 --- /dev/null +++ b/src/rdbfmsua.fd/makefile @@ -0,0 +1,19 @@ +SHELL=/bin/sh + +include makefile.${MACHINE_ID}.${COMPILER} + +CMD = rdbfmsua.x +OBJS = rdbfmsua.o + +$(CMD): $(OBJS) + $(FC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) + +clean: + -rm -f ${OBJS} + +clobber: clean + -rm -f ${CMD} + +install: + -mv ${CMD} ${PREFIX}/bin/ + diff --git a/src/rdbfmsua.fd/makefile.hera.intel b/src/rdbfmsua.fd/makefile.hera.intel new file mode 100644 index 00000000..c63c8458 --- /dev/null +++ b/src/rdbfmsua.fd/makefile.hera.intel @@ -0,0 +1,9 @@ +FC = ifort +FFLAGS = -g -traceback -I${GEMPAK}/include -I${OS_INC} +LIBS = ${BUFR_LIB4} \ + ${GEMLIB}/gemlib.a \ + ${GEMLIB}/appl.a \ + ${GEMLIB}/syslib.a \ + ${GEMLIB}/cgemlib.a \ + ${GEMLIB}/bridge.a \ + -L${gfrortran_ROOT}/lib64 -lgfortran diff --git a/src/rdbfmsua.fd/makefile.orion.intel b/src/rdbfmsua.fd/makefile.orion.intel new file mode 100644 index 00000000..c63c8458 --- /dev/null +++ b/src/rdbfmsua.fd/makefile.orion.intel @@ -0,0 +1,9 @@ +FC = ifort +FFLAGS = -g -traceback -I${GEMPAK}/include -I${OS_INC} +LIBS = ${BUFR_LIB4} \ + ${GEMLIB}/gemlib.a \ + ${GEMLIB}/appl.a \ + ${GEMLIB}/syslib.a \ + ${GEMLIB}/cgemlib.a \ + ${GEMLIB}/bridge.a \ + -L${gfrortran_ROOT}/lib64 -lgfortran diff --git a/src/rdbfmsua.fd/makefile.wcoss2.intel b/src/rdbfmsua.fd/makefile.wcoss2.intel new file mode 100644 index 00000000..ace3e124 --- /dev/null +++ b/src/rdbfmsua.fd/makefile.wcoss2.intel @@ -0,0 +1,6 @@ +FC = ftn +FFLAGS = -g -traceback -I${GEMINC} -I${OS_INC} +LIBS = ${BUFR_LIB4} \ + -L${GEMOLB} -lgemlib -lappl -lsyslib -lcgemlib \ + ${GEMOLB}/libbridge.a \ + ${gfortran_ROOT}/lib64/libgfortran.a diff --git a/src/rdbfmsua.fd/to_be_deleted/makefile b/src/rdbfmsua.fd/to_be_deleted/makefile deleted file mode 100644 index 69d183f3..00000000 --- a/src/rdbfmsua.fd/to_be_deleted/makefile +++ /dev/null @@ -1,84 +0,0 @@ -SHELL=/bin/sh -# -# This makefile was produced by /usr/bin/fmgen at 11:21:07 AM on 10/28/94 -# If it is invoked by the command line -# make -f makefile -# it will compile the fortran modules indicated by SRCS into the object -# modules indicated by OBJS and produce an executable named a.out. -# -# If it is invoked by the command line -# make -f makefile a.out.prof -# it will compile the fortran modules indicated by SRCS into the object -# modules indicated by OBJS and produce an executable which profiles -# named a.out.prof. -# -# To remove all the objects but leave the executables use the command line -# make -f makefile clean -# -# To remove everything but the source files use the command line -# make -f makefile clobber -# -# To remove the source files created by /usr/bin/fmgen and this makefile -# use the command line -# make -f makefile void -# -# The parameters SRCS and OBJS should not need to be changed. If, however, -# you need to add a new module add the name of the source module to the -# SRCS parameter and add the name of the resulting object file to the OBJS -# parameter. The new modules are not limited to fortran, but may be C, YACC, -# LEX, or CAL. An explicit rule will need to be added for PASCAL modules. -# -OBJS= rdbfmsua.o - - -# Tunable parameters -# -# FC Name of the fortran compiling system to use -# LDFLAGS Flags to the loader -# LIBS List of libraries -# CMD Name of the executable -# -FC = ifort -# FFLAGS = -O3 -q32 -I${GEMINC} -I${NAWIPS}/os/${NA_OS}/include -# FFLAGS = -I${GEMINC} -I${NAWIPS}/os/${NA_OS}/include -FFLAGS = -I${GEMINC} -I${OS_INC} -# LDFLAGS = -O3 -q32 -s -# LDFLAGS = -Wl,-Map,MAPFILE - -# BRIDGE=/gpfs/dell1/nco/ops/nwpara/gempak.v7.3.1/nawips/os/linux3.10.0_x86_64/lib/libbridge.a -BRIDGE=${GEMOLB}/libbridge.a - -LIBS = ${DECOD_UT_LIB} ${BUFR_LIB4} \ - -L${GEMOLB} -lgemlib -lappl -lsyslib -lcgemlib -lgfortran ${BRIDGE} - -# -L${GEMOLB} -lgemlib -lappl -lsyslib -lcgemlib -lgfortran ${BRIDGE} -# -L/nwprod/gempak/nawips1/os/linux2.6.32_x86_64/lib -lgemlib -lappl -lsyslib -lcgemlib -lbridge -lncepBUFR \ -# -lgfortran - -CMD = rdbfmsua - -# To perform the default compilation, use the first line -# To compile with flowtracing turned on, use the second line -# To compile giving profile additonal information, use the third line -# CFLAGS= -O3 -q32 - -# Lines from here on down should not need to be changed. They are the -# actual rules which make uses to build a.out. -# - -$(CMD): $(OBJS) - $(FC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - - -# The following rule reads the required NAWIPS definitions and then recursively -# runs this same makefile with a new target in the spawned shell. -# - -clean: - -rm -f ${OBJS} - -clobber: clean - -rm -f ${CMD} - -void: clobber - -rm -f ${SRCS} makefile diff --git a/src/rdbfmsua.fd/to_be_deleted/makefile.hera b/src/rdbfmsua.fd/to_be_deleted/makefile.hera deleted file mode 100644 index 0df163a4..00000000 --- a/src/rdbfmsua.fd/to_be_deleted/makefile.hera +++ /dev/null @@ -1,76 +0,0 @@ -SHELL=/bin/sh -# -# This makefile was produced by /usr/bin/fmgen at 11:21:07 AM on 10/28/94 -# If it is invoked by the command line -# make -f makefile -# it will compile the fortran modules indicated by SRCS into the object -# modules indicated by OBJS and produce an executable named a.out. -# -# If it is invoked by the command line -# make -f makefile a.out.prof -# it will compile the fortran modules indicated by SRCS into the object -# modules indicated by OBJS and produce an executable which profiles -# named a.out.prof. -# -# To remove all the objects but leave the executables use the command line -# make -f makefile clean -# -# To remove everything but the source files use the command line -# make -f makefile clobber -# -# To remove the source files created by /usr/bin/fmgen and this makefile -# use the command line -# make -f makefile void -# -# The parameters SRCS and OBJS should not need to be changed. If, however, -# you need to add a new module add the name of the source module to the -# SRCS parameter and add the name of the resulting object file to the OBJS -# parameter. The new modules are not limited to fortran, but may be C, YACC, -# LEX, or CAL. An explicit rule will need to be added for PASCAL modules. -# -OBJS= rdbfmsua.o - - -# Tunable parameters -# -# FC Name of the fortran compiling system to use -# LDFLAGS Flags to the loader -# LIBS List of libraries -# CMD Name of the executable -# -FC = ifort -FFLAGS = -g -traceback -I${GEMINC} -I${OS_INC} - -BRIDGE=${GEMOLB}/bridge.a -GFORTRAN=/apps/gcc/6.2.0/lib64 - -LIBS = ${DECOD_UT_LIB} ${BUFR_LIB4} \ - ${GEMLIB}/gemlib.a ${GEMLIB}/appl.a ${GEMLIB}/syslib.a ${GEMLIB}/cgemlib.a -L${GFORTRAN} -lgfortran ${BRIDGE} - -CMD = rdbfmsua - -# To perform the default compilation, use the first line -# To compile with flowtracing turned on, use the second line -# To compile giving profile additonal information, use the third line -# CFLAGS= -O3 -q32 - -# Lines from here on down should not need to be changed. They are the -# actual rules which make uses to build a.out. -# - -$(CMD): $(OBJS) - $(FC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - - -# The following rule reads the required NAWIPS definitions and then recursively -# runs this same makefile with a new target in the spawned shell. -# - -clean: - -rm -f ${OBJS} - -clobber: clean - -rm -f ${CMD} - -void: clobber - -rm -f ${SRCS} makefile diff --git a/src/rdbfmsua.fd/to_be_deleted/makefile.wcoss2 b/src/rdbfmsua.fd/to_be_deleted/makefile.wcoss2 deleted file mode 100644 index 2fb948ac..00000000 --- a/src/rdbfmsua.fd/to_be_deleted/makefile.wcoss2 +++ /dev/null @@ -1,76 +0,0 @@ -SHELL=/bin/sh -# -# This makefile was produced by /usr/bin/fmgen at 11:21:07 AM on 10/28/94 -# If it is invoked by the command line -# make -f makefile -# it will compile the fortran modules indicated by SRCS into the object -# modules indicated by OBJS and produce an executable named a.out. -# -# If it is invoked by the command line -# make -f makefile a.out.prof -# it will compile the fortran modules indicated by SRCS into the object -# modules indicated by OBJS and produce an executable which profiles -# named a.out.prof. -# -# To remove all the objects but leave the executables use the command line -# make -f makefile clean -# -# To remove everything but the source files use the command line -# make -f makefile clobber -# -# To remove the source files created by /usr/bin/fmgen and this makefile -# use the command line -# make -f makefile void -# -# The parameters SRCS and OBJS should not need to be changed. If, however, -# you need to add a new module add the name of the source module to the -# SRCS parameter and add the name of the resulting object file to the OBJS -# parameter. The new modules are not limited to fortran, but may be C, YACC, -# LEX, or CAL. An explicit rule will need to be added for PASCAL modules. -# -OBJS= rdbfmsua.o - - -# Tunable parameters -# -# FC Name of the fortran compiling system to use -# LDFLAGS Flags to the loader -# LIBS List of libraries -# CMD Name of the executable -# -FC = ftn -FFLAGS = -g -traceback -I${GEMINC} -I${OS_INC} - -BRIDGE=${GEMOLB}/libbridge.a -GFORTRAN=/opt/cray/pe/gcc/10.3.0/snos/lib64/libgfortran.a - -LIBS = ${DECOD_UT_LIB} ${BUFR_LIB4} \ - -L${GEMOLB} -lgemlib -lappl -lsyslib -lcgemlib ${GFORTRAN} ${BRIDGE} - -CMD = rdbfmsua - -# To perform the default compilation, use the first line -# To compile with flowtracing turned on, use the second line -# To compile giving profile additonal information, use the third line -# CFLAGS= -O3 -q32 - -# Lines from here on down should not need to be changed. They are the -# actual rules which make uses to build a.out. -# - -$(CMD): $(OBJS) - $(FC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - - -# The following rule reads the required NAWIPS definitions and then recursively -# runs this same makefile with a new target in the spawned shell. -# - -clean: - -rm -f ${OBJS} - -clobber: clean - -rm -f ${CMD} - -void: clobber - -rm -f ${SRCS} makefile diff --git a/ush/build.sh b/ush/build.sh index 41f66e1b..ede4ebe9 100755 --- a/ush/build.sh +++ b/ush/build.sh @@ -1,8 +1,8 @@ #!/bin/bash set -eu - # Get the root of the cloned GFS-utils directory +#shellcheck disable=SC2155 readonly DIR_ROOT=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )/.." && pwd -P) # User Options @@ -15,29 +15,50 @@ INSTALL_PREFIX=${INSTALL_PREFIX:-"${DIR_ROOT}/install"} #==============================================================================# # Detect machine (sets MACHINE_ID) -source $DIR_ROOT/ush/detect_machine.sh +source "${DIR_ROOT}/ush/detect_machine.sh" # Load modules -source $DIR_ROOT/ush/module-setup.sh -module use $DIR_ROOT/modulefiles -module load gfsutils_$MACHINE_ID.$COMPILER +source "${DIR_ROOT}/ush/module-setup.sh" +module use "${DIR_ROOT}/modulefiles" +module load "gfsutils_${MACHINE_ID}.${COMPILER}" module list # Collect BUILD Options -CMAKE_OPTS+=" -DCMAKE_BUILD_TYPE=$BUILD_TYPE" +CMAKE_OPTS+=" -DCMAKE_BUILD_TYPE=${BUILD_TYPE}" # Install destination for built executables, libraries, CMake Package config -CMAKE_OPTS+=" -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX" +CMAKE_OPTS+=" -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}" # Re-use or create a new BUILD_DIR (Default: create new BUILD_DIR) -[[ ${BUILD_CLEAN:-"YES"} =~ [yYtT] ]] && rm -rf $BUILD_DIR -mkdir -p $BUILD_DIR && cd $BUILD_DIR +[[ ${BUILD_CLEAN:-"YES"} =~ [yYtT] ]] && rm -rf "${BUILD_DIR}" +mkdir -p "${BUILD_DIR}" && cd "${BUILD_DIR}" # Configure, build, install set -x -cmake $CMAKE_OPTS $DIR_ROOT -make -j ${BUILD_JOBS:-8} VERBOSE=${BUILD_VERBOSE:-} +# shellcheck disable=SC2086 +cmake ${CMAKE_OPTS} "${DIR_ROOT}" +make -j "${BUILD_JOBS:-8}" VERBOSE="${BUILD_VERBOSE:-}" make install set +x +# Build rdbfmsua.x with makefile separately due to GEMPAK issues in cmake +# Load modules +source "${DIR_ROOT}/ush/module-setup.sh" +module use "${DIR_ROOT}/modulefiles" +if module load "rdbfmsua_${MACHINE_ID}.${COMPILER}" &> /dev/null; then + module list +else + echo "WARNING: Unable to load modelfile for 'rdbfmsua' on '${MACHINE_ID}' (does it exist?)." + echo " Skipping building 'rdbfmsua.x'" + exit 0 +fi + +cd "${DIR_ROOT}/src/rdbfmsua.fd" +export MACHINE_ID +export COMPILER +export PREFIX="${INSTALL_PREFIX}" +make clean +make VERBOSE="${BUILD_VERBOSE:-}" +make install VERBOSE="${BUILD_VERBOSE:-}" + exit