Conversation
|
@edoyango I would suggest you activate the pre-commit hook in your development environment. It will likely save you some time. |
micaeljtoliveira
left a comment
There was a problem hiding this comment.
@edoyango Thanks for the changes. All good from my side.
|
@edoyango The linter check is failing - will you please fix that. I am looking through the rest of the code in the meantime |
manodeep
left a comment
There was a problem hiding this comment.
I made some suggestions trying to reduce the hardcoding. This looks quite substantial and great overall.
The other bit would be that the code quality checks for the linter and coverage need to pass
tests/test_esmf_summary_parser.py
Outdated
| # check that all keys in correct_dict are in input_dict | ||
| if input_dict.keys() < correct_dict.keys(): | ||
| raise ValueError(f"Missing keys for {region} (depth: {depth}): {set(correct_dict.keys()) - input_dict.keys()}") | ||
| extra_keys = set(correct_dict.keys()) - metric_keys |
There was a problem hiding this comment.
What happens if metric_keys contains extra keys? (Is that even possible for valid data?)
There was a problem hiding this comment.
metric_keys is the expected "metric" keys in both input_dict and correct_dict. The function will error if input_dict and correct_dict don't have all the keys in metric_keys. extra_keys would be the region keys.
There was a problem hiding this comment.
renamed extra_keys to region_keys so hopefully it's a bit clearer what they are
minghangli-uni
left a comment
There was a problem hiding this comment.
Sorry I haven’t looked into the code yet, but I’d suggest keeping only hierarchical, since some region names might appear in multiple locations (such as in Runphase or in Init). Otherwise it could lead to unexpected results.
Are you talking about regions like |
23b7ac7 to
c3076ef
Compare
|
For example, |
I think that's fine. It's very common case when profiling a code that the same block of code is called from different places, with different data and, therefore, with very different timings. The hierarchical data gives you more information, which is good, but the flat one is still useful in many cases. |
|
True. Thanks for pointing out the issue. @manodeep @micaeljtoliveira to either of you have a suggestion for how to handle this? I'm thinking for the flat case, we simply add a _N suffix for now. We could add the bracketed prefixes, but that would probably be too verbose since there's around 10 levels? |
As I wrote above, I think it's fine to aggregate calls to the same region but from different places in the call-tree together when working with the flat case. We loose some information, but what is left can still be useful. |
f9f00a9 to
df34da1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 10 +1
Lines 285 345 +60
=========================================
+ Hits 285 345 +60 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
df34da1 to
dc77c57
Compare
@minghangli-uni @micaeljtoliveira @manodeep I've added some code to aggregate regions that occur more than one, if PETs and PEs are the same (errors if they're not). This assumes regions with identical names is referring to the same code. Can you all have a look before I merge? |
micaeljtoliveira
left a comment
There was a problem hiding this comment.
@edoyango LGTM, just one very small thing to fix.
minghangli-uni
left a comment
There was a problem hiding this comment.
LGTM, thanks @edoyango
Co-authored-by: Manodeep Sinha <manodeep@gmail.com> Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
fcd4d96 to
0d6b41c
Compare
This add's a parser for esmf's text summary which can be parsed "flat" or hierarchically. We probably only need flat for now, but the latter might be useful at some point.