Replace duplication of sparse matrix
Open
@victorapm is already working on this.
Since Dec 22, 2023.
type: feature
type: new
- Dominant language
- C++
- Stars
- 287
- Forks
- 109
- Avg merge
- 4d 41m
- Merged PRs (30d)
- 5
Description
PROBLEM
For our assembly process, we currently:
- fill a
LvArray::SparsityPattern(LvArray::ArrayOfSets) and then, - assimilate that into a
LvArray::CRSMatrix. - In the assembly kernel, the dense local matrices are then inserted into the
LvArray::CRSMatrix, - Then a
HypreMatrix(contains aHYPRE_IJMatrixand aHYPRE_ParCSRMatrix) is created/allocated and the values are copied from theLvArray::CRSMatrixto theHypreMatrixthrough a call toHYPRE_IJMatrixAddToValues2.
This results in a 2x increase in matrix storage/allocation to run a specific problem . We need to implement a way to avoid this.
Solution
The solutions are varied, but they all essentially need to create a device callable interface around HYPRE_ParCSRMatrix, or an interface that performs a shallow copy of pointers containing data in HYPRE_ParCSRMatrix.
Option 1a: Shallow Copy. GEOS allocates new matrix type (LvArray::SplitSparsityPattern, LvArray::SplitCRSMatrix)
- Create the
LvArray::SparsityPatternas we are doing now. - Create a sparsity structure (
LvArray::SplitSparsityPattern) that reflects the DIAG/OFF_DIAG nature of theHYPRE_ParCSRMatrixand copy the data fromLvArray::SparsityPatterninto that. - Free
LvArray::SparsityPattern. - Create new matrix
LvArray::SplitCRSMatrix. - Fill
LvArray::SplitCRSMatrix - Shallow copy
LvArray::SplitCRSMatrixintoHYPRE_ParCSRMatrix.
Option 1b: Fill LvArray::SplitSparsityPattern
- Create a sparsity structure (
LvArray::SplitSparsityPattern) that reflects the DIAG/OFF_DIAG nature of theHYPRE_ParCSRMatrixand copy the data fromLvArray::SparsityPatterninto that. - Fill
LvArray::SplitSparsityPattern. - Create new matrix
LvArray::SplitCRSMatrix. - Fill
LvArray::SplitCRSMatrix - Shallow copy
LvArray::SplitCRSMatrixintoHYPRE_ParCSRMatrix.
Option 2a: Hypre allocates matrix
- Create the
LvArray::SparsityPatternas we are doing now. - Allocate
HYPRE_ParCSRMatrix. - Delete
LvArray::SparsityPattern - Create Wrapper around
HYPRE_ParCSRMatrixand fill.
Option 2b: Hypre allocates matrix, but in 2 steps
- Create the
LvArray::SparsityPatternas we are doing now. - Allocate sparsity components of
HYPRE_ParCSRMatrix - Delete
LvArray::SparsityPattern - Allocate
HYPRE_ParCSRMatrix. - Create Wrapper around
HYPRE_ParCSRMatrixand fill.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.