Add threading test to capgen_test; codee format test/capgen_test/*.F90#722
Add threading test to capgen_test; codee format test/capgen_test/*.F90#722climbfuji wants to merge 5 commits intoNCAR:developfrom
capgen_test; codee format test/capgen_test/*.F90#722Conversation
a9e77fa to
a76f82c
Compare
capgen_test; codee format test/capgen_test/*.F90
dustinswales
left a comment
There was a problem hiding this comment.
Thanks for adding these features.
I like how extensible the ctest was in this case!
|
hi @climbfuji i'm working through this now, but thought I'd mention that I ran the unit tests on derecho and found that the new thread tests fail (answer differences) with ifx (but pass with ifort). Not sure if this is critical. If we determine that we'll proceed without fixing that now, I will make an issue. |
|
@peverwhee That's interesting. I thought I had tested on my laptop with |
I figured that I tested with gcc on my laptop earlier. I can reproduce your error with oneapi@2025.3.0. The results are identical between omp1 and omp2 with oneapi@2025.3.0, but what is concerning is that the values are vastly different between gfortran and ifx - not just a bit. I will need to investigate what is going on here. |
Thanks for the update, @climbfuji If it helps, it also fails with oneapi@2025.2.1. Let me know if you want a second pair of eyes. Since we haven't extensively tested the generated caps with ifx, it could be something somewhat unrelated to threading that's popping up |
I am fairly certain that it's something else. Let me dig a little more later, maybe it has to do with the flags, uninitialized data, ... |
3a38b76 to
419a6c2
Compare
|
@peverwhee Indeed, I found an uninitialized variable ( The bug fix is in commit 419a6c2 |
peverwhee
left a comment
There was a problem hiding this comment.
thanks @climbfuji ! tests pass for me with both ifx and gnu on derecho.
I do have a couple of codee questions.
test/capgen_test/temp_adjust.F90
Outdated
| real(kind=kind_phys), intent(in) :: temp_prev(:) | ||
| real(kind=kind_phys), intent(inout) :: temp_layer(foo) |
There was a problem hiding this comment.
I'm wondering if maybe we don't want to fully codee-ify some of the test code? It seems like we're removing some testing by changing this (REAL(kind_phys) -> real(kind=kind_phys)). Since both "REAL" upper-case and no "kind=" are still valid fortran (even if it doesn't comply with our coding style)
There was a problem hiding this comment.
This is a good point. I believe Codee has constructs that we can add to the code to prevent formatting certain sections. I'll look it up. If it works, I'll rather use that then excluding formatting of the entire file.
| if (.not. module_level_config) then | ||
| ! do nothing | ||
| return | ||
| if (.not.module_level_config) then |
There was a problem hiding this comment.
This is a total nit-pick and not something i noticed in the original codee PR, but are we sure we don't want a white space after ".not."?
There was a problem hiding this comment.
I am open to changing the formatting rules, but we should handle this in a separate issue/discussion?
| !> \section arg_table_temp_calc_adjust_register Argument Table | ||
| !! \htmlinclude arg_table_temp_calc_adjust_register.html | ||
| !! | ||
| subroutine temp_calc_adjust_register(dim_inter, errmsg, errflg) |
There was a problem hiding this comment.
similar concern about this case change resulting in a decrease of testing for our fortran parser.
| !! | ||
| integer, parameter :: ncols = 10 | ||
| integer, parameter :: pver = 5 | ||
| integer, parameter :: pverp = 6 |
There was a problem hiding this comment.
for completeness, i don't mind these case changes because the metadata has the upper-case version.
…st.F90 and test/capgen_test/temp_calc_adjust.F90 to test Fortran parser; try to prevent Codee from formatting these blocks
capgen_test. This is exercised withctestwithout any further changes, and it passes. I added a comparison of all averages to thecompare_datacall, which compares theomp1andomp2test runs. This is commit 900069b. While testing this, @peverwhee and I uncovered a bug (uninitialized variable, see Add threading test tocapgen_test; codee formattest/capgen_test/*.F90#722 (comment)) that I had to fix..github/workflows/fortran-formatting.yaml(there was an actual error using the workflow that needed to be fixed). This is commit a76f82ctest/capgen_test/*.F90. This is commit 24223ffUser interface changes?: No
Issues: Working toward #721
Testing: all pass
test removed: n/a
unit tests: n/a
system tests: existing capgen test now run with
OMP_NUM_THREADS=1andOMP_NUM_THREADS=2manual testing: tested manually on my dev machine with spack-stack-2.1.0