From: Matthias Maier Date: Mon, 24 Mar 2025 22:51:59 +0000 (-0500) Subject: CMake: Refactor Kokkos setup into FindDEAL_II_KOKKOS.cmake X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e35fb7d122438fe5d023e120c9a2c2965ed8d3e7;p=dealii.git CMake: Refactor Kokkos setup into FindDEAL_II_KOKKOS.cmake --- diff --git a/cmake/configure/configure_20_trilinos.cmake b/cmake/configure/configure_20_trilinos.cmake index ed568f3e28..70aa34186d 100644 --- a/cmake/configure/configure_20_trilinos.cmake +++ b/cmake/configure/configure_20_trilinos.cmake @@ -194,6 +194,15 @@ macro(feature_trilinos_find_external var) "includes Kokkos, but DEAL_II_FORCE_BUNDLED_KOKKOS=ON!\n") set(${var} FALSE) endif() + + # + # When configuring Kokkos we have to ensure that we actually pick up the + # correct Kokkos installation coming from Trilinos. + # + # FIXME: this logic should probably be refactored into + # FindDEAL_II_TRILINOS.cmake... + # + set(TRILINOS_KOKKOS_DIR "${TRILINOS_CONFIG_DIR}/..") endif() if(TRILINOS_WITH_KOKKOS AND Kokkos_ENABLE_CUDA) diff --git a/cmake/modules/FindDEAL_II_PETSC.cmake b/cmake/modules/FindDEAL_II_PETSC.cmake index 6e56267ddf..874b332286 100644 --- a/cmake/modules/FindDEAL_II_PETSC.cmake +++ b/cmake/modules/FindDEAL_II_PETSC.cmake @@ -18,13 +18,14 @@ # This module exports: # # PETSC_FOUND -# PETSC_LIBRARIES # PETSC_INCLUDE_DIRS +# PETSC_KOKKOS_DIR +# PETSC_LIBRARIES # PETSC_VERSION # PETSC_VERSION_MAJOR # PETSC_VERSION_MINOR -# PETSC_VERSION_SUBMINOR # PETSC_VERSION_PATCH +# PETSC_VERSION_SUBMINOR # PETSC_WITH_64BIT_INDICES # PETSC_WITH_COMPLEX # PETSC_WITH_HYPRE @@ -194,18 +195,15 @@ if(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") endif() endforeach() - # PETSc does not expose Kokkos version, so we need to search for Kokkos - # ourselves. + # + # When configuring Kokkos we have to ensure that we actually pick up the + # correct Kokkos installation coming from PETSc. + # if(PETSC_WITH_KOKKOS) file(STRINGS "${PETSC_PETSCVARIABLES}" KOKKOS_INCLUDE REGEX "^KOKKOS_INCLUDE =.*") string(REGEX REPLACE "^KOKKOS_INCLUDE = -I" "" KOKKOS_INCLUDE "${KOKKOS_INCLUDE}") - find_package(Kokkos 3.7.0 QUIET - PATHS ${KOKKOS_INCLUDE}/.. NO_DEFAULT_PATH - ) - if(NOT Kokkos_FOUND) - set(PETSC_FOUND FALSE) - endif() + set(PETSC_KOKKOS_DIR "${KOKKOS_INCLUDE}/..") endif() endif()