-
Notifications
You must be signed in to change notification settings - Fork 94
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
Minimal stopping criteria config #1613
Conversation
} | ||
|
||
if (config.get_tag() == pnode::tag_t::map) { | ||
return parse_minimal_criteria(config, context, td); |
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.
return parse_minimal_criteria(config, context, td); | |
auto updated = config::update_type(td); | |
return parse_minimal_criteria(config, context, updated); |
It is to support no valuetype available outside
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'm not sure what you mean here. I can specify the value type of the residual nom criterion, as you can see in the 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.
It's based on the type_descriptor from the outer loop.
I mean something like
"stop": {
"value_type": "float64",
"residual_norm": ...
}
in case no precision information from outside or want to specify certain precision for stop.
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.
following the above comment,
"stop": [
{
"type": "ResidualNorm",
"value_type": "float32",
...
}
]
in multigrid or some solver without precision information.
it can be mapped to
"stop": {
"value_type": "float32",
"residual_norm": ...
}
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.
Or, we can say this rare case should use the map version not minimal version
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 will try a bit to make it work. If it's a reasonable effort I will adapt it.
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 was pretty simple to add, so it's now available.
core/config/config_helper.cpp
Outdated
parse_or_get_criteria(const pnode& config, const registry& context, | ||
const type_descriptor& td) | ||
{ | ||
if (config.get_tag() == pnode::tag_t::array) { |
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.
The array can not accept 1 object now. you can use type to distinguish the path and reuse the parse_or_get_factory
7735cc5
to
2629167
Compare
0126f7d
to
829b991
Compare
} | ||
|
||
if (config.get_tag() == pnode::tag_t::map) { | ||
return parse_minimal_criteria(config, context, td); |
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.
following the above comment,
"stop": [
{
"type": "ResidualNorm",
"value_type": "float32",
...
}
]
in multigrid or some solver without precision information.
it can be mapped to
"stop": {
"value_type": "float32",
"residual_norm": ...
}
} | ||
|
||
if (config.get_tag() == pnode::tag_t::map) { | ||
return parse_minimal_criteria(config, context, td); |
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.
Or, we can say this rare case should use the map version not minimal version
829b991
to
c1ce897
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! only nit left is that the updated_td can reuse the existing function
core/config/config_helper.cpp
Outdated
auto value_type_it = config.get_map().find("value_type"); | ||
type_descriptor updated_td = | ||
value_type_it == config.get_map().end() | ||
? td | ||
: type_descriptor(value_type_it->second.get_string(), | ||
td.get_local_index_typestr(), | ||
td.get_global_index_typestr()); |
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.
you can also use updated_td = config::update_type(td);
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.
Thanks for the hint!
c1ce897
to
cd8fce8
Compare
cd8fce8
to
d89b027
Compare
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1613 +/- ##
===========================================
+ Coverage 88.77% 89.48% +0.70%
===========================================
Files 808 808
Lines 66686 66723 +37
===========================================
+ Hits 59201 59706 +505
+ Misses 7485 7017 -468 ☔ View full report in Codecov by Sentry. |
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!
3478d9a
to
aaaca49
Compare
Signed-off-by: Marcel Koch <marcel.koch@kit.edu>
Signed-off-by: Marcel Koch <marcel.koch@kit.edu>
- allow changing the value_type - fix docs - call `parse_or_get_criteria` directly from solver config Co-authored-by: Yu-Hsiang M. Tsai <yhmtsai@gmail.com>
aaaca49
to
7f91879
Compare
Error: PR already merged! |
This PR adds a minimal specification for configuring stopping criteria. The test now contains an example for this configuration. Since the main implementation to configure the criteria is already implemented, this adds only a bit of dispatching.
This is intended to continue the discussion in #1392, while not blocking the release.
Todo:
The stopping criteria can now be defined as: