diff --git a/CMakeLists.txt b/CMakeLists.txt index 27451ef8297f95647a5821d626c0fabefc5b3473..fa92f1f85de304f0f6f4261986ff95daea7b234d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,7 +220,7 @@ if( ${WITH_CUDA} ) # disable false compiler warnings # 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=unsigned_compare_with_zero --diag_suppress=2906 --diag_suppress=2913 --diag_suppress=2886 --diag_suppress=2929 --diag_suppress=2977 --display_error_number\"") + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -Wno-deprecated-gpu-targets --expt-relaxed-constexpr --expt-extended-lambda -Xcudafe --diag_suppress=code_is_unreachable -Xcudafe --diag_suppress=loop_not_reachable -Xcudafe --diag_suppress=implicit_return_from_non_void_function -Xcudafe --diag_suppress=unsigned_compare_with_zero -Xcudafe --diag_suppress=2906 -Xcudafe --diag_suppress=2913 -Xcudafe --diag_suppress=2886 -Xcudafe --diag_suppress=2929 -Xcudafe --diag_suppress=2977 -Xcudafe --diag_suppress=3057 -Xcudafe --display_error_number) # temporarily disable host-compler warnings about VLAs, which are caused by nvcc's modifications to the source code set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -Xcompiler -Wno-vla) # Select GPU architecture diff --git a/src/Benchmarks/SpMV/cusparseCSRMatrix.h b/src/Benchmarks/SpMV/cusparseCSRMatrix.h index 1cb52f8840345655f321289d947f65c445f4a1e6..ea5b9ddbfa68effa62bb9fc3108b6d993ca1f532 100644 --- a/src/Benchmarks/SpMV/cusparseCSRMatrix.h +++ b/src/Benchmarks/SpMV/cusparseCSRMatrix.h @@ -62,6 +62,9 @@ class CusparseCSRBase { TNL_ASSERT_TRUE( matrix, "matrix was not initialized" ); #ifdef HAVE_CUDA +#if CUDART_VERSION >= 11000 + throw std::runtime_error("cusparseDcsrmv was removed in CUDA 11."); +#else cusparseDcsrmv( *( this->cusparseHandle ), CUSPARSE_OPERATION_NON_TRANSPOSE, this->matrix->getRows(), @@ -75,6 +78,7 @@ class CusparseCSRBase inVector.getData(), 1.0, outVector.getData() ); +#endif #endif } @@ -104,8 +108,11 @@ class CusparseCSR< double > : public CusparseCSRBase< double > OutVector& outVector ) const { TNL_ASSERT_TRUE( matrix, "matrix was not initialized" ); -#ifdef HAVE_CUDA - double d = 1.0; +#ifdef HAVE_CUDA +#if CUDART_VERSION >= 11000 + throw std::runtime_error("cusparseDcsrmv was removed in CUDA 11."); +#else + double d = 1.0; double* alpha = &d; cusparseDcsrmv( *( this->cusparseHandle ), CUSPARSE_OPERATION_NON_TRANSPOSE, @@ -120,7 +127,8 @@ class CusparseCSR< double > : public CusparseCSRBase< double > inVector.getData(), alpha, outVector.getData() ); -#endif +#endif +#endif } }; @@ -135,8 +143,11 @@ class CusparseCSR< float > : public CusparseCSRBase< float > OutVector& outVector ) const { TNL_ASSERT_TRUE( matrix, "matrix was not initialized" ); -#ifdef HAVE_CUDA - float d = 1.0; +#ifdef HAVE_CUDA +#if CUDART_VERSION >= 11000 + throw std::runtime_error("cusparseScsrmv was removed in CUDA 11."); +#else + float d = 1.0; float* alpha = &d; cusparseScsrmv( *( this->cusparseHandle ), CUSPARSE_OPERATION_NON_TRANSPOSE, @@ -151,7 +162,8 @@ class CusparseCSR< float > : public CusparseCSRBase< float > inVector.getData(), alpha, outVector.getData() ); -#endif +#endif +#endif } }; diff --git a/src/TNL/Containers/DistributedVector.h b/src/TNL/Containers/DistributedVector.h index b6ebe7e818cad99f1c0003cec86323b632698f3a..5d5f8303f520ac23171797f2cd240510e42f140c 100644 --- a/src/TNL/Containers/DistributedVector.h +++ b/src/TNL/Containers/DistributedVector.h @@ -49,7 +49,9 @@ public: // inherit all constructors and assignment operators from Array using BaseType::DistributedArray; +#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11 using BaseType::operator=; +#endif DistributedVector() = default; diff --git a/src/TNL/Containers/DistributedVectorView.h b/src/TNL/Containers/DistributedVectorView.h index 72bc7588120d0527f6d4505a231fe37b33ba2dce..157a64b94d64da3ccad3ce81606f0708faa608c2 100644 --- a/src/TNL/Containers/DistributedVectorView.h +++ b/src/TNL/Containers/DistributedVectorView.h @@ -51,7 +51,9 @@ public: // inherit all constructors and assignment operators from ArrayView using BaseType::DistributedArrayView; +#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11 using BaseType::operator=; +#endif // In C++14, default constructors cannot be inherited, although Clang // and GCC since version 7.0 inherit them. diff --git a/src/TNL/Containers/StaticVector.h b/src/TNL/Containers/StaticVector.h index 86726a4d3bafa0264501be5b1394974eda977642..13cdd0fbc8ba583c4bcab601f568a2712076226f 100644 --- a/src/TNL/Containers/StaticVector.h +++ b/src/TNL/Containers/StaticVector.h @@ -64,7 +64,9 @@ public: //! Constructors and assignment operators are inherited from the class \ref StaticArray. using StaticArray< Size, Real >::StaticArray; +#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11 using StaticArray< Size, Real >::operator=; +#endif /** * \brief Constructor from binary vector expression. diff --git a/src/TNL/Containers/Vector.h b/src/TNL/Containers/Vector.h index 685a7f2068e665c7767b03350101367fa06ee123..9d09ecd5045e767b89dde23c23537dd543d711ce 100644 --- a/src/TNL/Containers/Vector.h +++ b/src/TNL/Containers/Vector.h @@ -194,6 +194,7 @@ public: */ // operator= from the base class should be hidden according to the C++14 standard, // although GCC does not do that - see https://stackoverflow.com/q/57322624 +#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11 template< typename T, typename..., typename = std::enable_if_t< std::is_convertible< T, Real >::value || IsArrayType< T >::value > > @@ -202,6 +203,7 @@ public: { return Array< Real, Device, Index, Allocator >::operator=(data); } +#endif /** * \brief Adds elements of this vector and a vector expression and diff --git a/src/TNL/Containers/VectorView.h b/src/TNL/Containers/VectorView.h index 4c5262d30f4ec904d176da1a33313ad94d64cd0f..77c25b3a257bd61c44016990216e18e84086a189 100644 --- a/src/TNL/Containers/VectorView.h +++ b/src/TNL/Containers/VectorView.h @@ -148,6 +148,7 @@ public: */ // operator= from the base class should be hidden according to the C++14 standard, // although GCC does not do that - see https://stackoverflow.com/q/57322624 +#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11 template< typename T, typename..., typename = std::enable_if_t< std::is_convertible< T, Real >::value || IsArrayType< T >::value > > @@ -156,6 +157,7 @@ public: { return ArrayView< Real, Device, Index >::operator=(data); } +#endif /** * \brief Adds elements of this vector view and a vector expression and diff --git a/src/TNL/Matrices/Legacy/CSR_impl.h b/src/TNL/Matrices/Legacy/CSR_impl.h index 3774b3bd811097283271e15ea8b5e4fb04559fee..6990d4072b5f8e62d0452bbc5785000cd84207da 100644 --- a/src/TNL/Matrices/Legacy/CSR_impl.h +++ b/src/TNL/Matrices/Legacy/CSR_impl.h @@ -1171,6 +1171,9 @@ class tnlCusparseCSRWrapper< float, int > const Real* x, Real* y ) { +#if CUDART_VERSION >= 11000 + throw std::runtime_error("cusparseScsrmv was removed in CUDA 11."); +#else cusparseHandle_t cusparseHandle; cusparseMatDescr_t cusparseMatDescr; cusparseCreate( &cusparseHandle ); @@ -1191,6 +1194,7 @@ class tnlCusparseCSRWrapper< float, int > x, &beta, y ); +#endif }; }; @@ -1211,6 +1215,9 @@ class tnlCusparseCSRWrapper< double, int > const Real* x, Real* y ) { +#if CUDART_VERSION >= 11000 + throw std::runtime_error("cusparseDcsrmv was removed in CUDA 11."); +#else cusparseHandle_t cusparseHandle; cusparseMatDescr_t cusparseMatDescr; cusparseCreate( &cusparseHandle ); @@ -1231,6 +1238,7 @@ class tnlCusparseCSRWrapper< double, int > x, &beta, y ); +#endif }; };