Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMRES Convergence Without Meeting atol/rtol #774

Closed
alexQueue opened this issue Aug 13, 2023 · 3 comments
Closed

GMRES Convergence Without Meeting atol/rtol #774

alexQueue opened this issue Aug 13, 2023 · 3 comments

Comments

@alexQueue
Copy link

alexQueue commented Aug 13, 2023

I've been banging my head against this issue for a few days now.

I have a system, and am setting my tolerances to 1e-9, and my solution converges "good enough given atol and rtol", however I get a much worse residual than 1e-9 and I'm trying to understand why. I assume there is an internal residual measure that is used as a stopping criterion that is different from the one that is output.
I've run it in a number of configurations and get the same behavior (using atol, using rtol, using both, using a preconditioner, not using a preconditioner, measuring residual directly via a callback (not yet working as expected):

Here's an example output:

TOL=1e-9
x, stats = Krylov.gmres(MA, Mrhs, restart=false, atol=TOL, rtol=TOL, itmax=50, verbose=1, history=true)

GMRES: system of size 350679
 pass      k     ‖rₖ‖   hₖ₊₁.ₖ  timer
    0      0  1.9e+04  ✗ ✗ ✗ ✗  0.36s
    1      1  6.4e+03  3.8e-01  15.29s
    1      2  1.6e+03  2.6e-01  29.46s
    1      3  8.2e+02  5.8e-01  42.66s
    1      4  3.4e+02  3.9e-01  55.64s
    1      5  9.3e+01  3.3e-01  68.45s
    1      6  4.4e+01  4.8e-01  81.49s
    1      7  1.4e+01  4.1e-01  95.12s
    1      8  6.1e+00  4.4e-01  108.67s
    1      9  1.9e+00  3.9e-01  121.53s
    1     10  9.8e-01  6.0e-01  134.34s
    1     11  4.0e-01  4.5e-01  147.18s
    1     12  1.8e-01  5.1e-01  160.38s
    1     13  9.2e-02  5.5e-01  173.98s
    1     14  4.7e-02  6.1e-01  187.62s
    1     15  2.4e-02  5.2e-01  200.45s
    1     16  1.5e-02  7.2e-01  213.24s
    1     17  8.3e-03  5.8e-01  226.10s
    1     18  4.6e-03  6.1e-01  239.49s
    1     19  2.3e-03  5.7e-01  253.11s
    1     20  1.3e-03  5.8e-01  266.67s
    1     21  6.3e-04  5.9e-01  279.63s
    1     22  3.1e-04  5.0e-01  292.59s
    1     23  1.8e-04  6.4e-01  305.64s

stats
SimpleStats
 niter: 23
 solved: true
 inconsistent: false
 residuals: [ 1.9e+04  6.4e+03  1.6e+03 ...  6.3e-04  3.1e-04  1.8e-04 ]
 Aresiduals: []
 κ₂(A): []
 timer: 305.64s
 status: solution good enough given atol and rtol

Julia 1.7 (I'm unable to update on this server),
Krylov.jl 0.9.1

Thanks for any help!

@amontoison
Copy link
Member

amontoison commented Aug 13, 2023

Hi @alexQueue!
GMRES should stop when ||r_k|| <= atol + rtol * ||r_0||.
The initial residual r_0 is b.
You can set rtol=0.0 in your case.
I still don't understand why GMRES stops before that ||r_k|| <= 1.9 * 1e-5 is reached.
Can you save and share your linear system with MatrixMarket.jl?

@amontoison
Copy link
Member

@alexQueue
Can you give me an update about your issue?

@alexQueue
Copy link
Author

@amontoison Ah I was sure I replied.
You were correct. Using rtol=0.0 fixed it. It seems like I was misunderstanding the meaning of rtol.

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

No branches or pull requests

2 participants