Skip to content

docs: use AlgebraicMultigrid's automatic (SPQR) coarse solver#871

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:amg2-default-coarse-solver
Jun 16, 2026
Merged

docs: use AlgebraicMultigrid's automatic (SPQR) coarse solver#871
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:amg2-default-coarse-solver

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

Note

Please ignore until reviewed by @ChrisRackauckas. Opened as a draft.

Follow-up to #869/#870. Now that AMG v2.0 is installable alongside the OrdinaryDiffEq v7 stack (via SciML/LinearSolve.jl#1047, released as LinearSolve 3.85.2, which bumps the AMG-extension weak compat to "1, 2"), this drops the coarse_solver = LinearSolveWrapper(UMFPACKFactorization()) override from the AMG preconditioner examples in advanced_ode_example.md and uses ruge_stuben's default coarse solver.

Why

The UMFPACK (LU) override was a workaround for AMG 1.x's default Pinv coarse solver, which forms a dense SVD pseudo-inverse and errored (gesdd! "invalid argument") on the non-SPD W = I - γJ coarse-grid matrix.

AMG 2.0's default coarse solver is QRSolver (qr() → SuiteSparse SPQR for sparse matrices), which handles the non-SPD / rank-deficient coarse operator robustly with no override. LU is itself the wrong tool here (less robust than QR on near-singular coarse matrices), so the default is both cleaner and more correct.

Because docs/Manifest.toml is resolved fresh on each build (it is git-ignored) and docs/Project.toml allows AlgebraicMultigrid = "0.5, 0.6, 1, 2" + LinearSolve = "2, 3", the build now resolves LinearSolve 3.85.2 → AlgebraicMultigrid 2.0.0 automatically.

Verification (local, released stack)

  • Registry-only resolution (fresh General from the pkg server, no dev checkout): OrdinaryDiffEq 7.0.0 + LinearSolve 3.85.2 + AlgebraicMultigrid 2.0.0.
  • KenCarp47(linsolve = KrylovJL_GMRES(precs = ...), concrete_jac = true) on the brusselator solves successfully with ruge_stuben using the default coarse solver — both the plain and Jacobi-smoothed variants — on AMG 2.0.0. No gesdd!, no override.

🤖 Generated with Claude Code

Now that AMG v2.0 is installable alongside the OrdinaryDiffEq v7 stack
(LinearSolve >= 3.85.2 allows AlgebraicMultigrid v2), drop the
`coarse_solver = LinearSolveWrapper(UMFPACKFactorization())` override from the
AMG preconditioner examples and use `ruge_stuben`'s default coarse solver.

AMG 2.0's default coarse solver is `QRSolver` (SuiteSparse SPQR for sparse
matrices), which handles the non-SPD `W = I - γJ` coarse-grid matrix robustly.
The UMFPACK (LU) override was only a workaround for AMG 1.x's default `Pinv`
coarse solver, which forms a dense SVD pseudo-inverse and errored (`gesdd!`) on
that matrix — and LU is itself less robust than QR on rank-deficient coarse
operators. The default is cleaner and the idiomatic AMG usage.

Because the examples now rely on AMG 2.0's default coarse solver (AMG 1.x's
`Pinv` would crash on the non-SPD W, and the Sundials AMG example here already
uses the default coarse solver), bump the docs `[compat]` floor to
`AlgebraicMultigrid = "2"` so the build is guaranteed to resolve AMG 2.0 rather
than silently falling back to a 1.x that would error.

Verified locally on the released stack (AlgebraicMultigrid 2.0.0 +
LinearSolve 3.85.2 + OrdinaryDiffEqSDIRK): KenCarp47 + KrylovJL_GMRES with
`ruge_stuben` precs (default coarse solver, and with Jacobi smoothers) solves
the brusselator problem successfully, no override needed.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisRackauckas-Claude ChrisRackauckas-Claude force-pushed the amg2-default-coarse-solver branch from e4d9a9a to 0b16de7 Compare June 16, 2026 11:45
@ChrisRackauckas ChrisRackauckas merged commit 545db87 into SciML:master Jun 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants