Skip to content

src_compressible_stag: zero spatialCrossMF on the reset_stats restart path - #276

Merged
isriva merged 1 commit into
AMReX-FHD:mainfrom
isriva:fix-compstag-reset-stats-zero-spatialcross
Sep 22, 2026
Merged

isriva merged 1 commit into
AMReX-FHD:mainfrom
isriva:fix-compstag-reset-stats-zero-spatialcross

Conversation

@isriva

@isriva isriva commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

The reset_stats == 1 branch of ReadCheckPoint zeroed every statistics MultiFab
except spatialCrossMF, which was defined but never given a value;
MultiFab::define does not initialise memory. The non-restart path in
main_driver does call setVal(0.0) right after defining it, so only the restart
path was affected.

EvaluateSpatialCorrelations1D accumulates in place. statsCount is reset to 1 on
this path so the stale value is multiplied by zero, but 0 * NaN is NaN -- and
AMReX serves large allocations from a recycled arena, so the contents are
whatever the previous owner left rather than fresh zero pages. Results were
non-deterministic and could poison spatialCrossMF for the rest of the run and
into every subsequent checkpoint.

Zero it next to the define calls so both branches are covered.

… path

The reset_stats == 1 branch of ReadCheckPoint zeroed every statistics MultiFab
except spatialCrossMF, which was defined but never given a value;
MultiFab::define does not initialise memory.  The non-restart path in
main_driver does call setVal(0.0) right after defining it, so only the restart
path was affected.

EvaluateSpatialCorrelations1D accumulates in place.  statsCount is reset to 1 on
this path so the stale value is multiplied by zero, but 0 * NaN is NaN -- and
AMReX serves large allocations from a recycled arena, so the contents are
whatever the previous owner left rather than fresh zero pages.  Results were
non-deterministic and could poison spatialCrossMF for the rest of the run and
into every subsequent checkpoint.

Zero it next to the define calls so both branches are covered.
@isriva
isriva merged commit 39a23fd into AMReX-FHD:main Sep 22, 2026
18 checks passed
@isriva
isriva deleted the fix-compstag-reset-stats-zero-spatialcross branch September 22, 2026 19:54
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