Skip to content

[Trilinos] Migration to new package stack meta-issue #189

@maxfirmbach

Description

@maxfirmbach

Description

This issue is for organizing and documenting progress of the migration from the old Epetra stack to the modern Tpetra stack. Specific tasks to be done are organized in issues with the respective label marking them. An overview of the progress can be found in Migration from Epetra to Tpetra.

Goals:

  • Migrate the entire linear algebra stack to Tpetra
  • Switch 4C's Trilinos dependencies to the Tpetra stack

Background

4C relies on Trilinos for the implementation of sparse linear algebra capabilities.
We currently use the Epetra stack, which will be phased-out from Trilinos by the end of 09/2025 (at the latest) -- and even right now, the Epetra stack is not actively developed anymore, so we cannot easily benefit from new features. Finally, Epetra is limited to MPI-only mode, so we cannot use on-node parallelism or accelerator devices (as they appear in more and more of todays computing clusters).

The modern Tpetra stack is the successor of Epetra. It is actively developed, it forms the basis for a modern solver stack in Trilinos, and comes with a hand-in-hand Kokkos integration for MPI+X parallelism.

The switch to Tpetra is mandatory, such that we can benefit from developments in Trilinos in the future.

The current strategy is to divide the transition into tree phases to ensure an orderly transition. The first phase includes preliminary steps in which the dependency on Epetra is reduced. If possible, the functionalities which still remains from Epetra are encapsulated by using wrappers.
In the second phase, the conversion of the sparse matrices will take place.
In the third and final phase, all remaining dependencies on Epetra that were not removed in the previous phases will be removed.

A presentation about packages, which will be archived can be found HERE (as presented at TUG 2023). Those include the following relevant packages for 4C:

  • Epetra / EpetraExt
  • Isorropia
  • Intrepid
  • Amesos
  • AztecOO
  • Ifpack
  • ML
  • NOX

In addition, Epetra code from all other packages will be removed.

Functionality is still ported from old to new solver stack till October 2024. If we use features from the old stack, which are not yet in the new one, there's still time to get them moved. After October 2024, the old solver stack out phasing will start till October 2025, to give stakeholders and users some final months for moving to the new stack. Afterwards all Epetra related code will be archived and thus won't be part of the repository anymore.

First Phase I

Before the actual migration to Tpetra can take place, some packages that support only Epetra have to be replaced by newer versions supporting both solver stacks. In addition this will be connected to heavy cleanup actions reducing complexity and thus simplifying the code paths taken in 4C.

Linear solver

  • Amesos2: Direct solver package. The direct solver package is quite regularly used for prototyping and problems using difficult physics. As a lot of tests depend on this, it's quite time consuming to replace everything related to Amesos. (see [Trilinos] Move direct solver from Amesos to Amesos2 #661)

  • Belos: Iterative solver package. The iterative linear solvers come into play for big problem sizes and are critical for performance running large parallel simulations. All the code already runs the new package, despite some parts in the partitioned fsi still depending on AztecOO, but mainly due to NOX. (see Remove instantiation of ::NOX::Epetra::LinearSystemAztecOO #1353)

  • Muelu: Multigrid preconditioner package. We use multigrid for all kinds of problem types as preconditioner either for single-fields or multi-fields, which means this is an integral part of the linear solvers in 4C. Thus we need to switch and remove the old multigrid package ML. The plan is to use template xml-files tailored to certain problem types, which other developers can just use for their own simulations.

In the current state optional, but maybe beneficial:

Nonlinear solver

Discretization

Linear Algebra Objects

Avoid the usage of Epetra in the physics modules by providing appropriate wrapper classes

Centralize calls to EpetraExt:

Framework

Start reducing Epetra dependent utilities with respective calls from Teuchos or remove Epetra dependency:

First Phase II

There will be some preparation necessary related to further cleanup to make things go through smoothly (see #764 #763). Everything Epetra related needs to be reduced as much as possible, such that we end up with a minimal set of occurrences that are actually relevant for the switch.

Further preparation steps necessary:

This is also a good point to get some side quests done, that are not directly related to the switch, but to usability and Trilinos in general:

Second Phase

After everything is ready to be able to work with Tpetra we can think about migrating the functionality from Epetra sparse linear algebra to Tpetra sparse linear algebra.

  • Discuss how to do the switch and integrate Tpetra: We decided to wrap the sparse linear algebra objects, remove utils functions as much as possible and try to move as many packages to the new ones by still depending on Epetra for now.

Linear solver

Call the respective linear solver with the relevant Tpetra objects.

Some packages only support either only Epetra or only Tpetra, we can only adapt them with the actual switch to Tpetra:

  • Ifpack2: Additive-Schwarz preconditioner package.

Discretization

We need to feed Zoltan2 with the relevant Tpetra objects, thus we need to call the respective adapters with Tpetra

  using GraphAdapter = Zoltan2::XpetraCrsGraphAdapter<Tpetra::CrsMatrix, Tpetra::MultiVector>;
  using VectorAdapter = Zoltan2::XpetraMultiVectorAdapter<Tpetra::MultiVector>;

Linear Algebra Objects

Replace the Epetra members from sparse algebra wrappers by Tpetra. An overview issue is given in #875.

  • Matrix:
    • Replace Epetra_CrsMatrix -> Tpetra::CrsMatrix
  • Vector:
    • Replace Epetra_Vector -> Tpetra::Vector
    • Replace Epetra_MultiVector -> Tpetra::MultiVector
  • Graph:
    • Replace Epetra_CrsGraph -> Tpetra::CrsGraph
  • Map:
    • Replace Epetra_Map -> Tpetra::Map
  • Misc:
    • Replace Epetra_Importer -> Tpetra::Importer and Epetra_Exporter -> Tpetra::Exporter

Replace the calls from EpetraExt by Tpetra:

  • Replace EpetraExt::MatrixMatrix::Multiply -> Tpetra::MatrixMatrix::Multiply
  • Replace EpetraExt::MatrixMatrix::Add -> Tpetra::MatrixMatrix::Add
  • Replace EpetraExt::RowMatrix_Transpose -> Tpetra::RowMatrixTransposer

Framework

We need to replace as_epetra_comm() with a call to as_teuchos_comm() as Tpetra works with the communicator objects from Teuchos.

Third Phase

TBD

Quick links

How to participate?

If you want to participate in this effort (even temporarily), please assign yourself to this meta-issue, so that we have an overview of possible contributors. Every helping hand is very welcome!

Metadata

Metadata

Labels

taskforce: 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