-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Description
Currently the sparsity pattern used for our sparse matrix implementation with Epetra_CrsMatrix can be changed dynamically by setting the option StaticProfile = false. The effects are the following: we specify an approximate upper bound as number of non-zeros per row. This number is not a "hard" bound it can be considered as a hint. Afterwards we are still able to add more values in a row if necessary. Usually this will still throw a warning, if overused (e.g. one can specify zero nnz per row and we would still be able to insert values).
There are some drawbacks to this however:
- I would like to have a hard assert for warnings and errors from
Epetra, which currently fails forinsert_into_global_values()as we on a regular basis insert values without having the allocation ready, resulting in a lot of re-allocation during value insertion. - The mechanism of
un_completecalled on a matrix does not help. We pre-allocate the memory and complete, but afterwards modify everything again and usually insert more values than allocated.
=> Violating allocation limits and dynamically changing memory slows down operations.
It makes sense to be cautious about when and where to allocate memory for a sparse matrix. Now to the main topic though. In Tpetra dynamic memory allocation is deprecated for matrices (mainly due to GPU computing). Therefore we need to switch to a static memory profile StaticProfile = true for our matrix implementation to make a later transition to Tpetra as smooth as possible.
I assume this will be a lot of work and code will break in several places.
Possible Solution and Definition of Done
- Turn the
StaticProfileoption in theEpetra_CrsMatrixconstructor totruein all places. - Run a complete
ctestroutine and document the failing tests. - Get all tests running again by either reworking how many entries are pre-allocated for a specific matrix and/or search for a upper bound.