diff --git a/modulefiles/gsi_hercules.intel.lua b/modulefiles/gsi_hercules.intel.lua index 66ec9b03e1..3cb1fc1779 100644 --- a/modulefiles/gsi_hercules.intel.lua +++ b/modulefiles/gsi_hercules.intel.lua @@ -1,16 +1,16 @@ help([[ ]]) -prepend_path("MODULEPATH", "/work/noaa/epic/role-epic/spack-stack/hercules/spack-stack-1.6.0/envs/gsi-addon-env/install/modulefiles/Core") +prepend_path("MODULEPATH", "/work/noaa/global/dhuber/SPACK/ss-160-openmpi/envs/unified-env/install/modulefiles/Core") local stack_python_ver=os.getenv("stack_python_ver") or "3.11.6" local stack_intel_ver=os.getenv("stack_intel_ver") or "2021.9.0" -local stack_impi_ver=os.getenv("stack_impi_ver") or "2021.9.0" +local stack_openmpi_ver=os.getenv("stack_openmpi_ver") or "4.1.6" local cmake_ver=os.getenv("cmake_ver") or "3.23.1" local prod_util_ver=os.getenv("prod_util_ver") or "2.1.1" load(pathJoin("stack-intel", stack_intel_ver)) -load(pathJoin("stack-intel-oneapi-mpi", stack_impi_ver)) +load(pathJoin("stack-openmpi", stack_openmpi_ver)) load(pathJoin("python", stack_python_ver)) load(pathJoin("cmake", cmake_ver)) diff --git a/src/mgbf/CMakeLists.txt b/src/mgbf/CMakeLists.txt index 9ee36c8329..edff758125 100644 --- a/src/mgbf/CMakeLists.txt +++ b/src/mgbf/CMakeLists.txt @@ -64,6 +64,26 @@ set_target_properties(mgbf PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") target_include_directories(mgbf PUBLIC $ $) +find_package(MPI REQUIRED) +add_definitions(${MPI_Fortran_COMPILE_FLAGS}) +include_directories(${MPI_Fortran_INCLUDE_DIRS}) +link_directories(${MPI_Fortran_LIBRARY_DIRS}) +target_link_libraries(mgbf ${MPI_Fortran_LIBRARIES}) + +if(MPI_EXTRA_LIBRARY) + target_link_libraries(mgbf ${MPI_EXTRA_LIBRARY}) +endif() + +get_target_property(CURRENT_LINK_FLAGS mgbf LINK_FLAGS) +if(CURRENT_LINK_FLAGS) + set(MY_MPI_LINK_FLAGS "${CURRENT_LINK_FLAGS};${MPI_Fortran_LINK_FLAGS}") +else() + set(MY_MPI_LINK_FLAGS "${MPI_Fortran_LINK_FLAGS}") +endif() +if(MY_MPI_LINK_FLAGS) + set_target_properties(mgbf PROPERTIES LINK_FLAGS ${MY_MPI_LINK_FLAGS}) +endif() + install(DIRECTORY ${module_dir} DESTINATION ${CMAKE_INSTALL_PREFIX}/include) install(TARGETS mgbf