]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Bugfix: only configure arborx with matching MPI configuration 14468/head
authorMatthias Maier <tamiko@43-1.org>
Thu, 24 Nov 2022 16:07:24 +0000 (10:07 -0600)
committerMatthias Maier <tamiko@43-1.org>
Fri, 25 Nov 2022 08:01:47 +0000 (02:01 -0600)
cmake/configure/configure_50_arborx.cmake
cmake/modules/FindARBORX.cmake

index c9d08aca80470bfd5e73ac30b0658ca1a639ca23..5fc0bbd2b01cc76147afb5ba94bec7ac77690156 100644 (file)
 # Configuration for ArborX support in deal.II:
 #
 
+set(FEATURE_ARBORX_AFTER MPI)
 set(FEATURE_ARBORX_DEPENDS KOKKOS)
 
+macro(FEATURE_ARBORX_FIND_EXTERNAL var)
+  find_package(ARBORX)
+
+  if(ARBORX_FOUND)
+    #
+    # So, we have a library. Let's see whether we can use it:
+    #
+    set(${var} TRUE)
+
+    #
+    # ArborX has to be configured with the same MPI configuration as
+    # deal.II.
+    #
+    if((NOT ARBORX_WITH_MPI AND DEAL_II_WITH_MPI) OR (ARBORX_WITH_MPI AND NOT DEAL_II_WITH_MPI))
+      message(STATUS "Could not find a sufficient ArborX installation: "
+        "ArborX has to be configured with the same MPI configuration as deal.II."
+        )
+      set(ARBORX_ADDITIONAL_ERROR_STRING
+        ${ARBORX_ADDITIONAL_ERROR_STRING}
+        "Could not find a sufficient ArborX installation:\n"
+        "ArborX has to be configured with the same MPI configuration as deal.II, but found:\n"
+        "  DEAL_II_WITH_MPI = ${DEAL_II_WITH_MPI}\n"
+        "  ARBORX_WITH_MPI  = ${ARBORX_WITH_MPI}\n"
+        )
+      set(${var} FALSE)
+    endif()
+  endif()
+
+  set(DEAL_II_ARBORX_WITH_MPI ${ARBORX_WITH_MPI})
+endmacro()
+
 configure_feature(ARBORX)
+
index bce80850663c44405f44da0749b1d1eb2252499d..b1587ab9a648506e9f0cfce01e5b4e32197adf93 100644 (file)
@@ -20,6 +20,7 @@
 #
 #   ARBORX_INCLUDE_DIRS
 #   ARBORX_INTERFACE_LINK_FLAGS
+#   ARBORX_WITH_MPI
 #
 
 set(ARBORX_DIR "" CACHE PATH "An optional hint to an ArborX installation")
@@ -56,9 +57,10 @@ if(ArborX_FOUND)
     file(STRINGS "${ARBORX_CONFIG_HPP}" ARBORX_MPI_STRING
       REGEX "#define ARBORX_ENABLE_MPI")
     if("${ARBORX_MPI_STRING}" STREQUAL "")
+      set(ARBORX_WITH_MPI FALSE)
       message(STATUS "ArborX has no MPI support")
     else()
-      set(DEAL_II_ARBORX_WITH_MPI TRUE)
+      set(ARBORX_WITH_MPI TRUE)
       message(STATUS "ArborX has MPI support")
     endif()
   endif()

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.