Amesos Development
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Amesos_Mumps Class Reference

Amesos_Mumps: An object-oriented wrapper for the double precision version of MUMPS. More...

#include <Amesos_Mumps.h>

Inheritance diagram for Amesos_Mumps:
Inheritance graph
[legend]
Collaboration diagram for Amesos_Mumps:
Collaboration graph
[legend]

Public Member Functions

 Amesos_Mumps (const Epetra_LinearProblem &LinearProblem)
 Amesos_Mumps Constructor.
 
 ~Amesos_Mumps (void)
 Amesos_Mumps Destructor.
 
int SymbolicFactorization ()
 Performs SymbolicFactorization on the matrix A.
 
int NumericFactorization ()
 Performs NumericFactorization on the matrix A.
 
int Solve ()
 Solves A X = B (or AT x = B)
 
void Destroy ()
 Destroys all data associated with \sl this object.
 
int SetUseTranspose (bool UseTranspose_in)
 If set true, X will be set to the solution of AT X = B (not A X = B)
 
bool UseTranspose () const
 Returns the current UseTranspose setting.
 
int SetParameters (Teuchos::ParameterList &ParameterList)
 Updates internal variables.
 
int NumSymbolicFact () const
 Returns the number of symbolic factorizations performed by this object.
 
int NumNumericFact () const
 Returns the number of numeric factorizations performed by this object.
 
int NumSolve () const
 Returns the number of solves performed by this object.
 
void PrintTiming () const
 Prints timing information.
 
void PrintStatus () const
 Prints information about the factorization and solution phases.
 
void GetTiming (Teuchos::ParameterList &TimingParameterList) const
 Extracts timing information from the current solver and places it in the parameter list.
 
int SetPrecscaling (double *ColSca, double *RowSca)
 Set prescaling.
 
int SetRowScaling (double *RowSca)
 Set row scaling.
 
int SetColScaling (double *ColSca)
 Set column scaling.
 
int SetOrdering (int *PermIn)
 Sets ordering.
 
double * GetRINFO ()
 Gets the pointer to the RINFO array (defined on all processes).
 
int * GetINFO ()
 Gets the pointer to the INFO array (defined on all processes).
 
double * GetRINFOG ()
 Gets the pointer to the RINFOG array (defined on host only).
 
int * GetINFOG ()
 Get the pointer to the INFOG array (defined on host only).
 
void SetICNTL (int pos, int value)
 Set ICNTL[pos] to value. pos is expressed in FORTRAN style (starting from 1).
 
void SetCNTL (int pos, double value)
 Set CNTL[pos] to value. pos is expressed in FORTRAN style (starting from 1).
 
bool MatrixShapeOK () const
 Returns true if the solver can handle this matrix shape.
 
const Epetra_Comm & Comm () const
 Returns a pointer to the Epetra_Comm communicator associated with this matrix.
 
const Epetra_LinearProblem * GetProblem () const
 Gets a pointer to the Epetra_LinearProblem.
 
- Public Member Functions inherited from Amesos_BaseSolver
virtual ~Amesos_BaseSolver ()
 Destructor.
 
virtual int SymbolicFactorization ()=0
 Performs SymbolicFactorization on the matrix A.
 
virtual int NumericFactorization ()=0
 Performs NumericFactorization on the matrix A.
 
virtual int Solve ()=0
 Solves A X = B (or AT x = B)
 
virtual int SetUseTranspose (bool UseTranspose)=0
 If set true, X will be set to the solution of AT X = B (not A X = B)
 
virtual bool UseTranspose () const =0
 Returns the current UseTranspose setting.
 
virtual int SetParameters (Teuchos::ParameterList &ParameterList)=0
 Updates internal variables.
 
virtual const Epetra_LinearProblem * GetProblem () const =0
 Returns the Epetra_LinearProblem.
 
virtual bool MatrixShapeOK () const =0
 Returns true if the solver can handle this matrix shape.
 
virtual const Epetra_Comm & Comm () const =0
 Returns a pointer to the Epetra_Comm communicator associated with this operator.
 
virtual int NumSymbolicFact () const =0
 Returns the number of symbolic factorizations performed by this object.
 
virtual int NumNumericFact () const =0
 Returns the number of numeric factorizations performed by this object.
 
virtual int NumSolve () const =0
 Returns the number of solves performed by this object.
 
virtual void PrintStatus () const =0
 Prints status information about the current solver.
 
