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

MOM6:(*)+Reproducing tracer stocks #73

Merged

Conversation

Hallberg-NOAA
Copy link
Member

Use reproducing sums to obtain tracer stocks that are invariant to PE layout
for all tracer packages, and corrected the mean temperature reported to stdout
when DEBUG_CONSERVATION=True, so that it now really does give the mean. All
solutions are bitwise identical, but the output does change.

The commits in this PR include:

  • f996d0919 (*)+Use reproducing stocks for all tracer packages
  • 9b2debdec (*)+Reproducing tracer stocks
  • 656a37285 Use global_mass_integral in lateral_bdry_diff
  • 4dc1fd32c +Add global_mass_int_EFP
  • 8e2e73e45 Report mean temperature from MOM_state_stats()

  Actually calculate the mean temperature and salinity reported by
MOM_state_stats().  Due to an oversight, these means were always being reported
as 0.  This changes the output when the debugging flag DEBUG_CONSERVATION=True.
All answers are bitwise identical.
  Added the new function global_mass_int_EFP(), which is analogous to
global_mass_integral but returns its result in extended fixed point (EFP_type)
format and always uses reproducing sums, to facilitate layout-invariant
global integrals but with the potential for deferred global reductions so that
this last step can be combined for various global reductions for efficiency.
All answers are bitwise identical, but there is a new public interface.
  Use global_mass_integral for the debugging diagnostics of the tracer amounts
before and after diffusion in lateral_boundary_diffusion, and replaced a call to
write(*,*) with a call to MOM_mesg to actually write the message.  The
global_mass_integral uses reproducing sums, and is invariant to layout, while
MOM_mesg is preferable for output because it will allow us to more cleanly
control how output is handled and which processors do the writing.  All
solutions are bitwise identical, although some debugging output will change.
  Use reproducing sums for tabulating tracer stocks, and move the global sum for
the tracer stocks form write_energy into call_tracer_stocks.  This involves
changes to the type of an argument (from real to EFP_type) for two arguments to
the internal routine store_stocks.  Existing tracer stock packages will still
work, but to benefit from the reproducing sums, they will also have to change
their reported values from real to EFP_type.  This is demonstrated for two
packages (advection_test_tracer and ideal_age_example), where the stocks are now
found with calls to global_mass_int_EFP(), replacing the previous explicit
sums.  With this change, the reported stock values from these packages are
identical for different PE layouts and can be much more accurate than before,
but they are different from the previously reported values at roundoff (for
positive-definite tracers), but it could be larger for tracers with a near-zero
mean value.  All solutions are bitwise identical, but output changes.
  Modified the remaining tracer packages to use the reproducing stocks.  The
reported stock values from these packages will have changed slightly, but they
now reproduce across PE layouts.  All solutions are bitwise identical, but
output changes.
@Hallberg-NOAA
Copy link
Member Author

Each of the commits here is significant and was carefully tested. Please do not do a squash merge on this PR.

@codecov
Copy link

codecov bot commented Feb 21, 2022

Codecov Report

Merging #73 (418bc66) into dev/gfdl (2e72b88) will increase coverage by 0.03%.
The diff coverage is 18.42%.

Impacted file tree graph

@@             Coverage Diff              @@
##           dev/gfdl      #73      +/-   ##
============================================
+ Coverage     29.00%   29.03%   +0.03%     
============================================
  Files           244      244              
  Lines         71921    71865      -56     
============================================
+ Hits          20861    20869       +8     
+ Misses        51060    50996      -64     
Impacted Files Coverage Δ
src/core/MOM_checksum_packages.F90 30.82% <0.00%> (-0.48%) ⬇️
src/diagnostics/MOM_sum_output.F90 62.56% <ø> (-0.07%) ⬇️
src/tracer/MOM_CFC_cap.F90 20.72% <0.00%> (+1.02%) ⬆️
src/tracer/MOM_OCMIP2_CFC.F90 0.00% <0.00%> (ø)
src/tracer/MOM_generic_tracer.F90 0.00% <0.00%> (ø)
src/tracer/MOM_lateral_boundary_diffusion.F90 56.73% <0.00%> (+1.02%) ⬆️
src/tracer/advection_test_tracer.F90 0.00% <0.00%> (ø)
src/tracer/boundary_impulse_tracer.F90 0.00% <0.00%> (ø)
src/tracer/dye_example.F90 0.00% <0.00%> (ø)
src/tracer/ideal_age_example.F90 44.59% <0.00%> (-0.51%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e72b88...418bc66. Read the comment docs.

  Removed trailing white space on two lines.  All answers are bitwise identical.
Copy link
Member

@marshallward marshallward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR makes improvements to global integration of tracers by computing them in MKS units (rather than rescaled dimensions), and replaces instances of sum() with reproducible sums. Some of this management is done via a new EFP_type.

The reproducible sums are a clear improvement, although contributors may need to take note of the use of EFP_type.

@marshallward
Copy link
Member

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

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.

2 participants