From: Daniel Arndt Date: Wed, 14 May 2025 19:47:31 +0000 (-0400) Subject: Make sure SUNDIALS has the same MPI support as deal.II X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F18453%2Fhead;p=dealii.git Make sure SUNDIALS has the same MPI support as deal.II --- diff --git a/cmake/configure/configure_50_sundials.cmake b/cmake/configure/configure_50_sundials.cmake index ccc94209ef..cabf4a69c4 100644 --- a/cmake/configure/configure_50_sundials.cmake +++ b/cmake/configure/configure_50_sundials.cmake @@ -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() diff --git a/cmake/modules/FindDEAL_II_SUNDIALS.cmake b/cmake/modules/FindDEAL_II_SUNDIALS.cmake index 5467c6abd5..cf6ce68fdc 100644 --- a/cmake/modules/FindDEAL_II_SUNDIALS.cmake +++ b/cmake/modules/FindDEAL_II_SUNDIALS.cmake @@ -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() #