]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use SmartPointer
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 19 Aug 2018 22:23:29 +0000 (00:23 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 20 Aug 2018 18:04:51 +0000 (20:04 +0200)
include/deal.II/lac/cuda_precondition.h
source/lac/cuda_precondition.cu

index 73ce2a644060b003d32413a27bb25fd235272373..8da6e5034883bb0a1bf7693b1c9c1d3e97065641 100644 (file)
@@ -19,6 +19,7 @@
 #include <deal.II/base/config.h>
 
 #include <deal.II/base/cuda.h>
+#include <deal.II/base/smartpointer.h>
 
 #include <memory>
 
@@ -189,6 +190,11 @@ namespace CUDAWrappers
      */
     csrsv2Info_t info_Lt;
 
+    /**
+     * Pointer to the matrix this object was initialized with.
+     */
+    SmartPointer<const SparseMatrix<Number>> 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<const SparseMatrix<Number>> 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;
 
index 26ab5d58320ea80bb2ec716bb2c9a38ac2354432..0030d5ca05800f5a2c936c6afa67841523d7afad 100644 (file)
@@ -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());

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.