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

Main to dev/gfdl 2024-02-28 #571

Merged
merged 16 commits into from
Feb 28, 2024
Merged

Main to dev/gfdl 2024-02-28 #571

merged 16 commits into from
Feb 28, 2024

Conversation

marshallward
Copy link
Member

@marshallward marshallward commented Feb 28, 2024

Update from main branch.

DO NOT MERGE, this is for record keeping. It will be updated by command line.

DeniseWorthen and others added 16 commits September 14, 2023 11:03
* two fields remain unresolved, sea_level and mass_overlying_ice
switch to cesm-style field names in MOM6 cap
…1031

update MOM6 to its main repo 20231025 (NCAR candidate) and 20231031(GMAO FMS_cap) updating
The most recent NCAR -> GFDL merge created an error (courtesy of myself)
which left the CFC concentration units in the post_data call, even
though these are now handled at registration.

This patch restores this expression and removes the unit conversion from
post_data.
update MOM6 to its main 20231218 commit (disable FPEs)
- add restart_fh config variable and define restartfhtimes to
enable restarts on non-interval hours
- write info to stdout for documenting when additional restarts
will or will not be written
Add non-interval restart capability
This patch modifies select calculations of PR#1616 in order to preserve bit
reproducibility when FMA optimization is enabled.  We add parentheses and
reorder terms in selected expressions which either direct or suppress FMAs,
ensuring equivalence with the previous release.

We address two specific equations in the PR.  The first is associated
with vertical friction coupling coupling coefficient.  The diff is shown
below.

-  a_cpl(i,K) = Kv_tot(i,K) / (h_shear*GV%H_to_Z + I_amax*Kv_tot(i,K))
+  a_cpl(i,K) = Kv_tot(i,K) / (h_shear + I_amax*Kv_tot(i,K))

The denominator is of the form `a*b + c*d`.  A compiler may favor an FMA
of the form `a*b + (c*d)`.  However, the modified equation is of form
which favors the `a + c*d` FMA.  Each form gives different results in
the final bits.

We resolve this by expliciting wrapping the RHS in parentheses:

  a_cpl(i,K) = Kv_tot(i,K) / (h_shear + (I_amax*Kv_tot(i,K)))

Although this disables the FMA, it produces the same bit-equivalent
answer as the original expression.

----

The second equation for TKE due to kappa shear is shown below.

-  tke_src = dz_Int(K) *(((kappa(K) + kappa0)*S2(K) - kappa(k)*N2(K)) - &
-                              (TKE(k) - q0)*TKE_decay(k)) - &
+  tke_src = h_Int(K) * (dz_h_Int(K)*((kappa(K) + kappa0)*S2(K) - kappa(k)*N2(K)) - &
+                              (TKE(k) - q0)*TKE_decay(k)) - &
    ...

The outer equation was of the form `b + c` but is promoted to `a*b + c`,
transforming it to an FMA.

We resolve this by suppressing this FMA optimization:

  tke_src = h_Int(K) * ((dz_h_Int(K) * ((kappa(K) + kappa0)*S2(K) - kappa(k)*N2(K))) - &
                         (TKE(k) - q0)*TKE_decay(k)) - &
        ...

----

The following two changes are intended to be the smallest modification
which preserves answers for known testing on target compilers.  It does
not encompass all equation changes in this PR.  If needed, we could
extend these changes to similar modifications of PR#1616.

We do not expect to support bit reproducibility when FMAs are enabled.
But this is an ongoing conversation, and the rules around FMAs should be
expected to change as we learn more and agree on rules of
reproducibility.
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 27.44648% with 1898 lines in your changes are missing coverage. Please review.

Project coverage is 39.00%. Comparing base (4e8fbe1) to head (2ab885e).
Report is 41 commits behind head on dev/gfdl.

Files Patch % Lines
src/parameterizations/lateral/MOM_Zanna_Bolton.F90 1.07% 277 Missing ⚠️
...c/parameterizations/lateral/MOM_internal_tides.F90 0.00% 237 Missing ⚠️
src/diagnostics/MOM_wave_speed.F90 20.93% 193 Missing and 11 partials ⚠️
src/core/MOM_interface_heights.F90 13.72% 130 Missing and 2 partials ⚠️
src/core/MOM_forcing_type.F90 18.04% 99 Missing and 10 partials ⚠️
src/core/MOM.F90 56.65% 57 Missing and 31 partials ⚠️
src/ice_shelf/MOM_ice_shelf.F90 0.00% 75 Missing ⚠️
src/core/MOM_barotropic.F90 56.75% 46 Missing and 18 partials ⚠️
src/core/MOM_open_boundary.F90 33.33% 53 Missing and 7 partials ⚠️
src/ALE/MOM_ALE.F90 40.65% 45 Missing and 9 partials ⚠️
... and 41 more
Additional details and impacted files
@@             Coverage Diff              @@
##           dev/gfdl     #571      +/-   ##
============================================
+ Coverage     37.45%   39.00%   +1.54%     
============================================
  Files           270      272       +2     
  Lines         79625    90534   +10909     
  Branches      14824    17787    +2963     
============================================
+ Hits          29826    35311    +5485     
- Misses        44251    49089    +4838     
- Partials       5548     6134     +586     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marshallward marshallward merged commit e69d771 into dev/gfdl Feb 28, 2024
28 checks passed
@marshallward
Copy link
Member Author

Gaea regression: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/22477 ✔️

This has now been merged.

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

Successfully merging this pull request may close these issues.

4 participants