From 4320cce7bef35e87fff6bd75f690d5616423f6c7 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Mon, 20 Aug 2018 00:23:29 +0200 Subject: [PATCH] Use SmartPointer --- include/deal.II/lac/cuda_precondition.h | 19 +++++++++++++++---- source/lac/cuda_precondition.cu | 3 ++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/deal.II/lac/cuda_precondition.h b/include/deal.II/lac/cuda_precondition.h index 73ce2a6440..8da6e50348 100644 --- a/include/deal.II/lac/cuda_precondition.h +++ b/include/deal.II/lac/cuda_precondition.h @@ -19,6 +19,7 @@ #include #include +#include #include @@ -189,6 +190,11 @@ namespace CUDAWrappers */ csrsv2Info_t info_Lt; + /** + * Pointer to the matrix this object was initialized with. + */ + SmartPointer> matrix_pointer; + /** * Pointer to the values (on the device) of the computed preconditioning * matrix. @@ -197,13 +203,13 @@ namespace CUDAWrappers /** * Pointer to the row pointer (on the device) of the sparse matrix this - * object was initialized with. + * object was initialized with. Guarded by matrix_pointer. */ const int *P_row_ptr_dev; /** * Pointer to the column indices (on the device) of the sparse matrix this - * object was initialized with. + * object was initialized with. Guarded by matrix_pointer. */ const int *P_column_index_dev; @@ -403,6 +409,11 @@ namespace CUDAWrappers */ csrsv2Info_t info_U; + /** + * Pointer to the matrix this object was initialized with. + */ + SmartPointer> matrix_pointer; + /** * Pointer to the values (on the device) of the computed preconditioning * matrix. @@ -411,13 +422,13 @@ namespace CUDAWrappers /** * Pointer to the row pointer (on the device) of the sparse matrix this - * object was initialized with. + * object was initialized with. Guarded by matrix_pointer. */ const int *P_row_ptr_dev; /** * Pointer to the column indices (on the device) of the sparse matrix this - * object was initialized with. + * object was initialized with. Guarded by matrix_pointer. */ const int *P_column_index_dev; diff --git a/source/lac/cuda_precondition.cu b/source/lac/cuda_precondition.cu index 26ab5d5832..0030d5ca05 100644 --- a/source/lac/cuda_precondition.cu +++ b/source/lac/cuda_precondition.cu @@ -1311,6 +1311,7 @@ namespace CUDAWrappers n_nonzero_elements = A.n_nonzero_elements(); AssertDimension(A.m(), A.n()); + matrix_pointer = &A; const auto cusparse_matrix = A.get_cusparse_matrix(); const Number *const A_val_dev = std::get<0>(cusparse_matrix); @@ -1626,7 +1627,7 @@ namespace CUDAWrappers policy_M = CUSPARSE_SOLVE_POLICY_NO_LEVEL; } - + matrix_pointer = &A; n_rows = A.m(); n_nonzero_elements = A.n_nonzero_elements(); AssertDimension(A.m(), A.n()); -- 2.39.5