]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Suppress some nvcc warnings
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 9 Feb 2023 21:25:53 +0000 (21:25 +0000)
committerDaniel Arndt <arndtd@ornl.gov>
Sat, 11 Feb 2023 04:15:15 +0000 (23:15 -0500)
cmake/macros/macro_deal_ii_add_library.cmake
cmake/macros/macro_deal_ii_setup_target.cmake
cmake/macros/macro_enable_if_supported.cmake
cmake/macros/macro_insource_setup_target.cmake
cmake/modules/FindDEAL_II_CUDA.cmake

index 87a9fd9fca506fa081700dbfaa007e67d3c75bae..8b79907e4aa9e3ef51562d13e948f565e2c327ae 100644 (file)
@@ -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}
index 75ec74acf57cf63e6427eed4a497669032e25878..f6c0e44e315572ec4d02c2d921d3b5258e1e6b5d 100644 (file)
@@ -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})
 
index 69ae6c4ada5c4966b2b0eb75f7d41b0b7abcf79b..38c8eba2d8bc9f18171ca71f82990d119803fbe5 100644 (file)
@@ -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})
 
index 556fecaf0d3ed8d5e19475a8655c038e1b2acd97..4131de49d01285b23d2b3b1a8f706c2f3d2e6407 100644 (file)
@@ -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}
index 6c234db6f0db7e66916468c7e2bef659eee96927..acd7ce9e85a8abe3bfbd22a80c5b3e086bfe0b94 100644 (file)
@@ -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

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.