Skip to content

Commit 4840e90

Browse files
committed
Let TriBITS handle MPI
Signed-off-by: Carl Pearson <[email protected]>
1 parent 1358ffe commit 4840e90

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ set(KOKKOSCOMM_ENABLE_PERFTESTS ${KokkosComm_ENABLE_PERFTESTS} CACHE BOOL "" FOR
6868
set(KOKKOSCOMM_ENABLE_TESTS ${KokkosComm_ENABLE_TESTS} CACHE BOOL "" FORCE)
6969
set(KOKKOSCOMM_ENABLE_MPI ${KokkosComm_ENABLE_MPI} CACHE BOOL "" FORCE)
7070

71+
if (KOKKOSCOMM_HAS_TRILINOS)
72+
if (TPL_ENABLE_MPI)
73+
if (NOT KOKKOSCOMM_ENABLE_MPI)
74+
message(WARNING "TPL_ENABLE_MPI is set. Overriding KOKKOSCOMM_ENABLE_MPI to ON")
75+
set(KOKKOSCOMM_ENABLE_MPI ON CACHE BOOL "" FORCE)
76+
endif()
77+
endif()
78+
endif()
7179

7280
if (KOKKOSCOMM_HAS_TRILINOS)
7381
# Trilinos will "find" Kokkos and MPI

src/KokkosComm/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
add_library(KokkosComm INTERFACE)
1818
add_library(KokkosComm::KokkosComm ALIAS KokkosComm)
1919

20-
21-
2220
# Public headers
2321
target_sources(
2422
KokkosComm
@@ -115,8 +113,10 @@ kokkoscomm_check_and_add_compile_options(KokkosCommFlags -Wno-gnu-zero-variadic-
115113
# linked before CUDA and friends, so link MPI before Kokkos.
116114
# TODO_CMAKE: in CMake 3.31, we can use LINK_LIBRARIES_STRATEGY to explicitly ask CMake not to
117115
# reorder how libraries are linked. In the mean time, we have to just hope (?).
118-
if(KOKKOSCOMM_ENABLE_MPI)
119-
target_link_libraries(KokkosComm INTERFACE MPI::MPI_CXX)
116+
if(NOT KOKKOSCOMM_HAS_TRILINOS)
117+
if(KOKKOSCOMM_ENABLE_MPI)
118+
target_link_libraries(KokkosComm INTERFACE MPI::MPI_CXX)
119+
endif()
120120
endif()
121121
target_link_libraries(KokkosComm INTERFACE KokkosComm::KokkosCommFlags Kokkos::kokkos)
122122

0 commit comments

Comments
 (0)