From 3b73e43e371cacbf8af0fc3f8b2a19003fda3473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz> Date: Sun, 10 Feb 2019 10:26:39 +0100 Subject: [PATCH] Disabled more useless nvcc warnings --- CMakeLists.txt | 6 +++--- src/UnitTests/AssertCudaTest.cu | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 522820daf7..348ad4ac27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,9 +183,9 @@ if( ${WITH_CUDA} ) endif() set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ;-DHAVE_CUDA) # disable false compiler warnings - # reference for the -Xcudafe flag: http://stackoverflow.com/questions/14831051/how-to-disable-compiler-warnings-with-nvcc/17095910#17095910 - # list of possible tokens: http://www.ssl.berkeley.edu/~jimm/grizzly_docs/SSL/opt/intel/cc/9.0/lib/locale/en_US/mcpcom.msg - set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -Wno-deprecated-gpu-targets --expt-relaxed-constexpr --expt-extended-lambda -Xcudafe "\"--diag_suppress=code_is_unreachable --diag_suppress=implicit_return_from_non_void_function\"") + # reference for the -Xcudafe --diag_suppress and --display_error_number flags: https://stackoverflow.com/a/54142937 + # incomplete list of tokens: http://www.ssl.berkeley.edu/~jimm/grizzly_docs/SSL/opt/intel/cc/9.0/lib/locale/en_US/mcpcom.msg + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -Wno-deprecated-gpu-targets --expt-relaxed-constexpr --expt-extended-lambda -Xcudafe "\"--diag_suppress=code_is_unreachable --diag_suppress=implicit_return_from_non_void_function --diag_suppress=2906 --display_error_number\"") set( ALL_CUDA_ARCHS -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_32,code=sm_32 diff --git a/src/UnitTests/AssertCudaTest.cu b/src/UnitTests/AssertCudaTest.cu index 2aa9705c5a..cfd4e846b7 100644 --- a/src/UnitTests/AssertCudaTest.cu +++ b/src/UnitTests/AssertCudaTest.cu @@ -23,6 +23,10 @@ using namespace TNL; #ifdef HAVE_CUDA +// ignore useless nvcc warning: https://stackoverflow.com/a/49997636 +#pragma push +#pragma diag_suppress = declared_but_not_referenced + #define WRAP_ASSERT( suffix, statement, not_failing ) \ __global__ \ void kernel_##suffix( int* output ) \ @@ -99,6 +103,8 @@ WRAP_ASSERT( test26, TNL_ASSERT_LT( ten, 2, "ten < 2" );, false ); WRAP_ASSERT( test27, TNL_ASSERT_TRUE( data_null, "nullptr is true" );, false ); WRAP_ASSERT( test28, TNL_ASSERT_FALSE( data_full, "non-nullptr is false" );, false ); +#pragma pop + #endif #endif -- GitLab