From cb8b19ea003ec3feb9fc7172d863f635e53ab89e Mon Sep 17 00:00:00 2001 From: Vinh Dang Date: Tue, 15 Nov 2022 12:01:41 -0800 Subject: [PATCH] Fix seg fault by moving deleting dense vec descriptors to symbolic and solve --- .../src/sparse/KokkosSparse_sptrsv_handle.hpp | 4 ---- .../src/sparse/impl/KokkosSparse_sptrsv_cuSPARSE_impl.hpp | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/kokkos-kernels/src/sparse/KokkosSparse_sptrsv_handle.hpp b/packages/kokkos-kernels/src/sparse/KokkosSparse_sptrsv_handle.hpp index 7933d11a8c0c..a5aacca3612f 100644 --- a/packages/kokkos-kernels/src/sparse/KokkosSparse_sptrsv_handle.hpp +++ b/packages/kokkos-kernels/src/sparse/KokkosSparse_sptrsv_handle.hpp @@ -187,10 +187,6 @@ class SPTRSVHandle { pBuffer = nullptr; } KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroySpMat(matDescr)); - KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroyDnVec(vecBDescr)); - KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroyDnVec(vecBDescr_dummy)); - KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroyDnVec(vecXDescr)); - KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroyDnVec(vecXDescr_dummy)); KOKKOS_CUSPARSE_SAFE_CALL(cusparseSpSV_destroyDescr(spsvDescr)); KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroy(handle)); } diff --git a/packages/kokkos-kernels/src/sparse/impl/KokkosSparse_sptrsv_cuSPARSE_impl.hpp b/packages/kokkos-kernels/src/sparse/impl/KokkosSparse_sptrsv_cuSPARSE_impl.hpp index 19af87b91efa..c2a4fcd43a3c 100644 --- a/packages/kokkos-kernels/src/sparse/impl/KokkosSparse_sptrsv_cuSPARSE_impl.hpp +++ b/packages/kokkos-kernels/src/sparse/impl/KokkosSparse_sptrsv_cuSPARSE_impl.hpp @@ -167,6 +167,10 @@ void sptrsvcuSPARSE_symbolic(KernelHandle* sptrsv_handle, h->handle, h->transpose, &alpha, h->matDescr, h->vecBDescr_dummy, h->vecXDescr_dummy, cudaValueType, CUSPARSE_SPSV_ALG_DEFAULT, h->spsvDescr, h->pBuffer)); + + //Destroy dummy dense vector descriptors + KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroyDnVec(h->vecBDescr_dummy)); + KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroyDnVec(h->vecXDescr_dummy)); } #else // CUDA_VERSION < 11030 typedef typename KernelHandle::nnz_lno_t idx_type; @@ -361,6 +365,10 @@ void sptrsvcuSPARSE_solve(KernelHandle* sptrsv_handle, KOKKOS_CUSPARSE_SAFE_CALL(cusparseSpSV_solve( h->handle, h->transpose, &alpha, h->matDescr, h->vecBDescr, h->vecXDescr, cudaValueType, CUSPARSE_SPSV_ALG_DEFAULT, h->spsvDescr)); + + //Destroy dense vector descriptors + KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroyDnVec(h->vecBDescr)); + KOKKOS_CUSPARSE_SAFE_CALL(cusparseDestroyDnVec(h->vecXDescr)); } #else // CUDA_VERSION < 11030 typedef typename KernelHandle::nnz_lno_t idx_type;