Amesos2 - Direct Sparse Solver Interfaces
Version of the Day
|
Amesos2 interface to STRUMPACK direct solver and preconditioner. More...
#include <Amesos2_STRUMPACK_decl.hpp>
Public Types | |
typedef STRUMPACK< Matrix, Vector > | type |
typedef SolverCore < Amesos2::STRUMPACK, Matrix, Vector > | strum_type |
typedef Matrix | matrix_type |
typedef Vector | vector_type |
typedef strum_type::scalar_type | scalar_type |
typedef strum_type::local_ordinal_type | local_ordinal_type |
typedef strum_type::global_ordinal_type | global_ordinal_type |
typedef strum_type::global_size_type | global_size_type |
typedef strum_type::node_type | node_type |
typedef Kokkos::DefaultHostExecutionSpace | HostExecSpaceType |
typedef Kokkos::View < global_ordinal_type *, HostExecSpaceType > | host_ordinal_type_array |
typedef Kokkos::View < scalar_type *, HostExecSpaceType > | host_value_type_array |
typedef Solver< Matrix, Vector > | super_type |
typedef ConcreteSolver< Matrix, Vector > | solver_type |
Public Member Functions | |
bool | matrixShapeOK () override |
Returns true if the solver can handle this matrix shape. More... | |
void | setA (const Teuchos::RCP< const Matrix > a, EPhase keep_phase=CLEAN) override |
Sets the matrix A of this solver. More... | |
void | setA (const Matrix *a, EPhase keep_phase=CLEAN) override |
Sets the matrix A of this solver. More... | |
void | setX (const Teuchos::RCP< Vector > x) override |
Sets the LHS vector X. | |
void | setX (Vector *x) override |
Sets the LHS vector X using a raw pointer. | |
const Teuchos::RCP< Vector > | getX () override |
Returns the vector that is the LHS of the linear system. | |
Vector * | getXRaw () override |
Returns a raw pointer to the LHS of the linear system. | |
void | setB (const Teuchos::RCP< const Vector > b) override |
Sets the RHS vector B. | |
void | setB (const Vector *b) override |
Sets the RHS vector B using a raw pointer. | |
const Teuchos::RCP< const Vector > | getB () override |
Returns the vector that is the RHS of the linear system. | |
const Vector * | getBRaw () override |
Returns a raw pointer to the RHS of the linear system. | |
std::string | description () const override |
Returns a short description of this Solver. | |
void | describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const override |
void | printTiming (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const override |
Prints timing information about the current solver. More... | |
void | getTiming (Teuchos::ParameterList &timingParameterList) const override |
Extracts timing information from the current solver. More... | |
std::string | name () const override |
Return the name of this solver. More... | |
Constructor/Destructor methods | |
STRUMPACK (Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B) | |
Initialize from Teuchos::RCP. More... | |
~STRUMPACK () | |
Destructor. | |
Mathematical functions | |
super_type & | preOrdering () override |
Pre-orders the matrix A for minimal fill-in. More... | |
super_type & | symbolicFactorization () override |
Performs symbolic factorization on the matrix A. More... | |
super_type & | numericFactorization () override |
Performs numeric factorization on the matrix A. More... | |
void | solve () override |
Solves (or ) More... | |
void | solve (const Teuchos::Ptr< Vector > X, const Teuchos::Ptr< const Vector > B) const override |
Solve using the given X and B vectors. More... | |
void | solve (Vector *X, const Vector *B) const override |
Solve using the given X and B vectors. More... | |
int | solve_ir (const Teuchos::Ptr< Vector > X, const Teuchos::Ptr< const Vector > B, const int maxNumIters, const bool verbose) const |
int | solve_ir (Vector *X, const Vector *B, const int maxNumIters, const bool verbose) const |
int | solve_ir (const int maxNumIters, const bool verbose) |
Parameter methods | |
super_type & | setParameters (const Teuchos::RCP< Teuchos::ParameterList > ¶meterList) override |
Set/update internal variables and solver options. More... | |
Teuchos::RCP< const Teuchos::ParameterList > | getValidParameters () const override |
Return a const parameter list of all of the valid parameters that this->setParameterList(...) will accept. More... | |
void | setParameterList (const Teuchos::RCP< Teuchos::ParameterList > ¶meterList) |
Set or update internal variables and solver options. More... | |
Teuchos::RCP < Teuchos::ParameterList > | getNonconstParameterList () |
This is a empty stub. More... | |
Teuchos::RCP < Teuchos::ParameterList > | unsetParameterList () |
This is an empty stub. More... | |
Accessor methods | |
Teuchos::RCP< const Teuchos::Comm< int > > | getComm () const override |
Returns a pointer to the Teuchos::Comm communicator with this operator. | |
Status & | getStatus () const override |
Returns a reference to this solver's internal status object. | |
Static Public Attributes | |
static const char * | name = "STRUMPACK" |
Name of this solver interface. | |
Protected Member Functions | |
void | setNnzLU (size_t nnz) |
Set the number of non-zero values in the and factors. More... | |
Protected Attributes | |
Teuchos::RCP< const MatrixAdapter< Matrix > > | matrixA_ |
The LHS operator. | |
bool | matrix_loaded_ |
Teuchos::RCP< Vector > | multiVecX_ |
The LHS vector/multi-vector. | |
Teuchos::RCP< const Vector > | multiVecB_ |
The RHS vector/multi-vector. More... | |
global_size_type | globalNumRows_ |
Number of global rows in matrixA_ . | |
global_size_type | globalNumCols_ |
Number of global columns in matrixA_ . | |
global_size_type | globalNumNonZeros_ |
Number of global non-zero values in matrixA_ . | |
global_size_type | rowIndexBase_ |
Index base of rowmap of matrixA_ . | |
global_size_type | columnIndexBase_ |
Index base of column map of matrixA_ . | |
Status | status_ |
Holds status information about a solver. | |
Control | control_ |
Parameters for solving. | |
Timers | timers_ |
Various timing statistics. | |
int | rank_ |
The MPI rank of this image. | |
bool | root_ |
If true , then this is the root processor. | |
int | nprocs_ |
Number of process images in the matrix communicator. | |
Private Member Functions | |
int | preOrdering_impl () |
Performs pre-ordering on the matrix to increase efficiency. More... | |
int | symbolicFactorization_impl () |
Perform symbolic factorization of the matrix using STRUMPACK. More... | |
int | numericFactorization_impl () |
STRUMPACK specific numeric factorization. More... | |
int | solve_impl (const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const |
STRUMPACK specific solve. More... | |
bool | matrixShapeOK_impl () const |
Determines whether the shape of the matrix is OK for this solver. More... | |
void | setParameters_impl (const Teuchos::RCP< Teuchos::ParameterList > ¶meterList) |
Teuchos::RCP< const Teuchos::ParameterList > | getValidParameters_impl () const |
bool | loadA_impl (EPhase current_phase) |
Reads matrix data into internal solver structures. More... | |
Private Attributes | |
Teuchos::RCP < strumpack::StrumpackSparseSolver < scalar_type, global_ordinal_type > > | sp_ |
host_value_type_array | nzvals_view_ |
Stores the values of the nonzero entries for STRUMPACK. | |
host_ordinal_type_array | colind_view_ |
Stores the row indices of the nonzero entries. | |
host_ordinal_type_array | rowptr_view_ |
Stores the location in Ai_ and Aval_ that starts row j. | |
Teuchos::Array< scalar_type > | bvals_ |
Teuchos::Array< scalar_type > | xvals_ |
Friends | |
class | SolverCore< Amesos2::STRUMPACK, Matrix, Vector > |
Amesos2 interface to STRUMPACK direct solver and preconditioner.
Currently support is for the STRUMPACK 2.1.0 version.
Amesos2::STRUMPACK< Matrix, Vector >::STRUMPACK | ( | Teuchos::RCP< const Matrix > | A, |
Teuchos::RCP< Vector > | X, | ||
Teuchos::RCP< const Vector > | B | ||
) |
Initialize from Teuchos::RCP.
References Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::control_, Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::getComm(), Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::getValidParameters(), Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::globalNumRows_, Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::matrixA_, Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::root_, and Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::setParameters().
|
private |
Performs pre-ordering on the matrix to increase efficiency.
STRUMPACK supports several forms of column permutations. TODO document different ordering?
|
private |
|
private |
|
private |
|
private |
Determines whether the shape of the matrix is OK for this solver.
STRUMPACK supports square matrices.
|
private |
Currently, the following STRUMPACK parameters/options are recognized:
"Ordering"
which takes one of the following: "NATURAL"
: natural reordering. "METIS"
: use METIS nested-dissection reordering. "PARMETIS"
: use the ParMETIS nested-dissection reordering. (default) "SCOTCH"
: use Scotch nested-dissection reordering. "PTSCOTCH"
: use PT-Scotch nested-dissection reordering. "RCM"
: use RCM reordering. "GEOMETRIC"
: a simple geometric nested dissection code that only works for regular meshes. "Matching"
which takes one of the following: "NONE"
: don't do anything. (default) "MAX_CARDINALITY"
: Maximum cardinality. "MAX_SMALLEST_DIAGONAL"
: Maximum smallest diagonal value. "MAX_SMALLEST_DIAGONAL_2"
: Same as MAX_SMALLEST_DIAGONAL, but different algorithm. "MAX_DIAGONAL_SUM"
: Maximum sum of diagonal values. "MAX_DIAGONAL_PRODUCT_SCALING"
: Maximum product of diagonal values and row and column scaling. "COMBBLAS"
: Use AWPM from CombBLAS. "ReplaceTinyPivot"
which takes one of the following:
true
: replace tiny diagonals during LU factorization. false
: do not replace tiny diagonals during LU factorization.
|
private |
Hooked in by Amesos2::Solver parent class.
|
private |
Reads matrix data into internal solver structures.
Loads data from the matrix A into the internal STRUMPACK matrix structure. This function requires communication accross all processors as the matrix is redistributed as necessary in STRUMPACK internally.
true
if the matrix was loaded, false
if not
|
overridevirtualinherited |
Pre-orders the matrix A for minimal fill-in.
Rearranges the rows and columns of the matrix A to minimize the amount of fill-in of the non-zero entries of the matrix. Pre-ordering may or may not be supported by the underlying solver. If not supported, a call to this method simply does nothing.
this
. Implements Amesos2::Solver< Matrix, Vector >.
|
overridevirtualinherited |
Performs symbolic factorization 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().
this
. Implements Amesos2::Solver< Matrix, Vector >.
|
overridevirtualinherited |
Performs numeric factorization 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 values without a subsequent call to numericFactorization().
this
Implements Amesos2::Solver< Matrix, Vector >.
|
overridevirtualinherited |
Solves (or )
Implements Amesos2::Solver< Matrix, Vector >.
|
overridevirtualinherited |
Solve using the given X and B vectors.
This overload of solve uses the given X and B vectors when solving. This X and B are used in place of any X and B that were given upon construction of the Amesos2 solver instance and are used only for this solve.
If a permanent change of X and B are required, see the setX() and setB() methods.
X
contains the solution to the systemX
and B
given at construction time (if any) are unchanged. Implements Amesos2::Solver< Matrix, Vector >.
References Amesos2::Solver< Matrix, Vector >::numericFactorization().
|
overridevirtualinherited |
Solve using the given X and B vectors.
This overload of solve uses the given X and B vectors when solving. This X and B are used in place of any X and B that were given upon construction of the Amesos2 solver instance and are used only for this solve.
If a permanent change of X and B are required, see the setX() and setB() methods.
X
contains the solution to the systemX
and B
given at construction time (if any) are unchanged. Implements Amesos2::Solver< Matrix, Vector >.
|
overridevirtualinherited |
Returns true
if the solver can handle this matrix shape.
Returns true if the matrix shape is one that the underlying concrete 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 would return false for non-symmetric matrices. etc.
Implements Amesos2::Solver< Matrix, Vector >.
Referenced by Amesos2::SolverCore< ConcreteSolver, Matrix, Vector >::SolverCore().
|
overridevirtualinherited |
Sets the matrix A of this solver.
[in] | a | An RCP to a matrix will will be used for future computation steps |
[in] | keep_phase | This parameter tells the solver what state it should keep. For example, you may want to replace the matrix but keep the symbolic factorization because you know the structure of the new matrix is the same as the structure of the old matrix. In this case you would pass Amesos2::SYMBFACT as this parameter. |
The default value for the second parameter is Amesos2::CLEAN, which means that the internal state of the solver will be completely reset. It will be as if no previous computational steps were performed.
Implements Amesos2::Solver< Matrix, Vector >.
|
inlineoverridevirtualinherited |
Sets the matrix A of this solver.
[in] | a | An raw C pointer to a matrix will will be used for future computation steps. |
[in] | keep_phase | This parameter tells the solver what state it should keep. For example, you may want to replace the matrix but keep the symbolic factorization because you know the structure of the new matrix is the same as the structure of the old matrix. In this case you would pass Amesos2::SYMBFACT as this parameter. |
The default value for the second parameter is Amesos2::CLEAN, which means that the internal state of the solver will be completely reset. It will be as if no previous computational steps were performed.
Implements Amesos2::Solver< Matrix, Vector >.
Referenced by Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::setA().
|
overridevirtualinherited |
Set/update internal variables and solver options.
The setParameters method is consistent over all concrete solvers. It accepts general status and control parameters, as well as parameters specific to a given solver. If the solver does not recognize the parameter, then it will simply be ignored
parameterList
. Parameters not specified in parameterList
revert to their default values.this
Implements Amesos2::Solver< Matrix, Vector >.
Referenced by Amesos2::Lapack< Matrix, Vector >::Lapack(), Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::setParameterList(), Amesos2::STRUMPACK< Matrix, Vector >::STRUMPACK(), Amesos2::Superludist< Matrix, Vector >::Superludist(), and Amesos2::Superlumt< Matrix, Vector >::Superlumt().
|
overridevirtualinherited |
Return a const parameter list of all of the valid parameters that this->setParameterList(...) will accept.
"YES"
and "NO"
as well as true
and false
). Implements Amesos2::Solver< Matrix, Vector >.
Referenced by Amesos2::Lapack< Matrix, Vector >::Lapack(), Amesos2::STRUMPACK< Matrix, Vector >::STRUMPACK(), Amesos2::Superludist< Matrix, Vector >::Superludist(), and Amesos2::Superlumt< Matrix, Vector >::Superlumt().
|
inlineinherited |
Set or update internal variables and solver options.
Redefined from Teuchos::ParameterListAcceptor
setParameters()
[in] | parameterList |
|
inlineinherited |
This is a empty stub.
|
inlineinherited |
This is an empty stub.
|
overridevirtualinherited |
Prints the status information about the current solver with some level of verbosity
Implements Amesos2::Solver< Matrix, Vector >.
References Amesos2::Util::printLine().
|
overridevirtualinherited |
Prints timing information about the current solver.
The Amesos2::SolverCore
base class takes care of tracking total time spent in the Amesos2 interface. Concrete solver interface class are responsible for reporting other timing statistics, which include time spent in:
Implements Amesos2::Solver< Matrix, Vector >.
References Amesos2::Util::printLine().
|
overridevirtualinherited |
Extracts timing information from the current solver.
Results are placed into the parameter list timingParameterList
.
[out] | timingParameterList | Accepts timing information from the current solver |
Implements Amesos2::Solver< Matrix, Vector >.
|
overridevirtualinherited |
Return the name of this solver.
The name is given by the underlying concrete solver instance
std::string
which is the name of this solver Implements Amesos2::Solver< Matrix, Vector >.
|
inlineprotectedinherited |
Set the number of non-zero values in the and factors.
Concrete solver classes may call this method if they wish to (or are able to) report the number of conbined non-zero count for the and factors.
|
protectedinherited |
If true
indicates that the current matrix A has been loaded into internal solver structures.
|
protectedinherited |
The RHS vector/multi-vector.
We point to a const Vector because Amesos2 should never directly modify B.
Referenced by Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::getB(), Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::getBRaw(), and Amesos2::SolverCore< Amesos2::Umfpack, Matrix, Vector >::setB().