From ac7446fa032184aed31de1274136baf20a9cf32d Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Tue, 22 Apr 2025 15:20:44 -0400 Subject: [PATCH] Define our own variable to know if HIP support is enable --- cmake/modules/FindDEAL_II_KOKKOS.cmake | 6 ++++++ include/deal.II/base/config.h.in | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/modules/FindDEAL_II_KOKKOS.cmake b/cmake/modules/FindDEAL_II_KOKKOS.cmake index 9231dc4b75..39b7aec339 100644 --- a/cmake/modules/FindDEAL_II_KOKKOS.cmake +++ b/cmake/modules/FindDEAL_II_KOKKOS.cmake @@ -17,6 +17,7 @@ # # This module exports # +# DEAL_II_KOKKOS_ENABLE_HIP # KOKKOS_INCLUDE_DIRS # KOKKOS_INTERFACE_LINK_FLAGS # KOKKOS_VERSION @@ -168,6 +169,11 @@ if(KOKKOS_FOUND) enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=940") endif() + if(Kokkos_ENABLE_HIP) + # Define our own variable to avoid including Kokkos_Macros.hpp in config.h + set(DEAL_II_KOKKOS_ENABLE_HIP ON) + endif() + # # Extract version numbers: # diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index b96bb2b734..766648ef23 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -170,7 +170,8 @@ DEAL_II_NAMESPACE_CLOSE // Kokkos was configured with CUDA or HIP support. This is problematic // when calling non-constexpr functions in constexpr functions. Hence, we // need a way to annotate functions explicitly as host-only. -#if (defined(__clang__) && defined(__CUDA__)) || defined(KOKKOS_ENABLE_HIP) +#cmakedefine DEAL_II_KOKKOS_ENABLE_HIP +#if (defined(__clang__) && defined(__CUDA__)) || defined(DEAL_II_KOKKOS_ENABLE_HIP) # define DEAL_II_HOST __host__ #else # define DEAL_II_HOST -- 2.39.5