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

Fix xgrid reproducibility by using srcTermProcessing=0 for all xgrid FieldRegridStore calls #506

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

billsacks
Copy link
Member

Description of changes

Use srcTermProcessing=0 for all xgrid FieldRegridStore calls.

This is needed for bit-for-bit reproducibility. Most of the calls to FieldRegridStore weren't setting srcTermProcessing at all; this can lead to irreproducibility of the results. Two of the calls had srcTermProcessing set to 1 before, which leads to reproducibility but (according to Gerhard Theurich) is often worse for performance than a value of 0.

Note that we use a value of 0 in the calls in med_map_mod.

Specific notes

Contributors other than yourself, if any: Guidance from @oehmke and @theurich

CMEPS Issues Fixed (include github issue #): Resolves #505

Are changes expected to change answers? YES: roundoff-level differences expected for runs with aoflux_grid = "xgrid" (but those runs had expected roundoff-level differences from run to run before this fix anyway)

Any User Interface Changes (namelist or namelist defaults changes)? No

Testing performed

Please describe the tests along with the target model and machine(s)
If possible, please also added hashes that were used in the testing

In the context of cesm3_0_alpha03c, with the change here put on top of the change in #501, ran REP_Ld2.ne30pg3_t232.BLT1850.derecho_intel.allactive-xgrid, where the xgrid testmod contained:

include_user_mods:

../defaultio

user_nl_cpl:

aoflux_grid = "xgrid"

This is needed for bit-for-bit reproducibility. Most of the calls to
FieldRegridStore weren't setting srcTermProcessing at all; this can lead
to irreproducibility of the results. Two of the calls had
srcTermProcessing set to 1 before, which leads to reproducibility but
(according to Gerhard Theurich) is often worse for performance than a
value of 0.
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (trim(coupling_mode) == 'cesm') then
stp = 1
Copy link
Member Author

Choose a reason for hiding this comment

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

@jedwards4b - particularly note that I changed this value from 1 to 0 even for places where you were already setting srcTermProcessing. My sense is that you chose a value of 1 based on guidance from @oehmke (based on looking back at some email exchanges from last year), and in a conversation with @theurich and @oehmke yesterday they supported using 0 instead of 1. But let me know if you had reasons for choosing a value of 1 here that we should maintain. Note that we use a value of 0 in med_map_mod. According to @theurich, both 0 and 1 ensure bit-for-bit reproducibility, but he feels that 0 is probably better for performance in many cases.

@billsacks
Copy link
Member Author

I have run two additional REP tests (REP_Ld2.ne30pg3_t232.BLT1850.derecho_intel.allactive-xgrid) and verified that they pass as well, so I'm fairly confident that this fixes the reproducibility issue (at least for this configuration) (i.e., the original pass wasn't just by chance).

Copy link
Collaborator

@jedwards4b jedwards4b left a comment

Choose a reason for hiding this comment

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

Thanks!

@billsacks billsacks merged commit 842be8a into ESCOMP:main Sep 28, 2024
1 of 2 checks passed
@billsacks billsacks deleted the fix_xgrid_reproducibility branch September 28, 2024 14:45
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.

Runs with exchange grid give different results each time they're run
2 participants