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

Potential issue with Where statements in debug mode #1614

Open
JosephMouallem opened this issue Nov 19, 2024 · 1 comment
Open

Potential issue with Where statements in debug mode #1614

JosephMouallem opened this issue Nov 19, 2024 · 1 comment

Comments

@JosephMouallem
Copy link

Hi all,

I am encountering issues with where statements when running SHiELD/MOM6 in debug mode.
For example, the model performs a division by zero and crashes in xgrid.F90 when computing the inverse area, where grid%area>0 so not sure how the division by zero is happening in this context:

FMS/exchange/xgrid.F90

Lines 1973 to 1976 in 23df6d7

if(grid%on_this_pe) then
grid%area_inv = 0.0_r8_kind;
where (grid%area>0.0_r8_kind) grid%area_inv = 1.0_r8_kind/grid%area
endif

A similar issue arises in the monin obukhov routine:

where (mask_1)
rzeta = 1.0_lkind/zeta
zeta_0 = zeta/z_z0
zeta_t = zeta/z_zt
zeta_q = zeta/z_zq
end where

I am using the standard SHiELD template and compile flags: https://github.com/NOAA-GFDL/SHiELD_build/blob/main/site/intel.mk.

These issues are specific to DEBUG mode; everything works fine when compiling in REPRO mode.

@bensonr
Copy link
Contributor

bensonr commented Nov 25, 2024

There are some nuances with respect to where statements and the order things are evaluated leading to FPEs when you would expect to be protected against them. Whether you hit them or not is completely up to how the compiler is implemented.

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

No branches or pull requests

2 participants