virtual void PrintTiming () const =0
 Prints timing information about the current solver.
 
virtual void setParameterList (Teuchos::RCP< Teuchos::ParameterList > const &paramList)
 Redefined from Teuchos::ParameterListAcceptor (Does Not Work)
 
virtual Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList ()
 This is an empty stub.
 
virtual Teuchos::RCP< Teuchos::ParameterList > unsetParameterList ()
 This is an empty stub.
 
virtual void GetTiming (Teuchos::ParameterList &TimingParameterList) const
 Extracts timing information from the current solver and places it in the parameter list. (Does Not Work)
 

Protected Member Functions

Epetra_RowMatrix & Matrix ()
 Returns a reference to the linear system matrix.
 
const Epetra_RowMatrix & Matrix () const
 
Epetra_Map & RedistrMap ()
 Returns a reference to the map for redistributed matrix.
 
Epetra_Import & RedistrImporter ()
 Returns a reference for the redistributed importer.
 
Epetra_RowMatrix & RedistrMatrix (const bool ImportMatrix=false)
 Returns a reference to the redistributed matrix, imports it is ImportMatrix is true.
 
Epetra_Map & SerialMap ()
 Returns a reference to the map with all elements on process 0.
 
Epetra_Import & SerialImporter ()
 Returns a reference to the importer for SerialMap().
 
int ConvertToTriplet (const bool OnlyValues)
 Converts to MUMPS format (COO format).
 
int CheckError ()
 Checks for MUMPS error, prints them if any. See MUMPS' manual.
 
void CheckParameters ()
 Check input parameters.
 
void SetICNTLandCNTL ()
 

Protected Attributes

bool IsConvertToTripletOK_
 true if matrix has already been converted to COO format
 
bool IsComputeSchurComplementOK_
 true if the Schur complement has been computed (need to free memory)
 
bool NoDestroy_
 
std::vector< int > Row
 row indices of nonzero elements
 
std::vector< int > Col
 column indices of nonzero elements
 
std::vector< double > Val
 values of nonzero elements
 
int MaxProcs_
 Maximum number of processors in the MUMPS' communicator.
 
bool UseTranspose_
 If true, solve the problem with AT.
 
int MtxConvTime_
 Quick access pointers to the internal timers.
 
int MtxRedistTime_
 
int VecRedistTime_
 
int SymFactTime_
 
int NumFactTime_
 
int SolveTime_
 
double * RowSca_
 Row and column scaling.
 
double * ColSca_
 
int * PermIn_
 PermIn for MUMPS.
 
int NumSchurComplementRows_
 Number of rows in the Schur complement (if required)
 
int * SchurComplementRows_
 Rows for the Schur complement (if required)
 
RCP< Epetra_CrsMatrix > CrsSchurComplement_
 Pointer to the Schur complement, as CrsMatrix.
 
RCP< Epetra_SerialDenseMatrix > DenseSchurComplement_
 Pointer to the Schur complement,as DenseMatrix.
 
const Epetra_LinearProblem * Problem_
 Pointer to the linear problem to be solved.
 
RCP< Epetra_Map > RedistrMap_
 Redistributed matrix.
 
RCP< Epetra_Import > RedistrImporter_
 Redistributed importer (from Matrix().RowMatrixRowMap() to RedistrMatrix().RowMatrixRowMap()).
 
RCP< Epetra_CrsMatrix > RedistrMatrix_
 Redistributed matrix (only if MaxProcs_ > 1).
 
RCP< Epetra_Map > SerialMap_
 Map with all elements on process 0 (for solution and rhs).
 
RCP< Epetra_Import > SerialImporter_
 Importer from Matrix.OperatorDomainMap() to SerialMap_.
 
DMUMPS_STRUC_C MDS
 
std::map< int, int > ICNTL
 
std::map< int, double > CNTL
 

Detailed Description

Amesos_Mumps: An object-oriented wrapper for the double precision version of MUMPS.

Amesos_Mumps is an interface to the the double precision version of the sparse parallel direct solver MUMPS. Given an Epetra_RowMatrix A, and two Epetra_MultiVectors X and B, the solution with Amesos_Mumps reads as follows:

  1. Epetra_LinearProblem Problem; Amesos_BaseSolver * Solver; Amesos Amesos_Factory;
  2. Solver = Amesos_Factory.Create("Amesos_Mumps", Problem);
  3. if( Solver == 0 ) std::cerr << "library not available" << std::endl;
  4. Problem.SetMatrix(&A);
  5. Solver->SymbolicFactorization();
  6. Solver->NumericFactorization();
  7. Problem.SetLHS(&X);
  8. Problem.SetLHS(&B);
  9. Solver->Solve();

