-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add debug logger for solvers #1620
Conversation
Also relevant for investigating #1026 (which is where this idea came up originally) |
Wondering about the name here - it might make sense to also have a version that stores all scalars and intermediate vectors in files - should it be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments.
Also, to clarify, this would not give very helpful output with Gmres
right, due to the nature of its "scalars" (in relation with krylov_dim
most of the time)?
I think in general, having a version that stores output to files/json/wherever, in particular for vector cases would be really helpful as a general solution.
@tcojean There is now a printing and a storing variant + tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the naming needs to be updated, and the internal dispatch in the scalar printer.
* solver after each iteration. If the solver is applied to multiple right-hand | ||
* sides, only the first right-hand side gets printed. | ||
*/ | ||
class SolverDebug : public Logger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the name is not great. Maybe SolverStatePrinter
, but that is also not great. I'm struggling a bit to find a more suitable name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinging this again, I'm still unhappy with the name. It's rather non-descriptive, so users will have no idea what this is doing just from the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you describe what this logger is used for? My first thought was "It's for debugging solvers", so the name made sense. But from a user perspective, it's maybe slightly unintuitive. OTOH, will users need to use this regularly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for debugging solvers in a very specific sense, by printing the internal state after every iteration. That can be reflected in the name. Just 'debug' can mean anything and nothing.
Regarding usage: it could also be used to achieve the same thing as in #1517, so perhaps users will use it for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about SolverProgress
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I kinda warmed up to my first suggestion. SolverProgress
could easily be understood to mean just the residual norm, so I think referencing the state might be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very useful!
LGTM
a1dd3da
to
88bbd77
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, except the name.
* solver after each iteration. If the solver is applied to multiple right-hand | ||
* sides, only the first right-hand side gets printed. | ||
*/ | ||
class SolverDebug : public Logger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinging this again, I'm still unhappy with the name. It's rather non-descriptive, so users will have no idea what this is doing just from the name.
Here are some alternative suggestions:
|
Co-authored-by: Marcel Koch <marcel.koch@kit.edu>
Quality Gate passedIssues Measures |
This debug logger prints out the value of all scalars inside the solver after each iteration:
Here we see the output of the
simple-solver
example with the logger runningShould be useful for debugging #1563