This is an optional module that enables Chrono to use the Pardiso solver from Pardiso Project.
Read the introduction to modules for a technical background on the modularity of the Chrono project.
Chrono::Engine usually relies on its built-in solvers, whose good perfomance are guaranteed by leveraging the internal data structure. In fact, for a wide range of applications, these suffice.
However, for higher accuracy results, a direct solver could still be needed.
This module provides access to the third-party Pardiso solver in its PardisoProject flavour.
Features
As for the all the direct solvers, two Chrono-specific features are implemented:
- sparsity pattern lock
In many cases, the internal data structures undergo very little changes between different timesteps. In these cases it is useful to inform the solver that the sparsity pattern does not change consistently in order to speed up the matrix assembly. - sparsity pattern learner
The sparsity pattern learning feature acquires the sparsity pattern in advance, in order to speed up matrix assembly. Enabled by default, the sparsity matrix learner identifies the exact matrix sparsity pattern (without actually setting any nonzeros) Look at the API section of this module for a more details.
Requirements
A valid PardisoProject licence (free for academia) is required to run this module. The Pardiso solver can be downloaded from the Pardiso Project website. Pardiso is actually only available for Macs with Intel hardware, you cannot use it on Arm64 hardware.
Building instructions
- Extract the library in an arbitrary folder (avoid path with spaces, special characters or just too long). E.g.
C:/workspace/libraries/pardisoproject
- Follow the guide for the full installation of Chrono, but when running CMake make sure that also the option
ENABLE_MODULE_PARDISO_PROJECT
is set toON
. - Set the variable
PARDISOPROJECT_LIBRARIES
to point to the Pardiso Project import library path (the one ending with.lib
for Win OS) e.g.C:/workspace/libraries/pardisoproject/libpardiso600-WIN-X86-64.lib
. Please always use forward slashes/
in CMake paths.
How to use it
Set up the environment
Before creating executables that can actually leverage the Pardiso library, you have to make sure that:
- the licence file is available in proper directories (see Pardiso Project User Guide)
- the Pardiso run-time libraries are available to the executable itself.
For Win OS, this is achieved by setting the PATH environmental variable in a proper way.
The fastest way is to permanently add the path to the Pardiso runtime library (e.g.C:/workspace/libraries/pardisoproject
) to your PATH environmental variable.
Many guides can be found online to help setting environmental variables properly.
Set up the code
- Simply add this snippet anywhere in your code, before running the main simulation loop.
This will inform Chrono to use the Pardiso solver from PardisoProject.auto parproj_solver = std::make_shared<ChSolverPardisoProject>();my_system.SetSolver(parproj_solver); - (Optional) Turn on the sparsity pattern lock (see chrono::ChSolverPardisoProject and chrono::ChDirectSolverLS for further details) auto parproj_solver = std::make_shared<ChSolverPardisoProject>();parproj_solver->SetSparsityPatternLock(true);my_system.SetSolver(parproj_solver);
- By default, this solver uses the sparsity pattern learner (see chrono::ChDirectSolverLS) to infer the sparsity pattern before actually loading the non-zero elements. To disable the use of the sparsity pattern learner, call parproj_solver->UseSparsityPatternLearner(false);
- Look at the API section of this module for documentation about classes and functions.