-
Notifications
You must be signed in to change notification settings - Fork 64
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
Bug fix for unit conversion error in ccpp_prebuild.py (variables that are slices of a n+1 dimensional array have wrong allocation) #600
Conversation
…ix wrong name of subroutines in diagnostic error messages, set thread number and thread counter to safe values when running over the entire domain
…ive and conditionally-allocated variables
…so that pointers can reference them, their children, or slices of their arrays
…mporary (group cap) variables of rank n that correspond to a slice of an n+1 dimensional array have the right dimensions in the assigment calls and subroutine call list
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.
self-review
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 reviewed the changes to mkcap.py and mkstatic.py only. I'm not familiar enough with the testing code to comment/review ATM.
Tests are done at ufs-community/ufs-weather-model#2463. @grantfirl @dustinswales Can you merge this pr? |
@mkavulich @dustinswales We need another approval before we can merge this. |
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.
Just some quick questions before approval
There are also mismatched parens in the other new test schemes, I assume due to copy-paste |
I can fix those parentheses - I don't think it is necessary to retest with UFS, since all the "bugs" are in test_prebuild/... ? @grantfirl @dustinswales ? |
Done in f80f9c9. Here is the output of
|
ce21c6f
to
f80f9c9
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.
I agree its unnecessary to retest UFS since this is only for stand-alone testing. Thanks for fixing that.
Thanks for spotting those. I am also surprised that this only gave warnings, not errors. |
Description
Bug fix in
scripts/mkstatic.py
: definedim_string_allocate
so that temporary (group cap) variables of rankn
that correspond to a slice of ann+1
dimensional array have the right dimensions in the assignment calls and subroutine call lists. See the inline documentation added inmkstatic.py
around line 1476 for more information.Addition of test
test_prebuild/test_unit_conv
to test for the above and to test for thecapgen
issue reported in Unit conversion bug when variable is used by two different schemes (with different units) #594 (Unit conversion bug when variable is used by two different schemes with different units). Note thatccpp_prebuild.py
did not suffer from this bug, but I wanted to make sure that we test for it.In the development of the new test
test_unit_conv
, I discovered that we should declare all incoming host variables in the group caps astarget
. This is because it is tricky in prebuild to determine that a parent variablebar
needs to have thetarget
attribute in case a slice of it has the active attribute. This is a bit of an edge case, but I believe this additional attribute is safe. I will run full UFS RTs with this PR to check if the results are b4b or if the addition oftarget
causes the compiler to optimize differently.Minor updates to
test_prebuid/{test_blocked_data,test_chunked_data}
: fix wrong name of subroutines in diagnostic error messages, set thread number and thread counter to safe values when running over the entire domain.User interface changes?: No
Resolves #598
Testing:
test removed: n/a
unit tests: docstring tests not run, since the files that are modified in this PR do not have docstring tests
system tests: CI tests all pass
manual testing:
1. Ran
test_prebuild/run_all_tests.sh
on my laptop withgcc@13.3.0
andopenmpi/5.0.3
2. Ran full regression tests with ufs-weather-model on Hera, all tests passed. See ufs-community/ufs-weather-model#2464 and NOAA-EMC/fv3atm#878