Commit 32e1ab9b authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Disable use of cusparse functions which were removed in CUDA 11

parent 3eccf1a7
Loading
Loading
Loading
Loading
+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
      }
};
+8 −0
Original line number Diff line number Diff line
@@ -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
      };
};