From f8035898f91c56cf36e30c918f6005d5ff3e1f1d Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Tue, 15 Feb 2022 19:03:48 +0000 Subject: [PATCH] Detect if ArborX was compiled with MPI support --- cmake/modules/FindARBORX.cmake | 30 ++++++++++++++++++++++++++++++ include/deal.II/base/config.h.in | 3 +++ 2 files changed, 33 insertions(+) diff --git a/cmake/modules/FindARBORX.cmake b/cmake/modules/FindARBORX.cmake index e4b9b00280..e6b295f6e0 100644 --- a/cmake/modules/FindARBORX.cmake +++ b/cmake/modules/FindARBORX.cmake @@ -32,6 +32,36 @@ FIND_PACKAGE(ArborX IF(ArborX_FOUND) GET_PROPERTY(ARBORX_INSTALL_INCLUDE_DIR TARGET ArborX::ArborX PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + + # + # Check whether ArborX was compiled with MPI support + # + MESSAGE(STATUS + "Checking whether the found ArborX has MPI support:" + ) + + # + # Look for ArborX_Config.hpp - we'll query it to determine MPI support: + # + DEAL_II_FIND_FILE(ARBORX_CONFIG_HPP ArborX_Config.hpp + HINTS ${ARBORX_INSTALL_INCLUDE_DIR} + NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH + ) + + IF(EXISTS ${ARBORX_CONFIG_HPP}) + # + # Determine whether ArborX was configured with MPI: + # + FILE(STRINGS "${ARBORX_CONFIG_HPP}" ARBORX_MPI_STRING + REGEX "#define ARBORX_ENABLE_MPI") + IF("${ARBORX_MPI_STRING}" STREQUAL "") + MESSAGE(STATUS "ArborX has no MPI support") + ELSE() + SET(DEAL_II_ARBORX_WITH_MPI TRUE) + MESSAGE(STATUS "ArborX has MPI support") + ENDIF() + ENDIF() ENDIF() DEAL_II_PACKAGE_HANDLE(ARBORX diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 89e2dc3552..11ac41cfb5 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -210,6 +210,9 @@ #cmakedefine DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING #cmakedefine DEAL_II_ADOLC_WITH_TAPELESS_REFCOUNTING +/* cmake/modules/FindARBORX.cmake */ +#cmakedefine DEAL_II_ARBORX_WITH_MPI + /* cmake/modules/FindARPACK.cmake */ #cmakedefine DEAL_II_ARPACK_WITH_PARPACK -- 2.39.5