]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Kokkos: disable CUDA warnings when using Kokkos from Trilinos 17417/head
authorTimo Heister <timo.heister@gmail.com>
Thu, 1 Aug 2024 18:00:05 +0000 (14:00 -0400)
committerTimo Heister <timo.heister@gmail.com>
Thu, 1 Aug 2024 18:00:35 +0000 (14:00 -0400)
We disable a bunch of nvcc warnings for the project, but so far not if
Kokkos comes bundled inside Tilinos. Fix that.

part of #7037

cmake/modules/FindDEAL_II_KOKKOS.cmake

index dac87f9bc9f89aac6657007a4f6151ddf0db260a..40ac11261a8fb63dd8bf875b63da6265d9a05866 100644 (file)
@@ -39,39 +39,41 @@ else()
 
   set(KOKKOS_FOUND ${Kokkos_FOUND})
 
-  if(Kokkos_FOUND)
+  set(_target Kokkos::kokkos)
+  process_feature(KOKKOS
+    TARGETS REQUIRED _target
+    )
+endif()
+
+
+if(Kokkos_FOUND)
+  if(Kokkos_ENABLE_CUDA)
     # We need to disable SIMD vectorization for CUDA device code.
     # Otherwise, nvcc compilers from version 9 on will emit an error message like:
     # "[...] contains a vector, which is not supported in device code". We
     # would like to set the variable in check_01_cpu_feature but at that point
     # we don't know if CUDA support is enabled in Kokkos
-    if(Kokkos_ENABLE_CUDA)
-      set(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 0)
-      # Require lambda support and expt-relaxed-constexpr for Cuda
-      # so that we can use std::array and other interfaces with
-      # __host__ constexpr functions in device code
-      KOKKOS_CHECK(OPTIONS CUDA_LAMBDA CUDA_CONSTEXPR)
+    set(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 0)
 
-      # Disable a bunch of annoying warnings generated by boost, template code,
-      # and in other random places:
-      #
-      # integer conversion resulted in a change of sign:
-      enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=68")
-      # variable "i" was set but never used:
-      enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=550")
-      # loop is not reachable:
-      enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=128")
-      # warning #186-D: pointless comparison of unsigned integer with zero
-      enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=186")
-      # warning #177-D: variable "n_max_face_orientations" was declared but never referenced
-      enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=177")
-      # warning #284-D: NULL reference is not allowed
-      enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=284")
-    endif()
-  endif()
+    # Require lambda support and expt-relaxed-constexpr for Cuda
+    # so that we can use std::array and other interfaces with
+    # __host__ constexpr functions in device code
+    KOKKOS_CHECK(OPTIONS CUDA_LAMBDA CUDA_CONSTEXPR)
 
-  set(_target Kokkos::kokkos)
-  process_feature(KOKKOS
-    TARGETS REQUIRED _target
-    )
+    # Disable a bunch of annoying warnings generated by boost, template code,
+    # and in other random places:
+    #
+    # integer conversion resulted in a change of sign:
+    enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=68")
+    # variable "i" was set but never used:
+    enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=550")
+    # loop is not reachable:
+    enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=128")
+    # warning #186-D: pointless comparison of unsigned integer with zero
+    enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=186")
+    # warning #177-D: variable "n_max_face_orientations" was declared but never referenced
+    enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=177")
+    # warning #284-D: NULL reference is not allowed
+    enable_if_supported(DEAL_II_CXX_FLAGS "-Xcudafe --diag_suppress=284")
+  endif()
 endif()

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.