A Quick Introduction to Amesos

Marzio Sala

Use left and right arrows to move through the presentation, and when you are finished click "Page Back" to go back to the previous page. The Amesos web page is here.

What We Will Do Here

This is a very quick introduction to the usage of Amesos. We will show the basic commands that are required to solve a linear system. The presentation is organized as follows:
  1. Phase 0: Definition of the (distributed) linear algebra objects;
  2. Phase 1: Initializing Amesos;
  3. Phase 2: Initializing the Factory;
  4. Phase 3: Performing the factorization;
  5. Phase 4: Solving the linear system.

Phase 0: Linear Algebra Objects

We suppose that:

Phase 0: Linear Algebra Objects (cont'd)

This means that your code contains something like:
Epetra_RowMatrix* A; 
Epetra_MultiVector* LHS;
Epetra_MultiVector* RHS;
Epetra_LinearProblem Problem(A, LHS, RHS);
We will not show here how to define A, LHS and RHS; check the Trilinos tutorial if you need help on this subject. We also suppose that your code includes the basic Amesos header file:
#include "Amesos.h"

Phase 1: Initializing Amesos

First, you have to initialize the Amesos solver. This is done by declaring a pointer to an Amesos_BaseSolver object:
Amesos_BaseSolver* Solver;
Note that Amesos_BaseSolver is a pure virtual class.

Phase 2: Initializing the Factory

  1. You initialize the Factory, which is a function class (a class that contains methods only, no data):
    Amesos Factory;
    
  2. You specify the solver you want to use:
    string SolverType = "Klu";
    
  3. and finally you can declare your Solver:
    Solver = Factory.Create(SolverType, Problem);
    
    if (Solver == 0) {
        cerr << "Specified solver is not available" << endl;
    }
    

Phase 2: Initializing the Factory (cont'd)

Possible choices for SolverType are:

Only the LAPACK and KLU interfaces are enabled by default. KLU and Paraklete are distributed within Amesos; all the other solvers must be downloaded and installed before configuring Amesos.

Phase 3: Perform the Factorization

Phase 4: Solve the Linear System

Solving simply requires
Solver->Solve();
and nothing more! To test another solver, simply pass a different SolverType to the Factory. Certain phases can be customized using a parameter list. For example, for verbose output, do this before calling SymbolicFactorization:
Teuchos::ParameterList List;
List.set("PrintTiming", true);
List.set("PrintStatus", true);
Solver->SetParameters(List);

End of the show!

This was a rapid overview of Amesos. Please check the web pages, the examples contained in the distribution, and the manuals for more details. Feel free to contact the developers if you need help!