Skip to content

src_compressible_stag: reduce data_xcross across ranks in the all_correl branch - #266

Merged
isriva merged 1 commit into
AMReX-FHD:mainfrom
isriva:fix-compstag-all-correl-reduction
Sep 22, 2026
Merged

isriva merged 1 commit into
AMReX-FHD:mainfrom
isriva:fix-compstag-all-correl-reduction

Conversation

@isriva

@isriva isriva commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

evaluateStatsStag1D has two paths for gathering the cross-cell pencil data. The
all_correl == 0 path reduces data_xcross across ranks before using it; the
all_correl == 1 path did not.

GetPencilCross assigns into the flat buffer only for cells where i == x_star, so
each rank touches only the (j,k) slots of boxes it owns that contain that plane.
Without the reduction every other rank saw zeros, and
EvaluateSpatialCorrelations1D divides by those entries (1.0/cvcross,
1.0/(meanrhocross*meanrho)), producing inf/NaN rather than merely wrong numbers.

The buffer was also constructed once outside the loop over the five x* values
and never re-zeroed, so iterations 1-4 additionally inherited stale entries from
the previous x*. Moving the declaration inside the loop fixes both.

…rel branch

evaluateStatsStag1D has two paths for gathering the cross-cell pencil data.  The
all_correl == 0 path reduces data_xcross across ranks before using it; the
all_correl == 1 path did not.

GetPencilCross assigns into the flat buffer only for cells where i == x_star, so
each rank touches only the (j,k) slots of boxes it owns that contain that plane.
Without the reduction every other rank saw zeros, and
EvaluateSpatialCorrelations1D divides by those entries (1.0/cvcross,
1.0/(meanrhocross*meanrho)), producing inf/NaN rather than merely wrong numbers.

The buffer was also constructed once outside the loop over the five x* values
and never re-zeroed, so iterations 1-4 additionally inherited stale entries from
the previous x*.  Moving the declaration inside the loop fixes both.
@isriva
isriva merged commit ce73217 into AMReX-FHD:main Sep 22, 2026
18 checks passed
@isriva
isriva deleted the fix-compstag-all-correl-reduction branch September 22, 2026 19:57
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.

1 participant