Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of RAII to set cusparse/rocsparse stream #2141

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sparse/tpls/KokkosSparse_spmv_bsrmatrix_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void spmv_bsr_cusparse(const Kokkos::Cuda& exec, Handle* handle,
cusparseHandle_t cusparseHandle =
KokkosKernels::Impl::CusparseSingleton::singleton().cusparseHandle;
/* Set cuSPARSE to use the given stream until this function exits */
KokkosSparse::Impl::TemporarySetCusparseStream(cusparseHandle, exec);
KokkosSparse::Impl::TemporarySetCusparseStream tscs(cusparseHandle, exec);

/* Set the operation mode */
cusparseOperation_t myCusparseOperation;
Expand Down Expand Up @@ -492,7 +492,7 @@ void spmv_mv_bsr_cusparse(const Kokkos::Cuda& exec, Handle* handle,
cusparseHandle_t cusparseHandle =
KokkosKernels::Impl::CusparseSingleton::singleton().cusparseHandle;
/* Set cuSPARSE to use the given stream until this function exits */
KokkosSparse::Impl::TemporarySetCusparseStream(cusparseHandle, exec);
KokkosSparse::Impl::TemporarySetCusparseStream tscs(cusparseHandle, exec);

/* Set the operation mode */
cusparseOperation_t myCusparseOperation;
Expand Down
2 changes: 1 addition & 1 deletion sparse/tpls/KokkosSparse_spmv_mv_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void spmv_mv_cusparse(const Kokkos::Cuda &exec, Handle *handle,
cusparseHandle_t cusparseHandle =
KokkosKernels::Impl::CusparseSingleton::singleton().cusparseHandle;
/* Set cuSPARSE to use the given stream until this function exits */
TemporarySetCusparseStream(cusparseHandle, exec);
TemporarySetCusparseStream tscs(cusparseHandle, exec);

/* Check that cusparse can handle the types of the input Kokkos::CrsMatrix */
const cusparseIndexType_t myCusparseOffsetType =
Expand Down
4 changes: 2 additions & 2 deletions sparse/tpls/KokkosSparse_spmv_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void spmv_cusparse(const Kokkos::Cuda& exec, Handle* handle, const char mode[],
cusparseHandle_t cusparseHandle =
KokkosKernels::Impl::CusparseSingleton::singleton().cusparseHandle;
/* Set cuSPARSE to use the given stream until this function exits */
TemporarySetCusparseStream(cusparseHandle, exec);
TemporarySetCusparseStream tscs(cusparseHandle, exec);

/* Set the operation mode */
cusparseOperation_t myCusparseOperation;
Expand Down Expand Up @@ -389,7 +389,7 @@ void spmv_rocsparse(const Kokkos::HIP& exec, Handle* handle, const char mode[],
rocsparse_handle rocsparseHandle =
KokkosKernels::Impl::RocsparseSingleton::singleton().rocsparseHandle;
/* Set rocsparse to use the given stream until this function exits */
TemporarySetRocsparseStream(rocsparseHandle, exec);
TemporarySetRocsparseStream tsrs(rocsparseHandle, exec);

/* Set the operation mode */
rocsparse_operation myRocsparseOperation = mode_kk_to_rocsparse(mode);
Expand Down