Skip to content
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

Unit conversion bug in ccpp_prebuild.py: variables that are slices of a n+1 dimensional array have wrong allocation #598

Closed
climbfuji opened this issue Oct 9, 2024 · 1 comment · Fixed by #600
Assignees
Labels
bug ccpp_prebuild bugs, requests, etc. that involve ccpp_prebuild

Comments

@climbfuji
Copy link
Collaborator

climbfuji commented Oct 9, 2024

From #594 (comment)

@climbfuji @peverwhee I can confirm that this is an issue with Prebuild.

Here are snippets from a cap where I am calling two radiation schemes, first RRTMG w/o unit conversions, and then a second ML based radiation that requires unit conversions. Look at cld_ref_Lliq and tmpvar_1

Local declaration for unit-transfroms (2D)
Screenshot 2024-10-07 at 10 47 44 AM

Input to scheme A, no unit conversion:
Screenshot 2024-10-07 at 10 49 14 AM

Input to scheme B, unit conversion (wrong allocation)
Screenshot 2024-10-07 at 10 47 34 AM

@climbfuji climbfuji changed the title Oh. That's a different issue though than what is described above (https://github.com/NCAR/ccpp-framework/issues/594#issue-2557281057). It's still a bad bug but should probably have its own issue. Unit conversion bug in ccpp_prebuild.py: variables that are slices of a n+1 dimensional array have wrong allocation Oct 9, 2024
@climbfuji climbfuji self-assigned this Oct 9, 2024
@climbfuji climbfuji added the bug label Oct 9, 2024
@climbfuji
Copy link
Collaborator Author

climbfuji commented Oct 9, 2024

I have a simple reproducer that I am going to commit to the repo as a new test, hopefully together with a fix!

[ 45%] Building Fortran object CMakeFiles/ccpp_chunked_data.dir/ccpp_unit_conv_suite_unit_conv_group_cap.F90.o
/home/dom/prod/gcc-13.3.0-manual/bin/gfortran  -I/home/dom/prod/spack-stack-1.8.0/envs/ue-gcc-13.3.0/install/gcc/13.3.0/openmpi-5.0.3-jo5od3o/include -I/home/dom/prod/spack-stack-1.8.0/envs/ue-gcc-13.3.0/install/gcc/13.3.0/openmpi-5.0.3-jo5od3o/lib -O0 -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check -ggdb -fbacktrace -ffree-line-length-none -c /home/dom/work/ccpp/ccpp-framework-main-20241009-prebuild-unitconv-bugs/test_prebuild/test_unit_conv/build/ccpp_unit_conv_suite_unit_conv_group_cap.F90 -o CMakeFiles/ccpp_chunked_data.dir/ccpp_unit_conv_suite_unit_conv_group_cap.F90.o
/home/dom/work/ccpp/ccpp-framework-main-20241009-prebuild-unitconv-bugs/test_prebuild/test_unit_conv/build/ccpp_unit_conv_suite_unit_conv_group_cap.F90:176:25:

  176 |         allocate(tmpvar_1(one:ncols,2))
      |                         1
Error: Rank mismatch in array reference at (1) (2/1)
/home/dom/work/ccpp/ccpp-framework-main-20241009-prebuild-unitconv-bugs/test_prebuild/test_unit_conv/build/ccpp_unit_conv_suite_unit_conv_group_cap.F90:180:93:

  180 |       call unit_conv_scheme_2_run(errmsg=cdata%errmsg,errflg=cdata%errflg,data_array=tmpvar_1(one:ncols,2))
      |                                                                                             1
Error: Rank mismatch in array reference at (1) (2/1)
make[2]: *** [CMakeFiles/ccpp_chunked_data.dir/build.make:153: CMakeFiles/ccpp_chunked_data.dir/ccpp_unit_conv_suite_unit_conv_group_cap.F90.o] Error 1
make[2]: Leaving directory '/home/dom/work/ccpp/ccpp-framework-main-20241009-prebuild-unitconv-bugs/test_prebuild/test_unit_conv/build'
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/ccpp_chunked_data.dir/all] Error 2
make[1]: Leaving directory '/home/dom/work/ccpp/ccpp-framework-main-20241009-prebuild-unitconv-bugs/test_prebuild/test_unit_conv/build'
make: *** [Makefile:136: all] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment