Skip to content

Remove the decomposition-dependent reprosum "recompute" fallback - fixes Nag subcol test - #1702

Closed
jimmielin wants to merge 2 commits into
ESCOMP:cam_developmentfrom
jimmielin:hplin/subcol_fix
Closed

jimmielin wants to merge 2 commits into
ESCOMP:cam_developmentfrom
jimmielin:hplin/subcol_fix

Conversation

@jimmielin

Copy link
Copy Markdown
Collaborator

Fixes #1514

Courtesy of Claude Fable 5.1.

It fixes the subcol restart rest but there is a one-time answer change for the physics load-balancing test as it is replaced by the exact (reproducible) sum rather than the old plain sum which is order-dependent:

  PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal0 (Overall: DIFF) details:
    FAIL PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal0 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_206_gnu: DIFF
  PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal1 (Overall: DIFF) details:
    FAIL PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal1 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_206_gnu: DIFF
  PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal3 (Overall: DIFF) details:
    FAIL PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal3 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_206_gnu: DIFF

shr_reprosum_calc returns the exact, correctly rounded sum of its inputs,
independent of the MPI decomposition. When reprosum_diffmax >= 0 it also
forms a plain floating point sum and shr_reprosum_tolExceeded warns if the
two differ by more than the tolerance. Five CAM call sites (the FV pole
averages in d2a3dikj and p_d_adjust, par_xsum, gmeanxy in mean_module, and
gmean_mod) treated that warning as a failure of the reproducible sum and,
with reprosum_recompute = .true., replaced it with a plain sequential sum
("old method"), or in gmean_mod aborted the run.

The plain sums are the inaccurate operand in that comparison, and both they
and the check itself depend on the decomposition. CAM's ERC test runs its
restart leg on half the tasks, so the check could trip on one leg only and
the fallback then injected a decomposition-dependent value. This is the
cause of the ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-outfrq3s_subcol
COMPARE_base_rest failure (ESCOMP/CAM issue ESCOMP#1514): the testmod sets
reprosum_diffmax = 1.0e-14 and reprosum_recompute = .true., the South Pole
wind average in d2a3dikj tripped only on the 12-task leg, and the pole-row
U/V then differed by one ulp. Subcolumns and the NAG compiler play no role.

Keep the warning (same pattern as fv_prints), drop every use of
shr_reprosum_recompute in CAM together with the duplicated fallback code
and gmean_float_norepro, and fix the "Nouth Pole" labels.

Answer impact: bit-for-bit with default settings (reprosum_diffmax < 0
disables the check, so the removed code never ran). Only runs that set
reprosum_diffmax >= 0 and reprosum_recompute = .true. can change, and only
at steps where the fallback fired; such events are visible as "exceeds
tolerance" messages in the baseline logs.

Assisted-by: claude-fable:5.1
@jimmielin jimmielin added bug-fix This PR was created to fix a specific bug. misc tag issue or PR candidate for upcoming misc tag labels Oct 5, 2026
@peverwhee

Copy link
Copy Markdown
Collaborator

@billsacks

Claude found a fix for one of our tests that appeared after the shr_reprosum_calc refactor. Would you mind taking a look at this implementation?

@billsacks

Copy link
Copy Markdown
Member

Sorry, I'm not familiar enough with this aspect of the shr_reprosum code to be able to review this: I haven't used this feature of checking against the tolerance.

@peverwhee

Copy link
Copy Markdown
Collaborator

@billsacks no problem! I'll ask around.

@fvitt

fvitt commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

The test passes reprosum_* options removed from user_nl_cpl.
shr_reprosum_calc normally computes global sums with a reproducible integer (fixed-point) algorithm. If reprosum_diffmax >= 0, the code also computes a fast sum the ordinary floating-point way, which is not reproducible.

I propose we simply remove the reprosum_* namelist settings from user_nl_cpl in cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/user_nl_cpl.

@jimmielin
jimmielin marked this pull request as draft October 6, 2026 20:27
@peverwhee

Copy link
Copy Markdown
Collaborator

Thanks for looking into this @fvitt !

The subcolumn test stops failing due to the externals update, so I'll be closing this PR and #1514 with the externals update PR. (#1710)

We can always reopen this if we need to revisit it.

@jimmielin

Copy link
Copy Markdown
Collaborator Author

closed as fixed in beta10 externals. Thanks @peverwhee !

@jimmielin jimmielin closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix This PR was created to fix a specific bug. misc tag issue or PR candidate for upcoming misc tag

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants