Amesos2 - Direct Sparse Solver Interfaces
Version of the Day
|
Amesos2 interface to the PardisoMKL package. More...
#include <Amesos2_PardisoMKL_decl.hpp>
Public Types | |
typedef PardisoMKL< Matrix, Vector > | type |
typedef SolverCore < Amesos2::PardisoMKL, Matrix, Vector > | super_type |
typedef super_type::scalar_type | scalar_type |
typedef super_type::local_ordinal_type | local_ordinal_type |
typedef super_type::global_ordinal_type | global_ordinal_type |
typedef super_type::global_size_type | global_size_type |
typedef TypeMap < Amesos2::PardisoMKL, scalar_type > | type_map |
typedef type_map::type | solver_scalar_type |
typedef type_map::magnitude_type | solver_magnitude_type |
typedef TypeMap < Amesos2::PardisoMKL, local_ordinal_type >::type | int_t |
typedef FunctionMap < Amesos2::PardisoMKL, int_t > | function_map |
typedef ConcreteSolver< Matrix, Vector > | solver_type |
typedef Matrix | matrix_type |
typedef Vector | vector_type |
typedef MatrixAdapter < matrix_type >::node_t | node_type |
Public Member Functions | |
bool | matrixShapeOK () |
Returns true if the solver can handle this matrix shape. More... | |
void | setA (const Teuchos::RCP< const Matrix > a, EPhase keep_phase=CLEAN) |
Sets the matrix A of this solver. More... | |
void | setA (const Matrix *a, EPhase keep_phase=CLEAN) |
Sets the matrix A of this solver. More... | |
void | setX (const Teuchos::RCP< Vector > x) |
Sets the LHS vector X. | |
void | setX (Vector *x) |
Sets the LHS vector X using a raw pointer. | |
const Teuchos::RCP< Vector > | getX () |
Returns the vector that is the LHS of the linear system. | |
Vector * | getXRaw () |
Returns a raw pointer to the LHS of the linear system. | |
void | setB (const Teuchos::RCP< const Vector > b) |
Sets the RHS vector B. | |
void | setB (const Vector *b) |
Sets the RHS vector B using a raw pointer. | |
const Teuchos::RCP< const Vector > | getB () |
Returns the vector that is the RHS of the linear system. | |
const Vector * | getBRaw () |
Returns a raw pointer to the RHS of the linear system. | |
std::string | description () const |
Returns a short description of this Solver. | |
void | describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const |
void | printTiming (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const |
Prints timing information about the current solver. More... | |
void | getTiming (Teuchos::ParameterList &timingParameterList) const |
Extracts timing information from the current solver. More... | |
std::string | name () const |
Return the name of this solver. More... | |
Constructor/Destructor methods | |
PardisoMKL (Teuchos::RCP< const Matrix > A, Teuchos::RCP< Vector > X, Teuchos::RCP< const Vector > B) | |
Initialize from Teuchos::RCP. More... | |
~PardisoMKL () | |
Destructor. | |
Mathematical functions | |
super_type & | preOrdering () |
Pre-orders the matrix A for minimal fill-in. More... | |
super_type & | symbolicFactorization () |
Performs symbolic factorization on the matrix A. More... | |
super_type & | numericFactorization () |
Performs numeric factorization on the matrix A. More... | |
void | solve () |
Solves (or ) More... | |
void | solve (const Teuchos::Ptr< Vector > X, const Teuchos::Ptr< const Vector > B) const |
Solve using the given X and B vectors. More... | |
void | solve (Vector *X, const Vector *B) const |
Solve using the given X and B vectors. More... | |
Parameter methods | |
super_type & | setParameters (const Teuchos::RCP< Teuchos::ParameterList > ¶meterList) |
Set/update internal variables and solver options. More... | |
Teuchos::RCP< const Teuchos::ParameterList > | getValidParameters () const |
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 |
Returns a pointer to the Teuchos::Comm communicator with this operator. | |
Status & | getStatus () const |
Returns a reference to this solver's internal status object. | |
Static Public Attributes | |
static const char * | name = "PARDISOMKL" |
The 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 PardisoMKL. More... | |
int | numericFactorization_impl () |
PardisoMKL specific numeric factorization. More... | |
int | solve_impl (const Teuchos::Ptr< MultiVecAdapter< Vector > > X, const Teuchos::Ptr< const MultiVecAdapter< Vector > > B) const |
PardisoMKL 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 structures. More... | |
void | check_pardiso_mkl_error (EPhase phase, int_t error) const |
Throws an appropriate runtime error in the event that error < 0 . More... | |
void | set_pardiso_mkl_matrix_type (int_t mtype=0) |
Private Attributes | |
Teuchos::Array < solver_scalar_type > | nzvals_ |
Stores the values of the nonzero entries for PardisoMKL. | |
Teuchos::Array< int_t > | colind_ |
Stores the location in Ai_ and Aval_ that starts row j. | |
Teuchos::Array< int_t > | rowptr_ |
Stores the row indices of the nonzero entries. | |
Teuchos::Array < solver_scalar_type > | xvals_ |
Persisting, contiguous, 1D store for X. | |
Teuchos::Array < solver_scalar_type > | bvals_ |
Persisting, contiguous, 1D store for B. | |
void * | pt_ [64] |
PardisoMKL internal data address pointer. | |
int_t | mtype_ |
The matrix type. We deal only with unsymmetrix matrices. | |
int_t | n_ |
Number of equations in the sparse linear system. | |
Teuchos::Array< int_t > | perm_ |
Permutation vector. | |
int_t | nrhs_ |
number of righthand-side vectors | |
int_t | iparm_ [64] |
bool | is_contiguous_ |
Static Private Attributes | |
static const int_t | msglvl_ = 0 |
The messaging level. Set to 1 if you wish for Pardiso MKL to print statistical info. | |
static const int_t | maxfct_ = 1 |
static const int_t | mnum_ = 1 |
static const bool | complex_ |
Friends | |
class | SolverCore< Amesos2::PardisoMKL, Matrix, Vector > |
Amesos2 interface to the PardisoMKL package.
This class provides access to the Pardiso (MKL version 10.3 and compatible) sparse direct solver with out-of-core solve support. Access is provided for float
and double
scalar types, in both real and complex. Access to to Pardiso's 64-bit integer routines is also provided.
Amesos2::PardisoMKL< Matrix, Vector >::PardisoMKL | ( | Teuchos::RCP< const Matrix > | A, |
Teuchos::RCP< Vector > | X, | ||
Teuchos::RCP< const Vector > | B | ||
) |
Initialize from Teuchos::RCP.
References Amesos2::PardisoMKL< Matrix, Vector >::iparm_, Amesos2::PardisoMKL< Matrix, Vector >::mtype_, Amesos2::PardisoMKL< Matrix, Vector >::pt_, and Amesos2::PardisoMKL< Matrix, Vector >::set_pardiso_mkl_matrix_type().
|
private |
Performs pre-ordering on the matrix to increase efficiency.
PardisoMKL does reordering internally during symbolic factorization. Please refer to the "IPARM(2)"
parameter for some reordering options.
|
private |
Perform symbolic factorization of the matrix using PardisoMKL.
Called the sequence before numericFactorization.
std::runtime_error | PardisoMKL is not able to factor the matrix. |
|
private |
PardisoMKL specific numeric factorization.
std::runtime_error | PardisoMKL is not able to factor the matrix |
|
private |
PardisoMKL specific solve.
Uses the symbolic and numeric factorizations, along with the RHS vector B
to solve the sparse system of equations.
The solution of the system is placed in X.
std::runtime_error | PardisoMKL is not able to solve the system. |
|
private |
Determines whether the shape of the matrix is OK for this solver.
Pardiso MKL handles square matrices.
|
private |
The Pardiso MKL parameters that are currently recognized are:
"IPARM(2)"
"IPARM(4)"
"IPARM(8)"
"IPARM(10)"
"IPARM(12)"
"IPARM(18)"
"IPARM(24)"
"IPARM(25)"
"IPARM(60)"
Please see the Pardiso MKL documentation for a summary of the meaning and valid values for each parameter.
|
private |
|
private |
Reads matrix data into internal structures.
[in] | current_phase | an indication of which solution phase this load is being performed for. |
true
if the matrix was loaded, false
if not
|
private |
Throws an appropriate runtime error in the event that error < 0 .
phase | the phase for which this error is being checked. The meaning of a particular error value may depend on which phase was last performed |
error | the error value returned by PardisoMKL for the given phase. |
We broadcast the input value from the rank=0 image to all others before checking the value. Before doing this we convert the error into an int
value which allow us to easily broadcast its value to all process images without having to enable Teuchos long long support in the case where the user is making use of pardiso_64. The valid values of error certainly fit within an int.
|
private |
Sets the internal mtype_ member. Errors are thrown for unacceptable scalar/mtype combinations.
mtype | the type of the matrix. This may come as input from the interface user, or may be set to the default value in case mtype == 0 on entry to this function. |
Referenced by Amesos2::PardisoMKL< Matrix, Vector >::PardisoMKL().
|
virtualinherited |
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 >.
|
virtualinherited |
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 >.
|
virtualinherited |
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 >.
|
virtualinherited |
Solves (or )
Implements Amesos2::Solver< Matrix, Vector >.
|
virtualinherited |
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().
|
virtualinherited |
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 >.
|
virtualinherited |
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().
|
virtualinherited |
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 >.
|
inlinevirtualinherited |
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().
|
virtualinherited |
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::Superludist< Matrix, Vector >::Superludist(), and Amesos2::Superlumt< Matrix, Vector >::Superlumt().
|
virtualinherited |
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::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.
|
virtualinherited |
Prints the status information about the current solver with some level of verbosity
Implements Amesos2::Solver< Matrix, Vector >.
References Amesos2::Util::printLine().
|
virtualinherited |
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().
|
virtualinherited |
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 >.
|
virtualinherited |
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.
|
private |
PardisoMKL parameter vector. Note that the documentation uses 1-based indexing, but our interface must use 0-based indexing
Referenced by Amesos2::PardisoMKL< Matrix, Vector >::PardisoMKL().
|
staticprivate |
|
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().