A number of parameters is available to tune the performances of MUMPS. We refer to the Amesos Reference Guide for a detailed overview of these parameters. Here, we just recall that it is possible to solve the linear system on a subset of the processes contained in the Comm object of the Epetra_LinearProblem.

Amesos_Mumps accepts any Epetra_RowMatrix derived class. However, special functions are available for Epetra_CrsMatrix and Epetra_VbrMatrix objects.

As Amesos is based on Epetra, and Epetra is only double-precision, we still require an Epetra_LinearProblem composed by a double-precision matrix, and two double-precision vectors. The solution vector is casted to double after solution. Single precision may be of interest if Amesos is used with ML, to solve the coarse problem (for which single-precision can be enough in term of numerical error, and usually save memory and CPU time).

Amesos_Mumps is based on Amesos_EpetraBaseSolver, that is derived from Amesos_BaseSolver. The main redistribution utilities, as well as a getrow function, is obtained by EpetraBaseSolver.

Warning
This interface is compatible with MUMPS 4.5.4.
Date
Last modified 26-Jan-06
Author
Marzio Sala, ETHZ.

Constructor & Destructor Documentation

◆ Amesos_Mumps()

Amesos_Mumps::Amesos_Mumps ( const Epetra_LinearProblem &  LinearProblem)

Amesos_Mumps Constructor.

Creates an Amesos_Mumps instance, using an Epetra_LinearProblem,

References SetParameters().

◆ ~Amesos_Mumps()

Amesos_Mumps::~Amesos_Mumps ( void  )

Amesos_Mumps Destructor.

Deletes an Amesos_Mumps object.

References Destroy().

Member Function Documentation

◆ Comm()

const Epetra_Comm & Amesos_Mumps::Comm ( ) const
inlinevirtual

Returns a pointer to the Epetra_Comm communicator associated with this matrix.

Implements Amesos_BaseSolver.

References Comm(), and GetProblem().

Referenced by CheckError(), CheckParameters(), Comm(), ConvertToTriplet(), Destroy(), NumericFactorization(), PrintStatus(), PrintTiming(), RedistrImporter(), RedistrMap(), RedistrMatrix(), SerialMap(), Solve(), and SymbolicFactorization().

◆ GetINFO()

int * Amesos_Mumps::GetINFO ( )

Gets the pointer to the INFO array (defined on all processes).

Gets the pointer to the internally stored INFO array, of type int.

◆ GetINFOG()

int * Amesos_Mumps::GetINFOG ( )

Get the pointer to the INFOG array (defined on host only).

Gets the pointer to the internally stored INFOG (defined on the host process only) array, of type int.

◆ GetProblem()

const Epetra_LinearProblem * Amesos_Mumps::GetProblem ( ) const
inlinevirtual

Gets a pointer to the Epetra_LinearProblem.

Implements Amesos_BaseSolver.

References Problem_.

Referenced by Comm(), and MatrixShapeOK().

◆ GetRINFO()

double * Amesos_Mumps::GetRINFO ( )

Gets the pointer to the RINFO array (defined on all processes).

Gets the pointer to the internally stored RINFO array, of type float if option --enable-amesos-smumps is enabled, double otherwise.

◆ GetRINFOG()

double * Amesos_Mumps::GetRINFOG ( )

Gets the pointer to the RINFOG array (defined on host only).

Gets the pointer to the internally stored RINFOG array (defined on the host process only), of type float if option –enable-amesos-smumps is enabled, double otherwise.

◆ GetTiming()

void Amesos_Mumps::GetTiming ( Teuchos::ParameterList &  TimingParameterList) const
inlinevirtual

Extracts timing information from the current solver and places it in the parameter list.

Reimplemented from Amesos_BaseSolver.

References Amesos_Time::GetTiming().

◆ MatrixShapeOK()

bool Amesos_Mumps::MatrixShapeOK ( ) const
inlinevirtual

Returns true if the solver can handle this matrix shape.

Returns true if the matrix shape is one that the underlying sparse direct solver can handle. Classes that work only on square matrices should return false for rectangular matrices. Classes that work only on symmetric matrices whould return false for non-symmetric matrices.

Implements Amesos_BaseSolver.

References GetProblem().

◆ NumericFactorization()

int Amesos_Mumps::NumericFactorization ( )
virtual

Performs NumericFactorization on the matrix A.

In addition to performing numeric factorization on the matrix A, the call to NumericFactorization() implies that no change will be made to the underlying matrix without a subsequent call to NumericFactorization().

<br >Preconditions:

  • GetProblem().GetOperator() != 0 (return -1)
  • MatrixShapeOk(GetProblem().GetOperator()) == true (return -6)
  • The non-zero structure of the matrix should not have changed since the last call to SymbolicFactorization().
    (return -2 if the number of non-zeros changes) Other changes can have arbitrary consequences.
  • The distribution of the matrix should not have changed since the last call to SymbolicFactorization()
  • The matrix should be indexed from 0 to n-1, unless the parameter "Reindex" was set to "true" prior to the call to SymbolicFactorization().
    (return -3 - if caught)
  • The paremeter "Reindex" should not be set to "true" except on CrsMatrices. (return -4)
  • The paremeter "Reindex" should not be set to "true" unless Amesos was built with EpetraExt, i.e. with –enable-epetraext on the configure line. (return -4)
  • Internal errors retur -5.

<br >Postconditions:

  • Numeric Factorization will be performed (or marked to be performed) allowing Solve() to be performed correctly despite a potential change in in the matrix values (though not in the non-zero structure).
Returns
Integer error code, set to 0 if successful.

Implements Amesos_BaseSolver.

References Amesos_Time::AddTime(), CheckError(), Comm(), ConvertToTriplet(), Amesos_Status::IsNumericFactorizationOK_, Amesos_Status::IsSymbolicFactorizationOK_, MaxProcs_, Amesos_Status::NumNumericFact_, RedistrMatrix(), Amesos_Time::ResetTimer(), SymbolicFactorization(), and Val.

Referenced by Solve().

◆ NumNumericFact()

int Amesos_Mumps::NumNumericFact ( ) const
inlinevirtual

Returns the number of numeric factorizations performed by this object.

Implements Amesos_BaseSolver.

References Amesos_Status::NumNumericFact_.

◆ NumSolve()

int Amesos_Mumps::NumSolve ( ) const
inlinevirtual

Returns the number of solves performed by this object.

Implements Amesos_BaseSolver.

References Amesos_Status::NumSolve_.

◆ NumSymbolicFact()

int Amesos_Mumps::NumSymbolicFact ( ) const
inlinevirtual

Returns the number of symbolic factorizations performed by this object.

Implements Amesos_BaseSolver.

References Amesos_Status::NumSymbolicFact_.

◆ PrintStatus()

void Amesos_Mumps::PrintStatus ( ) const
virtual

Prints information about the factorization and solution phases.

In the destruction phase, prints out some information furnished by MUMPS, like the amount of required memory, the MFLOPS.

Implements Amesos_BaseSolver.

References Comm(), Matrix(), Amesos_Control::MatrixProperty_, MaxProcs_, Amesos_Utils::PrintLine(), and UseTranspose_.

Referenced by Destroy().

◆ PrintTiming()

void Amesos_Mumps::PrintTiming ( ) const
virtual

Prints timing information.

In the destruction phase, prints out detailed information about the various phases: symbolic and numeric factorization, solution, gather/scatter for vectors and matrices.

Implements Amesos_BaseSolver.

References Comm(), Amesos_Time::GetTime(), MtxConvTime_, Amesos_Status::NumNumericFact_, Amesos_Status::NumSolve_, Amesos_Status::NumSymbolicFact_, Amesos_Utils::PrintLine(), and Problem_.

Referenced by Destroy().

◆ SetColScaling()

int Amesos_Mumps::SetColScaling ( double *  ColSca)
inline

Set column scaling.

Use double precision vectors of size N (global dimension of the matrix) for column scaling.

Parameters
ColSca(In) - float pointer with –enable-amesos-smumps, double pointer otherwise.

Referenced by SetParameters().

◆ SetOrdering()

int Amesos_Mumps::SetOrdering ( int *  PermIn)
inline

Sets ordering.

Use integer vectors of size N (global dimension of the matrix) as given ordering. PermIn must be defined on the host only, and allocated by the user, if the user sets ICNTL(7) = 1.

References PermIn_.

Referenced by SetParameters().

◆ SetParameters()

int Amesos_Mumps::SetParameters ( Teuchos::ParameterList &  ParameterList)
virtual

Updates internal variables.

  <br \>Preconditions:<ul>
  <li>None.</li>
  </ul>

  <br \>Postconditions:<ul> 
  <li>Internal variables controlling the factorization and solve will
  be updated and take effect on all subseuent calls to NumericFactorization() 
  and Solve().</li>
  <li>All parameters whose value are to differ from the default values must 

be included in ParameterList. Parameters not specified in ParameterList revert to their default values.

Returns
Integer error code, set to 0 if successful.

Implements Amesos_BaseSolver.

References SetCNTL(), SetColScaling(), SetICNTL(), SetOrdering(), and SetRowScaling().

Referenced by Amesos_Mumps().

◆ SetPrecscaling()

int Amesos_Mumps::SetPrecscaling ( double *  ColSca,
double *  RowSca 
)
inline

Set prescaling.

Use double precision vectors of size N (global dimension of the matrix) as scaling for columns and rows. ColSca and RowSca must be defined on the host only, and allocated by the user, if the user sets ICNTL(8) = -1.

Both input vectors are float with –enable-amesos-smumps, double otherwise.

References RowSca_.

◆ SetRowScaling()

int Amesos_Mumps::SetRowScaling ( double *  RowSca)
inline

Set row scaling.

Use double precision vectors of size N (global dimension of the matrix) for row scaling.

Parameters
RowSca(In) -float pointer with –enable-amesos-smumps, double pointer otherwise.

References RowSca_.

Referenced by SetParameters().

◆ SetUseTranspose()

int Amesos_Mumps::SetUseTranspose ( bool  UseTranspose)
inlinevirtual

If set true, X will be set to the solution of AT X = B (not A X = B)

If the implementation of this interface does not support transpose use, this method should return a value of -1.

<br >Preconditions:

<br >Postconditions:

  • The next factorization and solve will be performed with the new value of UseTranspose.
Parameters
UseTranspose– (In) If true, solve AT X = B, otherwise solve A X = B.
Returns
Integer error code, set to 0 if successful. Set to -1 if this implementation does not support transpose.

Implements Amesos_BaseSolver.

References UseTranspose_.

◆ Solve()

int Amesos_Mumps::Solve ( )
virtual

Solves A X = B (or AT x = B)

<br >Preconditions:

<br >Postconditions:

  • X will be set such that A X = B (or AT X = B), within the limits of the accuracy of the underlying solver.
Returns
Integer error code, set to 0 if successful.

Implements Amesos_BaseSolver.

References Amesos_Time::AddTime(), CheckError(), Comm(), Amesos_Utils::ComputeTrueResidual(), Amesos_Status::ComputeTrueResidual_, Amesos_Utils::ComputeVectorNorms(), Amesos_Status::ComputeVectorNorms_, Amesos_Status::IsNumericFactorizationOK_, Matrix(), MaxProcs_, NumericFactorization(), Amesos_Status::NumSolve_, Problem_, Amesos_Time::ResetTimer(), SerialImporter(), SerialMap(), and UseTranspose().

◆ SymbolicFactorization()

int Amesos_Mumps::SymbolicFactorization ( )
virtual

Performs SymbolicFactorization on the matrix A.

In addition to performing symbolic factorization on the matrix A, the call to SymbolicFactorization() implies that no change will be made to the non-zero structure of the underlying matrix without a subsequent call to SymbolicFactorization().

<br >Preconditions:

<br >Postconditions:

Returns
Integer error code, set to 0 if successful.

Implements Amesos_BaseSolver.

References Amesos_Time::AddTime(), CheckError(), CheckParameters(), Col, Comm(), ConvertToTriplet(), Amesos_Time::CreateTimer(), Destroy(), Amesos_Status::IsNumericFactorizationOK_, Amesos_Status::IsSymbolicFactorizationOK_, Matrix(), MaxProcs_, Amesos_Status::NumSymbolicFact_, PermIn_, RedistrMatrix(), Amesos_Time::ResetTimer(), Row, and RowSca_.

Referenced by NumericFactorization().

◆ UseTranspose()

bool Amesos_Mumps::UseTranspose ( ) const
inlinevirtual

Returns the current UseTranspose setting.

Implements Amesos_BaseSolver.

References UseTranspose_.

Referenced by Solve().


The documentation for this class was generated from the following files: