A good way to recycle Gingko data structures at high speeds. #1512
-
Hello, I would like to apply an Iterative method using Ginkgo to the Matrix solving routine of the Newton Solver in the numerical simulator. The simulator manages variables for matrix solving with a custom data type that is a combination of unordered map and vector to handle Jacobian matrices, and std::vector to handle residue vectors. From the example files I've seen, it seems that gingko basically holds the data of a matrix or vector in gko::matrix_data<> and then reads it into a Matrix created in shared_ptr format. In the example code, the code to successively generate elements in the Diagonal term I created and put them into the Csr Matrix is as follows.
However, it seems like it would be overkill to recreate the datatype and form a Matrix for every Newton Iteration. In my old Trilinos implementation, I was able to create a CrsGraph and reuse the datatype specific to the solver via replace{global, local}value function. So my question is this.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
There is some additional complexity involved if you want to use a preconditioner with your problem, because the preconditioner also needs to be recomputed with updated values, but we are also working on a way to provide a clean interface for that. Finally, if your code is really performance-critical, I want to suggest replacing |
Beta Was this translation helpful? Give feedback.
gko::matrix_data
is mostly suitable for IO and applications where the matrix assembly is not a costly operation. That doesn't seem to be the case in your application, so I want to suggest either updating the values in-place inside the generated matrix (the ordering of values stays intact when moving from a row-major sortedmatrix_data
object to a Csr matrix). We have internal functionality to find the nonzero location at a specific column, but we don't expose it yet.For the initial matrix assembly, you can use
device_matrix_data
, which is stored in structure-of-arrays (SoA) storage format, which is more suitable for high-performance applications than the array-of-structs (AoS) used inma…