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

Uninitialized variables in module_mp_thompson.F90 #891

Closed
SamuelTrahanNOAA opened this issue Apr 1, 2022 · 2 comments
Closed

Uninitialized variables in module_mp_thompson.F90 #891

SamuelTrahanNOAA opened this issue Apr 1, 2022 · 2 comments
Labels

Comments

@SamuelTrahanNOAA
Copy link
Collaborator

SamuelTrahanNOAA commented Apr 1, 2022

Description

In module_mp_thompson.F90, the min_rand variable is used but never uninitialized. If you initialize min_rand=0, the scheme passes that point, but fails later due to a temperature of 4.821964740593585E+036. That likely indicates uninitialized memory or out-of-bounds array access elsewhere.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

You can see this plainly in the source code, but if you want the Intel compiler to tell you, do this.

  1. In the ufs-weather-model tests/ directory, make a conf file with this:
COMPILE | -DAPP=ATM -DDEBUG=ON  -DCCPP_SUITES=FV3_RAP,FV3_RAP_sfcdiff,FV3_HRRR,FV3_RRFS_v1beta,FV3_RRFS_v1nssl -D32BIT=ON                     |                                         | fv3 |

RUN     | regional_spp_sppt_shum_skeb                                                                                             |                                         | fv3 |
  1. Run that regression test.
  2. Witness the stack trace on Hera using the Intel compiler.
  3. Initialize the min_rand to 0
  4. Rerun the regression test
  5. The test passes that point, but fails later due to a temperature of 4.821964740593585E+036.

Output

If you run the regression test as described above, you'll see this:

 35: forrtl: error (182): floating invalid - possible uninitialized real/complex variable.
 35: Image              PC                Routine            Line        Source             
 35: fv3.exe            000000000AE8A8EE  Unknown               Unknown  Unknown
 35: libpthread-2.17.s  00002B05702DE630  Unknown               Unknown  Unknown
 35: fv3.exe            0000000009416FD7  module_mp_thompso        1295  module_mp_thompson.F90
 35: fv3.exe            0000000009754A84  mp_thompson_mp_mp         635  mp_thompson.F90
 35: fv3.exe            00000000071CA248  ccpp_fv3_hrrr_phy       12648  ccpp_FV3_HRRR_physics_cap.F90
 35: fv3.exe            0000000006B44C37  ccpp_static_api_m         662  ccpp_static_api.F90
 35: fv3.exe            0000000006B37E60  ccpp_driver_mp_cc         188  CCPP_driver.F90
 35: libiomp5.so        00002B056E9EEA43  __kmp_invoke_micr     Unknown  Unknown
 35: libiomp5.so        00002B056E9B1CDA  Unknown               Unknown  Unknown
 35: libiomp5.so        00002B056E9B35B6  __kmp_fork_call       Unknown  Unknown

The error is here:

         if (rand_perturb_on .ne. 0) then
            if (MOD(rand_perturb_on,2) .ne. 0) rand1 = rand_pert(i,1)
            m = RSHIFT(ABS(rand_perturb_on),1)
            if (MOD(m,2) .ne. 0) rand2 = rand_pert(i,1)*2.
            m = RSHIFT(ABS(rand_perturb_on),2)
      ==>   if (MOD(m,2) .ne. 0) rand3 = 0.25*(rand_pert(i,1)+ABS(min_rand))  <==
            m = RSHIFT(ABS(rand_perturb_on),3)
         endif
@SamuelTrahanNOAA
Copy link
Collaborator Author

I have submitted a PR with a temporary solution to avoid this broken code holding up other development: remove the regression test.

ufs-community/ufs-weather-model#1151

@ligiabernardet
Copy link
Collaborator

Can this issue be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants