Redefine LAI set/insert/add interface functions...or delete them entirely
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 287
- Forks
- 109
- Avg merge
- 4d 41m
- Merged PRs (30d)
- 5
Description
Describe the issue
The LAI objects have set/insert/add interface functions that take values, pointers, and arrayslice. This either requires the interface function to copy the data and move it to the correct memory space, or it requires the caller to manage the memory motion rather than allowing the interface functions to manage the memory motion as part of their responsibility. For example, MatrixBase contains the following interface functions:
virtual void add( globalIndex const rowIndex,
globalIndex const colIndex,
real64 const value ) = 0;
virtual void set( globalIndex const rowIndex,
globalIndex const colIndex,
real64 const value ) = 0;
virtual void insert( globalIndex const rowIndex,
globalIndex const colIndex,
real64 const value ) = 0;
These are single point interface functions. They are very inefficient, and require that the interface function copy the data, then move it to the correct memory space. These should be removed.
virtual void add( globalIndex const rowIndex,
globalIndex const * colIndices,
real64 const * values,
localIndex const size ) = 0;
virtual void set( globalIndex const rowIndex,
globalIndex const * colIndices,
real64 const * values,
localIndex const size ) = 0;
virtual void insert( globalIndex const rowIndex,
globalIndex const * colIndices,
real64 const * values,
localIndex const size ) = 0;
virtual void add( globalIndex const rowIndex,
arraySlice1d< globalIndex const > const & colIndices,
arraySlice1d< real64 const > const & values ) = 0;
virtual void set( globalIndex const rowIndex,
arraySlice1d< globalIndex const > const & colIndices,
arraySlice1d< real64 const > const & values ) = 0;
virtual void insert( globalIndex const rowIndex,
arraySlice1d< globalIndex const > const & colIndices,
arraySlice1d< real64 const > const & values ) = 0;
These are data insertions for a single row. Pointers/arraySlice make this interface hard to manage memory motion.
virtual void add( arraySlice1d< globalIndex const > const & rowIndices,
arraySlice1d< globalIndex const > const & colIndices,
arraySlice2d< real64 const > const & values ) override;
virtual void set( arraySlice1d< globalIndex const > const & rowIndices,
arraySlice1d< globalIndex const > const & colIndices,
arraySlice2d< real64 const > const & values ) override;
virtual void insert( arraySlice1d< globalIndex const > const & rowIndices,
arraySlice1d< globalIndex const > const & colIndices,
arraySlice2d< real64 const > const & values ) override;
virtual void add( globalIndex const * rowIndices,
globalIndex const * colIndices,
real64 const * values,
localIndex const numRows,
localIndex const numCols ) override;
virtual void set( globalIndex const * rowIndices,
globalIndex const * colIndices,
real64 const * values,
localIndex const numRows,
localIndex const numCols ) override;
virtual void insert( globalIndex const * rowIndices,
globalIndex const * colIndices,
real64 const * values,
localIndex const numRows,
localIndex const numCols ) override;
Dense data insertions. These are not as bad since they should be launched inside a kernel...but they are not __device__ callable.
Proposed cleanup
Remove all of these functions. We should just be using CRSMatrix objects and creating these objects from CRSMatrix. We can then focus on getting a shallow copy from CRSMatrix to the derived classes of MatrixBase.
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.