Add Preconditioned Conjugate Gradient Method#188
Open
julianlitz wants to merge 10 commits intomainfrom
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #188 +/- ##
==========================================
- Coverage 95.28% 94.91% -0.38%
==========================================
Files 94 94
Lines 9316 9517 +201
==========================================
+ Hits 8877 9033 +156
- Misses 439 484 +45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Preconditioned Conjugate Gradient (PCG) to GMGPolar
Rather than running GMGPolar as a standalone iterative solver, we can exploit it as a preconditioner for CG.
Each PCG iteration approximates the solution of
A*z=rby running a cheap FMG approximation followed by one multigrid cycle. A fast yet sufficiently accurate approximation.The non-extrapolated operator A is used as the preconditioner M, both for solving the standard and extrapolated problem (see Litz et al.).
The extrapolated operator
A_excannot serve as preconditioner because PCG only has access to a discretized residual vector at each iteration instead of a source term function specific to each level. While we could restrict the residual and try to solve the extrapolated system arising from that, it won't converge to a higher order solution. This was validated on the paper_v2_conjugate_gradient branch.When combined with extrapolation, the PCG solver converges in up to 4× fewer iterations than standalone GMGPolar and runs up to 2× faster end-to-end. A significant gain for a minimal implementation cost.
This is mainly contributed by the fact that the extrapolated smoother with slow algebraic convergence is not used.
The implementation is tightly integrated with the existing solver, so the additional memory cost is just two vectors. The three PCG work vectors (r, z, A*p) are aliased onto storage that already exists (level.rhs(), level.solution(), level.residual()), and only the solution x and search direction p require fresh allocations.
Usage:
bool PCG = true/false toggles between the standard iterative GMGPolar solver and the new PCG approach.
FMG is used just as before to obtain the initial approximation x_0.
There are multiple settings that determine how precise the A*z=r solve will be.
First we compute a cheap approximation via bool PCG_FMG=true
which is then refined with some PCG_MG_iterations.
PCG_FMG=false and PCG_MG_iterations=0 is equal to the standard CG method without preconditioning.
This PR adds the PCG algorithm
https://github.com/SciCompMod/GMGPolar/blob/litz_pcg_01/src/GMGPolar/solver.cpp#L308-#L428
as well as google tests to test the convergence of the new method.
Merge Request - GuideLine Checklist
Guideline to check code before resolve WIP and approval, respectively.
As many checkboxes as possible should be ticked.
Checks by code author:
Always to be checked:
If functions were changed or functionality was added:
If new functionality was added:
If new third party software is used:
If new mathematical methods or epidemiological terms are used:
Checks by code reviewer(s):