]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Define our own variable to know if HIP support is enable 18383/head
authorBruno Turcksin <bruno.turcksin@gmail.com>
Tue, 22 Apr 2025 19:20:44 +0000 (15:20 -0400)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Wed, 23 Apr 2025 16:09:14 +0000 (12:09 -0400)
cmake/modules/FindDEAL_II_KOKKOS.cmake
include/deal.II/base/config.h.in

index 9231dc4b7529419fc9651dacb131a10e4b5957b6..39b7aec339dd25867b41cac8dffad28d01eec5b1 100644 (file)
@@ -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:
   #
index b96bb2b734412358049abbb08537a50bce2cce6f..766648ef2341ef10cf8e4856af546817b3cf90e1 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.