Pick a solver / preconditioner pair#
Use this page as a decision tree. The conceptual page Solvers — taxonomy explains the why; this page just says what to build.
Decide by matrix property#
Matrix property |
Solver |
Preconditioner |
Notes |
|---|---|---|---|
SPD, well-conditioned |
|
|
The textbook default. |
SPD, ill-conditioned, large |
|
|
Incomplete Cholesky. |
SPD, very large, mesh-based |
|
|
AMG with |
Symmetric indefinite |
|
|
Three-term recurrence like CG, no breakdown on indefinite systems. |
Non-symmetric, general |
|
|
Restart with |
Non-symmetric, memory-tight |
|
|
Bounded memory unlike GMRES. |
Variable preconditioner (inner Krylov, adaptive AMG) |
|
(anything) |
FGMRES. |
Many small independent systems |
|
|
Fused-kernel batched path. |
Distributed (MPI) SPD |
|
|
Schwarz is the canonical distributed preconditioner. |
Sparse direct, one-off |
|
— |
Reorder first; see Tune a sparse direct solve. |
Sparse direct, NVIDIA GPU |
|
— |
Vendor-tuned with |
The shape of the construction#
Every iterative solver follows the same pattern:
auto solver_factory =
SolverType::build()
.with_criteria(
gko::stop::Iteration::build().with_max_iters(1000u).on(exec),
gko::stop::ResidualNorm<ValueType>::build()
.with_reduction_factor(1e-8).on(exec))
.with_preconditioner(
PreconditionerType::build()
.with_/* ... */
.on(exec))
.on(exec);
auto solver = solver_factory->generate(system_matrix);
solver->apply(b, x);
The two factory parameters every iterative solver needs are
with_criteria (one or more stopping criteria; see
Configure stopping criteria) and
optionally with_preconditioner. Solvers without a preconditioner
factory default to identity (no preconditioning).
Worked example: ILU-preconditioned GMRES#
auto gmres = gko::solver::Gmres<double>::build()
.with_krylov_dim(50u)
.with_criteria(
gko::stop::Iteration::build().with_max_iters(1000u).on(exec),
gko::stop::ResidualNorm<double>::build()
.with_reduction_factor(1e-8).on(exec))
.with_preconditioner(
gko::preconditioner::Ilu<>::build().on(exec))
.on(exec)
->generate(system_matrix);
gmres->apply(b, x);
Quick rules of thumb#
Start simple. Jacobi preconditioner first; upgrade only if convergence is too slow.
Direct solvers scale further than you might expect when paired with a fill-reducing reordering — see Tune a sparse direct solve.
GMRES restart length (
krylov_dim) is usually the most impactful knob on non-symmetric problems. Default is 100; smaller reduces memory at the cost of convergence speed.Distributed solvers require an MPI build; see Use an existing MPI communicator.
See also
Solvers — taxonomy — the design rationale.
Preconditioners — taxonomy — placement (left/right/split) and family details.