Skip to content

Commit

Permalink
Build with Intel/openmpi
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed May 8, 2024
1 parent a3a2633 commit 0e9ab7c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modulefiles/gsi_hercules.intel.lua
Original file line number Diff line number Diff line change
@@ -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))

Expand Down
20 changes: 20 additions & 0 deletions src/mgbf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,26 @@ set_target_properties(mgbf PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}")
target_include_directories(mgbf PUBLIC $<BUILD_INTERFACE:${module_dir}>
$<INSTALL_INTERFACE:include/mgbf>)

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
Expand Down

0 comments on commit 0e9ab7c

Please sign in to comment.