From: Daniel Arndt Date: Thu, 9 Feb 2023 21:25:53 +0000 (+0000) Subject: Suppress some nvcc warnings X-Git-Tag: v9.5.0-rc1~537^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8ea17e0fd8f2783333edff246a6190c352afc53;p=dealii.git Suppress some nvcc warnings --- diff --git a/cmake/macros/macro_deal_ii_add_library.cmake b/cmake/macros/macro_deal_ii_add_library.cmake index 87a9fd9fca..8b79907e4a 100644 --- a/cmake/macros/macro_deal_ii_add_library.cmake +++ b/cmake/macros/macro_deal_ii_add_library.cmake @@ -41,7 +41,12 @@ macro(deal_ii_add_library _library) ) set(_flags "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}") - separate_arguments(_flags) + + # Make sure some CUDA warning flags don't get deduplicated + string(REGEX REPLACE "(-Xcudafe --diag_suppress=[^ ]+)" "\"SHELL:\\1\"" _flags ${_flags}) + + separate_arguments(_flags UNIX_COMMAND ${_flags}) + target_compile_options(${_library}_${_build_lowercase} PUBLIC ${_flags}) target_compile_definitions(${_library}_${_build_lowercase} diff --git a/cmake/macros/macro_deal_ii_setup_target.cmake b/cmake/macros/macro_deal_ii_setup_target.cmake index 75ec74acf5..f6c0e44e31 100644 --- a/cmake/macros/macro_deal_ii_setup_target.cmake +++ b/cmake/macros/macro_deal_ii_setup_target.cmake @@ -115,7 +115,11 @@ macro(deal_ii_setup_target _target) ) set(_flags "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}") - separate_arguments(_flags) + + # Make sure some CUDA warning flags don't get deduplicated + string(REGEX REPLACE "(-Xcudafe --diag_suppress=[^ ]+)" "\"SHELL:\\1\"" _flags ${_flags}) + + separate_arguments(_flags UNIX_COMMAND ${_flags}) target_compile_options(${_target} PUBLIC ${_flags}) diff --git a/cmake/macros/macro_enable_if_supported.cmake b/cmake/macros/macro_enable_if_supported.cmake index 69ae6c4ada..38c8eba2d8 100644 --- a/cmake/macros/macro_enable_if_supported.cmake +++ b/cmake/macros/macro_enable_if_supported.cmake @@ -38,7 +38,7 @@ macro(enable_if_supported _variable _flag) if(NOT "${_flag_stripped}" STREQUAL "") string(REGEX REPLACE "^-" "" _flag_name "${_flag_stripped}") - string(REGEX REPLACE "\[-+,\]" "_" _flag_name "${_flag_name}") + string(REGEX REPLACE "\[-+,= \]" "_" _flag_name "${_flag_name}") CHECK_CXX_COMPILER_FLAG("${_flag_sanitized}" DEAL_II_HAVE_FLAG_${_flag_name}) diff --git a/cmake/macros/macro_insource_setup_target.cmake b/cmake/macros/macro_insource_setup_target.cmake index 556fecaf0d..4131de49d0 100644 --- a/cmake/macros/macro_insource_setup_target.cmake +++ b/cmake/macros/macro_insource_setup_target.cmake @@ -41,7 +41,12 @@ function(insource_setup_target _target _build) target_include_directories(${_target} SYSTEM PRIVATE ${DEAL_II_INCLUDE_DIRS}) set(_flags "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}") - separate_arguments(_flags) + + # Make sure some CUDA warning flags don't get deduplicated + string(REGEX REPLACE "(-Xcudafe --diag_suppress=[^ ]+)" "\"SHELL:\\1\"" _flags ${_flags}) + + separate_arguments(_flags UNIX_COMMAND ${_flags}) + target_compile_options(${_target} PUBLIC ${_flags}) target_compile_definitions(${_target} diff --git a/cmake/modules/FindDEAL_II_CUDA.cmake b/cmake/modules/FindDEAL_II_CUDA.cmake index 6c234db6f0..acd7ce9e85 100644 --- a/cmake/modules/FindDEAL_II_CUDA.cmake +++ b/cmake/modules/FindDEAL_II_CUDA.cmake @@ -40,9 +40,17 @@ if(CUDA_FOUND) message(STATUS "Configured to use CUDA installation at ${CUDA_TOOLKIT_ROOT_DIR}") endif() +enable_if_supported(_cuda_flags "-Xcudafe --diag_suppress=unsigned_compare_with_zero") +enable_if_supported(_cuda_flags "-Xcudafe --diag_suppress=integer_sign_change") +enable_if_supported(_cuda_flags "-Xcudafe --diag_suppress=20208") # long double treated as double +enable_if_supported(_cuda_flags "-Xcudafe --diag_suppress=1301") # non-template friend +enable_if_supported(_cuda_flags "-Wno-non-template-friend") +enable_if_supported(_cuda_flags "-Xcudafe --diag_suppress=loop_not_reachable") + process_feature(CUDA LIBRARIES REQUIRED CUDA_LIBRARIES CUDA_cusparse_LIBRARY CUDA_cusolver_LIBRARY INCLUDE_DIRS REQUIRED CUDA_INCLUDE_DIRS + CXX_FLAGS OPTIONAL _cuda_flags CLEAR CUDA_cublas_device_LIBRARY CUDA_cublas_LIBRARY