Skip to content

Commit

Permalink
CUDA 11.2.1 / cuSPARSE 11.4.0 changed SpMV
Browse files Browse the repository at this point in the history
  • Loading branch information
cwpearson committed Oct 23, 2023
1 parent 549f6e1 commit 6fb18a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion perf_test/sparse/KokkosSparse_spmv_struct_tuning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,9 @@ int main(int argc, char** argv) {
const double alpha = 1.0, beta = 1.0;
size_t bufferSize = 0;
void* dBuffer = NULL;
#if CUSPARSE_VERSION >= 11201

// CUSPARSE_MM_ALG_DEFAULT was deprecated in CUDA 11.2.1 a.k.a cuSPARSE 11.4.0
#if CUSPARSE_VERSION >= 11400
cusparseSpMVAlg_t alg = CUSPARSE_SPMV_ALG_DEFAULT;
#else
cusparseSpMVAlg_t alg = CUSPARSE_MV_ALG_DEFAULT;
Expand Down
8 changes: 5 additions & 3 deletions sparse/tpls/KokkosSparse_spmv_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ void spmv_cusparse(const Kokkos::Cuda& exec,
!Kokkos::ArithTraits<value_type>::isComplex)
myCusparseOperation = CUSPARSE_OPERATION_TRANSPOSE;

// Hopefully this corresponds to CUDA reelase 10.1, which is the first to
// include the "generic" API
#if defined(CUSPARSE_VERSION) && (10300 <= CUSPARSE_VERSION)

using entry_type = typename AMatrix::non_const_ordinal_type;
Expand Down Expand Up @@ -105,21 +107,21 @@ void spmv_cusparse(const Kokkos::Cuda& exec,

size_t bufferSize = 0;
void* dBuffer = NULL;
#if CUSPARSE_VERSION >= 11301
#if CUSPARSE_VERSION >= 11400
cusparseSpMVAlg_t alg = CUSPARSE_SPMV_ALG_DEFAULT;
#else
cusparseSpMVAlg_t alg = CUSPARSE_MV_ALG_DEFAULT;
#endif
if (controls.isParameter("algorithm")) {
const std::string algName = controls.getParameter("algorithm");
if (algName == "default")
#if CUSPARSE_VERSION >= 11301
#if CUSPARSE_VERSION >= 11400
alg = CUSPARSE_SPMV_ALG_DEFAULT;
#else
alg = CUSPARSE_MV_ALG_DEFAULT;
#endif
else if (algName == "merge")
#if CUSPARSE_VERSION >= 11301
#if CUSPARSE_VERSION >= 11400
alg = CUSPARSE_SPMV_CSR_ALG2;
#else
alg = CUSPARSE_CSRMV_ALG2;
Expand Down

0 comments on commit 6fb18a1

Please sign in to comment.