doc:user:integration:general:solvers
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:user:integration:general:solvers [2014/10/07 16:19] – joris | doc:user:integration:general:solvers [2026/04/09 16:31] (current) – lacroix | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== Introduction ===== | ===== Introduction ===== | ||
| - | Since 20/07/2005, Metafor includes several linear solvers to solve the system at each iteration when implicitly integrating motion equations. Skyline is the traditional solver, but the direct solver [[http:// | + | Since 20/07/2005, Metafor includes several linear solvers to solve the system at each iteration when implicitly integrating motion equations. Skyline is the traditional solver, but the direct solver [[http:// |
| + | |||
| + | By default, as the stiffness matrix is non symmetric the solver used is non symmetric (with symmetric structure). It is however possible to force the stiffness matrix to be symmetric (computing the mean value between upper and lower terms of the matrix) | ||
| + | |||
| + | use : | ||
| + | <code python> | ||
| + | solvermanager = metafor.getSolverManager() | ||
| + | solvermanager.setSymmetric(True) # False by default | ||
| + | </ | ||
| ===== Skyline solver ===== | ===== Skyline solver ===== | ||
| - | Default solver. It does not require any specific configuration. However, it is sequential, occupies a lot of memory and is quite slow on big simulations. However, it is very robust, and the code source is available so it can run on every OS. | + | Default solver. It does not require any specific configuration. However, it is sequential, occupies a lot of memory and is quite slow on big simulations. However, it is very robust, and the code source is available so it can run on every OS. The Skyline is automatically optimized using Sloan Algorithm. |
| ===== Pardiso (DSS) Solver===== | ===== Pardiso (DSS) Solver===== | ||
| - | Pardiso solver is a sparse direct solver using CSR format for storing the matrix. Several CPU can be used (SMP parallelism, | + | Pardiso solver is a sparse direct solver using CSR format for storing the matrix. Several CPU can be used (SMP parallelism, |
| Use: | Use: | ||
| <code python> | <code python> | ||
| - | metafor = domain.getMetafor() | + | solvermanager = metafor.getSolverManager() |
| - | solvermanager = metafor.getSolverManager(); | + | solvermanager.setSolver(DSSolver()) |
| - | try: | + | |
| - | | + | |
| - | except NameError: | + | |
| - | pass | + | |
| </ | </ | ||
| The number of CPUs is set using | The number of CPUs is set using | ||
| - | Blas.setNumThreads(n) | + | < |
| + | Metafor -k n | ||
| + | </ | ||
| where '' | where '' | ||
| Line 37: | Line 44: | ||
| <code python> | <code python> | ||
| - | solver = ISSolver() | + | solver = ISSolver() |
| - | solver.setRestart(5) | + | |
| - | solver.setItMax(10) | + | solver.setRestart(5) |
| - | solver.setTol(1e-1) | + | solver.setMaxIter(10) |
| + | solver.setTol(1e-1) | ||
| solvermanager = metafor.getSolverManager() | solvermanager = metafor.getSolverManager() | ||
| Line 46: | Line 54: | ||
| </ | </ | ||
| - | By default, the solver uses a ILU0 preconditioner. It is an incomplete factorization (A~=LU) for which the structure of L and U is the same as A. | + | By default, the solver uses a ILU0 preconditioner. It is an incomplete factorization (A~=LU) for which the structure of L and U is the same as A. A more elaborated preconditioner is also available (ILUT). It is also an incomplete factorization, |
| - | A more elaborated preconditioner is also available | + | <code python> |
| + | solver.setPreconditioner(ILUT) | ||
| + | solver.setPrecMaxFill(20) # 20 elements are kept on the lines of L and U | ||
| + | </ | ||
| + | |||
| + | ===== MUMPS (MUltifrontal Massively Parallel sparse direct Solver) ===== | ||
| + | |||
| + | MUMPS is a sparse direct solver | ||
| <code python> | <code python> | ||
| - | solver.useILUT(20) # nFill=20 | + | solvermanager = metafor.getSolverManager() |
| + | solvermanager.setSolver(MUMPSolver()) | ||
| </ | </ | ||
| + | |||
| + | The input matrix can be supplied to MUMPS in assembled format in coordinate COO (distributed or centralized) or in elemental format. MUMPS can also be used with multiple threads (CPU cores) by using | ||
| + | |||
| + | < | ||
| + | Metafor -k n | ||
| + | </ | ||
| + | |||
| + | where '' | ||
| + | |||
| + | ===== CUDSS (CUDA Direct Sparse Solver) ===== | ||
| + | |||
| + | CUDSS is a GPU-accelerated sparse direct solver using the CSR matrix format. Providing your hardware is equipped with a good Nvidia GPU, leveraging GPU acceleration for solving the finite element system can become beneficial compared to Intel MKL DSS. The CUDSS interface requires CUDA >= 12.0 along with the Nvidia drivers and CUDA Toolkit, and a compatible version of the CUDSS library (i.e. >= 0.6.0.5). Download links are given below, but it is **strongly advised** to use the packages provided by your Linux distro, rather than Nvidia ones, when available. | ||
| + | |||
| + | * Nvidia drivers : https:// | ||
| + | * CUDA Toolkit : https:// | ||
| + | * CUDSS : https:// | ||
| + | |||
| + | <code python> | ||
| + | solver = CUDSS() | ||
| + | solvermanager = metafor.getSolverManager() | ||
| + | solvermanager.setSolver(solver) | ||
| + | </ | ||
| + | |||
| + | CUDSS is interfaced with a single parameter '' | ||
| + | |||
| + | <code python> | ||
| + | solver.setNSteps(2) # Default is 0 | ||
| + | </ | ||
| + | |||
| + | ===== AMGX (Algebraic MultiGrid) ===== | ||
| + | |||
| + | AMGX is a GPU-accelerated iterative sparse solver using the CSR matrix format. It requires CUDA > 12.0, CUDA Toolkit and a compatible Nvidia drivers (and hardware). AMGX can provide an accurate solution in a significantly smaller computation time than CUDSS if configured properly, but its overall robustness is weaker than a direct solver. | ||
| + | |||
| + | * AMGX Website : https:// | ||
| + | * AMGX repository : https:// | ||
| + | |||
| + | <code python> | ||
| + | solver = AMGX() | ||
| + | |||
| + | solver.setAlgorithm(algo) | ||
| + | solver.setPreconditioner(prec) | ||
| + | solver.setMaxIter(1000) | ||
| + | solver.setAbsTol(1e-12) | ||
| + | solver.setRelTol(1e-12) | ||
| + | solver.setRestart(5) | ||
| + | |||
| + | solvermanager = metafor.getSolverManager() | ||
| + | solvermanager.setSolver(solver) | ||
| + | </ | ||
| + | |||
| + | AMGX offers many options, among which a few have been interfaced in Metafor: | ||
| + | |||
| + | |||
| + | | '' | ||
| + | | ::: | ::: | = '' | ||
| + | | ::: | ::: | = '' | ||
| + | | '' | ||
| + | | ::: | ::: | = '' | ||
| + | | ::: | ::: | = '' | ||
| + | | ::: | ::: | = '' | ||
| + | | ::: | ::: | = '' | ||
doc/user/integration/general/solvers.1412691542.txt.gz · Last modified: (external edit)
