Commit 4cef7cdb authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Merge branch 'JK/CUDA11' into 'develop'

Updates for CUDA 11

See merge request !71
parents 95c7ff96 32e1ab9b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+18 −6
Original line number Diff line number Diff line
@@ -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
      }

@@ -105,6 +109,9 @@ class CusparseCSR< double > : public CusparseCSRBase< double >
      {
         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
	 double d = 1.0;
         double* alpha = &d;
         cusparseDcsrmv( *( this->cusparseHandle ),
@@ -120,6 +127,7 @@ class CusparseCSR< double > : public CusparseCSRBase< double >
                         inVector.getData(),
                         alpha,
                         outVector.getData() );
#endif
#endif
      }
};
@@ -136,6 +144,9 @@ class CusparseCSR< float > : public CusparseCSRBase< float >
      {
         TNL_ASSERT_TRUE( matrix, "matrix was not initialized" );
#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 ),
@@ -151,6 +162,7 @@ class CusparseCSR< float > : public CusparseCSRBase< float >
                         inVector.getData(),
                         alpha,
                         outVector.getData() );
#endif
#endif
      }
};
+2 −0
Original line number Diff line number Diff line
@@ -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;

+2 −0
Original line number Diff line number Diff line
@@ -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.
+2 −0
Original line number Diff line number Diff line
@@ -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.
Loading