From 2e73bda62ec1045489be989c0ecaaf883ae19dad Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Thu, 11 May 2023 02:23:55 -0400 Subject: [PATCH] Workaround for cuda 12 issue in cusparse (#1508) Authors: - Corey J. Nolet (https://github.com/cjnolet) - Ben Frederickson (https://github.com/benfred) Approvers: - Divye Gala (https://github.com/divyegala) - Ben Frederickson (https://github.com/benfred) URL: https://github.com/rapidsai/raft/pull/1508 --- cpp/include/raft/spectral/detail/matrix_wrappers.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpp/include/raft/spectral/detail/matrix_wrappers.hpp b/cpp/include/raft/spectral/detail/matrix_wrappers.hpp index 73518e20ef..7128bfae32 100644 --- a/cpp/include/raft/spectral/detail/matrix_wrappers.hpp +++ b/cpp/include/raft/spectral/detail/matrix_wrappers.hpp @@ -223,8 +223,11 @@ struct sparse_matrix_t { cusparseDnVecDescr_t vecX; RAFT_CUSPARSE_TRY(raft::sparse::detail::cusparsecreatednvec(&vecX, size_x, x)); + rmm::device_uvector y_tmp(size_y, stream); + raft::copy(y_tmp.data(), y, size_y, stream); + cusparseDnVecDescr_t vecY; - RAFT_CUSPARSE_TRY(raft::sparse::detail::cusparsecreatednvec(&vecY, size_y, y)); + RAFT_CUSPARSE_TRY(raft::sparse::detail::cusparsecreatednvec(&vecY, size_y, y_tmp.data())); // get (scratch) external device buffer size: // @@ -241,6 +244,8 @@ struct sparse_matrix_t { RAFT_CUSPARSE_TRY(raft::sparse::detail::cusparsespmv( cusparse_h, trans, &alpha, matA, vecX, &beta, vecY, spmv_alg, external_buffer.raw(), stream)); + // FIXME: This is a workaround for a cusparse issue being encountered in CUDA 12 + raft::copy(y, y_tmp.data(), size_y, stream); // free descriptors: //(TODO: maybe wrap them in a RAII struct?) //