Skip to content

Commit

Permalink
Kokkos: disable CUDA warnings when using Kokkos from Trilinos
Browse files Browse the repository at this point in the history
We disable a bunch of nvcc warnings for the project, but so far not if
Kokkos comes bundled inside Tilinos. Fix that.

part of dealii#7037
  • Loading branch information
tjhei committed Aug 1, 2024
1 parent c9a3753 commit e5d3a7a
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions cmake/modules/FindDEAL_II_KOKKOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit e5d3a7a

Please sign in to comment.