Skip to content

[LinAlg] Static sparsity layout for sparse matricesΒ #1544

@maxfirmbach

Description

@maxfirmbach

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 for insert_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_complete called 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 StaticProfile option in the Epetra_CrsMatrix constructor to true in all places.
  • Run a complete ctest routine 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    strategically relevantissues and pull requests that are strategically relevant for the future of the projecttaskforce: tpetraIssues related to the migration from Epetra to Tpetratype: enhancementA new feature or enhancement to be implemented

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions