chrono::ChSolverMKL< Matrix > Class Template Reference

Description

template<typename Matrix = ChCSMatrix>
class chrono::ChSolverMKL< Matrix >

Class that wraps the Intel MKL Pardiso parallel direct solver.

Sparse linear direct solver. Cannot handle VI and complementarity problems, so it cannot be used with NSC formulations.

The solver is equipped with two main features:

  • sparsity pattern lock
  • sparsity pattern learning

The sparsity pattern lock enables the equivalent feature on the underlying matrix (if supported) and is intended to be used when the sparsity pattern of the matrix does not undergo significant changes from call to call.
Is controlled by SetSparsityPatternLock();

The sparsity pattern learning feature acquires the sparsity pattern in advance, in order to speed up the first build of the matrix.
Is controlled by ForceSparsityPatternUpdate();

A further option allows the user to manually set the number of non-zeros of the underlying matrix.
This option will overrides the sparsity pattern lock.

If the sparsity pattern learning is enabled, then is highly recommended to enable also the sparsity pattern lock.

Minimal usage example, to be put anywhere in the code, before starting the main simulation loop:

auto mkl_solver = std::make_shared<ChSolverMKL<>>();
application.GetSystem()->SetSolver(mkl_solver);

See ChSystemDescriptor for more information about the problem formulation and the data structures passed to the solver.

Template Parameters
Matrixtype of the matrix used by the solver;

#include <ChSolverMKL.h>

Inheritance diagram for chrono::ChSolverMKL< Matrix >:
Collaboration diagram for chrono::ChSolverMKL< Matrix >:

Public Member Functions

ChMklEngineGetMklEngine ()
 Get a handle to the underlying MKL engine.
 
Matrix & GetMatrix ()
 Get a handle to the underlying matrix.
 
void SetSparsityPatternLock (bool val)
 Enable/disable locking the sparsity pattern (default: false). More...
 
void ForceSparsityPatternUpdate (bool val=true)
 Call an update of the sparsity pattern on the underlying matrix. More...
 
void UsePermutationVector (bool val)
 Enable/disable use of permutation vector (default: false).
 
void LeverageRhsSparsity (bool val)
 Enable/disable leveraging sparsity in right-hand side vector (default: false).
 
void SetPreconditionedCGS (bool val, int L)
 Set the parameter that controls preconditioned CGS.
 
void SetMatrixNNZ (int nnz)
 Set the number of non-zero entries in the problem matrix.
 
void ResetTimers ()
 Reset timers for internal phases in Solve and Setup.
 
double GetTimeSolve_Assembly () const
 Get cumulative time for assembly operations in Solve phase.
 
double GetTimeSolve_SolverCall () const
 Get cumulative time for Pardiso calls in Solve phase.
 
double GetTimeSetup_Assembly () const
 Get cumulative time for assembly operations in Setup phase.
 
double GetTimeSetup_SolverCall () const
 Get cumulative time for Pardiso calls in Setup phase.
 
virtual bool SolveRequiresMatrix () const override
 Indicate whether or not the Solve() phase requires an up-to-date problem matrix. More...
 
virtual bool Setup (ChSystemDescriptor &sysd) override
 Perform the solver setup operations. More...
 
virtual double Solve (ChSystemDescriptor &sysd) override
 Solve using the MKL Pardiso sparse direct solver. More...
 
virtual void ArchiveOUT (ChArchiveOut &marchive) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIN (ChArchiveIn &marchive) override
 Method to allow de serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChSolver
virtual Type GetType () const
 Return type of the solver. More...
 
void SetVerbose (bool mv)
 Set verbose output from solver.
 
bool GetVerbose () const
 

Additional Inherited Members

- Public Types inherited from chrono::ChSolver
enum  Type {
  SOR = 0, SYMMSOR, JACOBI, SOR_MULTITHREAD,
  PMINRES, BARZILAIBORWEIN, PCG, APGD,
  MINRES, SOLVER_SMC, CUSTOM
}
 Available types of solvers.
 
- Protected Attributes inherited from chrono::ChSolver
bool verbose
 

Member Function Documentation

template<typename Matrix = ChCSMatrix>
void chrono::ChSolverMKL< Matrix >::ForceSparsityPatternUpdate ( bool  val = true)

Call an update of the sparsity pattern on the underlying matrix.


It is used to inform the solver (and the underlying matrices) that the sparsity pattern is changed.
It is suggested to call this function just after the construction of the solver.

Remarks
Turn on the sparsity pattern lock feature SetSparsityPatternLock(); otherwise performance can be compromised.
template<typename Matrix = ChCSMatrix>
void chrono::ChSolverMKL< Matrix >::SetSparsityPatternLock ( bool  val)

Enable/disable locking the sparsity pattern (default: false).


If val is set to true, then the sparsity pattern of the problem matrix is assumed to be unchanged from call to call.

template<typename Matrix = ChCSMatrix>
virtual bool chrono::ChSolverMKL< Matrix >::Setup ( ChSystemDescriptor sysd)
overridevirtual

Perform the solver setup operations.

For the MKL solver, this means assembling and factorizing the system matrix. Returns true if successful and false otherwise.

Reimplemented from chrono::ChSolver.

template<typename Matrix = ChCSMatrix>
virtual double chrono::ChSolverMKL< Matrix >::Solve ( ChSystemDescriptor sysd)
overridevirtual

Solve using the MKL Pardiso sparse direct solver.

It uses the matrix factorization obtained at the last call to Setup().

Implements chrono::ChSolver.

template<typename Matrix = ChCSMatrix>
virtual bool chrono::ChSolverMKL< Matrix >::SolveRequiresMatrix ( ) const
overridevirtual

Indicate whether or not the Solve() phase requires an up-to-date problem matrix.

As typical of direct solvers, the Pardiso solver only requires the matrix for its Setup() phase.

Implements chrono::ChSolver.