From: Bruno Turcksin Date: Tue, 22 Apr 2025 19:20:44 +0000 (-0400) Subject: Define our own variable to know if HIP support is enable X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac7446fa032184aed31de1274136baf20a9cf32d;p=dealii.git Define our own variable to know if HIP support is enable --- 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