]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make sure SUNDIALS has the same MPI support as deal.II 18453/head
authorDaniel Arndt <arndtd@ornl.gov>
Wed, 14 May 2025 19:47:31 +0000 (15:47 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Wed, 14 May 2025 19:47:31 +0000 (15:47 -0400)
cmake/configure/configure_50_sundials.cmake
cmake/modules/FindDEAL_II_SUNDIALS.cmake

index ccc94209ef2696b66ff6b080c828b3a909adbd2d..cabf4a69c48db831105c96a35e51d164ef19ecfe 100644 (file)
@@ -39,6 +39,24 @@ macro(feature_sundials_find_external var)
         )
       set(${var} FALSE)
     endif()
+
+    #
+    # Sundials has to be configured with the same MPI configuration as
+    # deal.II.
+    #
+    if((SUNDIALS_WITH_MPI AND NOT DEAL_II_WITH_MPI) OR (NOT SUNDIALS_WITH_MPI AND DEAL_II_WITH_MPI))
+      message(STATUS "Could not find a sufficient Sundials installation: "
+        "If deal.II and Sundials must either both have MPI support enabled or none of them."
+      )
+      set(SUNDIALS_ADDITIONAL_ERROR_STRING
+        ${SUNDIALS_ADDITIONAL_ERROR_STRING}
+        "The Sundials installation (found at \"${SUNDIALS_DIR}\") has:\n"
+        "  SUNDIALS_WITH_MPI = ${SUNDIALS_WITH_MPI}\n"
+        " While deal.II has:\n"
+        "  DEAL_II_WITH_MPI = ${DEAL_II_WITH_MPI}\n"
+      )
+      set(${var} FALSE)
+    endif()
   endif()
 endmacro()
 
index 5467c6abd5a8c4e5aad24bb2f4fcc0c7db3c2c9b..cf6ce68fdcfba411beee80cf06ba8f4ccbfca420 100644 (file)
@@ -20,6 +20,7 @@
 #   SUNDIALS_LIBRARIES
 #   SUNDIALS_INCLUDE_DIR
 #   SUNDIALS_WITH_IDAS
+#   SUNDIALS_WITH_MPI
 #   SUNDIALS_VERSION
 #   SUNDIALS_VERSION_MAJOR
 #   SUNDIALS_VERSION_MINOR
@@ -124,6 +125,17 @@ if(NOT SUNDIALS_CONFIG_H MATCHES "-NOTFOUND")
   set(SUNDIALS_VERSION
     "${SUNDIALS_VERSION_MAJOR}.${SUNDIALS_VERSION_MINOR}.${SUNDIALS_VERSION_PATCH}"
     )
+
+  #
+  # Determine whether Sundials was configured with MPI:
+  #
+  file(STRINGS "${SUNDIALS_CONFIG_H}" SUNDIALS_MPI_STRING
+    REGEX "^[ \t]*#[ \t]*define[ \t]+SUNDIALS_MPI_ENABLED[ \t]1")
+  if("${SUNDIALS_MPI_STRING}" STREQUAL "")
+    set(SUNDIALS_WITH_MPI FALSE)
+  else()
+    set(SUNDIALS_WITH_MPI TRUE)
+  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.