From: Timo Heister Date: Thu, 1 Aug 2024 18:00:05 +0000 (-0400) Subject: Kokkos: disable CUDA warnings when using Kokkos from Trilinos X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a51d17c0c391cc4e5d968a2109d5a151c81fd8b7;p=dealii.git Kokkos: disable CUDA warnings when using Kokkos from Trilinos 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 --- diff --git a/cmake/modules/FindDEAL_II_KOKKOS.cmake b/cmake/modules/FindDEAL_II_KOKKOS.cmake index dac87f9bc9..40ac11261a 100644 --- a/cmake/modules/FindDEAL_II_KOKKOS.cmake +++ b/cmake/modules/FindDEAL_II_KOKKOS.cmake @@ -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()