diff --git a/modulefiles/workflow_utils.hera b/modulefiles/workflow_utils.hera index a0f71bee006..5bc3214e323 100644 --- a/modulefiles/workflow_utils.hera +++ b/modulefiles/workflow_utils.hera @@ -20,7 +20,9 @@ module load sp/2.3.3 module load ip/3.3.3 module load nemsio/2.5.2 module load nemsiogfs/2.5.3 -#module load ncio/1.0.0 +module load ncio/1.0.0 +module load landsfcutil/2.4.1 +module load wgrib2/2.0.8 module load sigio/2.3.2 module load g2/3.4.1 module load bufr/11.4.0 diff --git a/modulefiles/workflow_utils.orion b/modulefiles/workflow_utils.orion index f379e1dbd01..d38aa6427c8 100644 --- a/modulefiles/workflow_utils.orion +++ b/modulefiles/workflow_utils.orion @@ -20,7 +20,9 @@ module load sp/2.3.3 module load ip/3.3.3 module load nemsio/2.5.2 module load nemsiogfs/2.5.3 -#module load ncio/1.0.0 +module load ncio/1.0.0 +module load landsfcutil/2.4.1 +module load wgrib2/2.0.8 module load sigio/2.3.2 module load g2/3.4.1 module load bufr/11.4.0 diff --git a/modulefiles/workflow_utils.wcoss_dell_p3 b/modulefiles/workflow_utils.wcoss_dell_p3 index 3e20cff4a48..582ba1700e0 100644 --- a/modulefiles/workflow_utils.wcoss_dell_p3 +++ b/modulefiles/workflow_utils.wcoss_dell_p3 @@ -20,7 +20,9 @@ module load sp/2.3.3 module load ip/3.3.3 module load nemsio/2.5.2 module load nemsiogfs/2.5.3 -#module load ncio/1.0.0 +module load ncio/1.0.0 +module load landsfcutil/2.4.1 +module load wgrib2/2.0.8 module load sigio/2.3.2 module load g2/3.4.1 module load bufr/11.4.0 diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt index bdcafdc0881..97d6a2ba8f4 100644 --- a/sorc/CMakeLists.txt +++ b/sorc/CMakeLists.txt @@ -51,10 +51,11 @@ find_package(sp REQUIRED) find_package(ip REQUIRED) find_package(ncio REQUIRED) find_package(nemsio REQUIRED) -find_package(nemsiogfs REQUIRED) find_package(sigio REQUIRED) find_package(g2 REQUIRED) find_package(bufr REQUIRED) +find_package(landsfcutil REQUIRED) +find_package(wgrib2 REQUIRED) add_subdirectory(enkf_chgres_recenter.fd) add_subdirectory(enkf_chgres_recenter_nc.fd) @@ -62,6 +63,7 @@ add_subdirectory(fv3nc2nemsio.fd) add_subdirectory(regrid_nemsio.fd) add_subdirectory(gaussian_sfcanl.fd) add_subdirectory(gfs_bufr.fd) +add_subdirectory(reg2grb2.fd) add_subdirectory(tocsbufr.fd) add_subdirectory(fbwndgfs.fd) add_subdirectory(vint.fd) diff --git a/sorc/build_all.sh b/sorc/build_all.sh index f670065f773..577f42df052 100755 --- a/sorc/build_all.sh +++ b/sorc/build_all.sh @@ -97,20 +97,6 @@ fi fi } -#------------------------------------ -# build reg2grb2 -#------------------------------------ -$Build_reg2grb2 && { -echo " .... Building reg2grb2 for ocean/ice post .... " -./build_reg2grb2.sh > $logs_dir/build_reg2grb2.log 2>&1 -rc=$? -if [[ $rc -ne 0 ]] ; then - echo "Fatal error in building reg2grb2." - echo "The log file is in $logs_dir/build_reg2grb2.log" -fi -((err+=$rc)) -} - #------------------------------------ # build gsi #------------------------------------ diff --git a/sorc/build_reg2grb2.sh b/sorc/build_reg2grb2.sh deleted file mode 100755 index a15e4edb42f..00000000000 --- a/sorc/build_reg2grb2.sh +++ /dev/null @@ -1,45 +0,0 @@ -#! /usr/bin/env bash -set -x - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - mkdir ../exec -fi - -source ./machine-setup.sh > /dev/null 2>&1 - -source ../modulefiles/modulefile.reg2grb2.$target - -export FCMP=${FCMP:-ifort} -export FCMP95=$FCMP -export CPP=fpp - -export INCS="-I${LANDSFCUTIL_INCd} \ - -I${IP_INCd} \ - -I${NETCDF_INCLUDES}" - -export FFLAGSM="-O3 -free -convert big_endian -traceback -qopenmp -fp-model precise -assume byterecl ${INCS}" -export FFLAGSM2="-O3 -free -r8" - -export LIBSM="${LANDSFCUTIL_LIBd} \ - ${IP_LIBd} \ - ${SP_LIBd} \ - ${W3NCO_LIB4} \ - ${BACIO_LIB4} \ - -L${NETCDF_LIBRARIES} -lnetcdff -lnetcdf -L${HDF5_LIBRARIES} -lhdf5_hl -lhdf5 -L${ZLIB_LIBRARIES} -lz -ldl -lm" - -WGRIB2_ROOT=${WGRIB2_ROOT:-$wgrib2_ROOT} -WGRIB2_LIB=${WGRIB2_LIB:-${WGRIB_LIB:-"$WGRIB2_ROOT/lib/libwgrib2.a"}} -WGRIB2_LIBAPI=${WGRIB2_LIBAPI:-"$WGRIB2_ROOT/lib/libwgrib2_api.a"} -WGRIB2_INC=${WGRIB2_INC:-"$WGRIB2_ROOT/include"} -JASPER_LIB=${JASPER_LIB:-"$JASPER_LIBRARIES/libjasper.a"} -export LIB2="${WGRIB2_LIBAPI} ${WGRIB2_LIB} ${JASPER_LIB}" -export MOD2="-I${WGRIB2_INC}" - -cd reg2grb2.fd - -pwd - -make -f Makefile clean -make -f Makefile -make -f Makefile install diff --git a/sorc/build_workflow_utils.sh b/sorc/build_workflow_utils.sh index 06739fd262d..c5b5d17cb0a 100755 --- a/sorc/build_workflow_utils.sh +++ b/sorc/build_workflow_utils.sh @@ -5,35 +5,19 @@ set -eux readonly UTILS_DIR=$(cd "$(dirname "$($cmd -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P) # Adapt for global-workflow structure. -target=${target:-"NULL"} +source ${UTILS_DIR}/machine-setup.sh > /dev/null 2>&1 modulefile=${UTILS_DIR}/../modulefiles/workflow_utils.$target if [[ -f $modulefile ]]; then set +x - source ${UTILS_DIR}/machine-setup.sh > /dev/null 2>&1 source $modulefile module list set -x +else + echo "FATAL: modulefile $modulefile not found!" + exit 1 fi # End adaptation -# Begin hack -# In place until nceplibs-ncio is in hpc-stack and available as a module -# After nceplibs-ncio is in hpc-stack, add the following line to -# ${UTILS_DIR}/../modulefiles/workflow_utils. -# "module load ncio/" -# and remove this hack - -[[ -d nceplibs-ncio ]] && rm -rf nceplibs-ncio -git clone -b develop https://github.com/noaa-emc/nceplibs-ncio -cd nceplibs-ncio -mkdir -p build && cd build -cmake -DCMAKE_INSTALL_PREFIX=../install .. -make -j ${BUILD_JOBS:-4} VERBOSE=${BUILD_VERBOSE:-} -make install -cd ../.. -export ncio_ROOT=$PWD/nceplibs-ncio/install -# End hack - BUILD_DIR=${BUILD_DIR:-${UTILS_DIR}/build} [[ -d $BUILD_DIR ]] && rm -rf $BUILD_DIR mkdir -p ${BUILD_DIR} diff --git a/sorc/cpl_build.cfg b/sorc/cpl_build.cfg index d9e3b2853bd..8341a99264d 100644 --- a/sorc/cpl_build.cfg +++ b/sorc/cpl_build.cfg @@ -2,7 +2,6 @@ # ***** configuration of coupled workflow build ***** Building fv3gfs (fv3gfs) .............................. yes - Building reg2grb2 (reg2grb2) .......................... yes Building ww3_prepost (ww3_prepost) .................... yes Building gsi (gsi) .................................... no Building gldas (gldas) ................................ no @@ -10,7 +9,7 @@ Building ufs_utils (ufs_utils) ........................ no Building gldas (gldas) ................................ no Building gfs_wafs (gfs_wafs) .......................... no - Building workflow_utils (workflow_utils)............... no + Building workflow_utils (workflow_utils)............... yes Building gfs_util (gfs_util) .......................... no diff --git a/sorc/link_fv3gfs.sh b/sorc/link_fv3gfs.sh index 688acba7fb6..d1d9e0b97e9 100755 --- a/sorc/link_fv3gfs.sh +++ b/sorc/link_fv3gfs.sh @@ -253,7 +253,7 @@ for workflowexec in fbwndgfs gfs_bufr regrid_nemsio supvit syndat_getjtbul \ $LINK ../sorc/install/bin/${workflowexec}.x $workflowexec done for workflowexec in enkf_chgres_recenter.x enkf_chgres_recenter_nc.x fv3nc2nemsio.x \ - tave.x vint.x ; do + tave.x vint.x reg2grb2.x ; do [[ -s $workflowexec ]] && rm -f $workflowexec $LINK ../sorc/install/bin/$workflowexec . done diff --git a/sorc/reg2grb2.fd/CMakeLists.txt b/sorc/reg2grb2.fd/CMakeLists.txt new file mode 100644 index 00000000000..4157c315bf0 --- /dev/null +++ b/sorc/reg2grb2.fd/CMakeLists.txt @@ -0,0 +1,28 @@ +list(APPEND fortran_src +reg2grb2.f +regdiag.f +) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -free -convert big_endian -fp-model precise -assume byterecl") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fconvert=big-endian") +endif() + +set(exe_name reg2grb2.x) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + landsfcutil::landsfcutil_d + ip::ip_d + sp::sp_d + bacio::bacio_4 + w3nco::w3nco_4 + wgrib2::wgrib2_api + NetCDF::NetCDF_Fortran) + +if(OpenMP_Fortran_FOUND) + target_link_libraries(${exe_name} OpenMP::OpenMP_Fortran) +endif() + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/sorc/reg2grb2.fd/Makefile b/sorc/reg2grb2.fd/Makefile deleted file mode 100755 index edd523f0617..00000000000 --- a/sorc/reg2grb2.fd/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -SHELL =/bin/sh -INCMOD =${INCS} - -SRCM =reg2grb2.f -OBJS =regdiag.o -FC =ifort -FC90 =ifort - -FFLAGS = ${FFLAGSM} -FFLAGS2 = ${FFLAGSM2} - -NCDFLIB = ${NCDF} -LIBS = ${LIBSM} ${NCDFLIB} - -CMD = reg2grb2.x -$(CMD): $(SRCM) $(OBJS) - $(FCMP) $(FFLAGS) -o $(CMD) $(LDFLAGS) $(SRCM) $(OBJS) $(LIBS) ${MOD2} ${LIB2} - -regdiag.o:regdiag.f - $(FCMP) $(FFLAGS) -I $(INCMOD) -c regdiag.f ${MOD2} ${LIB2} - -clean: - -rm -f $(OBJS) *.mod - -install: - mv $(CMD) ../../exec/$(CMD)