Add first-divergence diagnostics for particle-track comparisons - #4120
Open
JROChub wants to merge 1 commit into
Open
Add first-divergence diagnostics for particle-track comparisons#4120JROChub wants to merge 1 commit into
JROChub wants to merge 1 commit into
Conversation
Compare recorded histories through the existing Tracks reader, with exact floating-point bits and finite-value ULP distances. Align numeric history identifiers and report particle/state structure separately from values. Validate HDF5 schemas and offsets before reading particle segments, retain track 3.0 and 3.1 compatibility, and distinguish invalid input from mismatch. Add focused tests and developer usage documentation without changing transport or its random-number stream.
Contributor
Author
|
@jtramm, could you review this recorded-track comparison interface as a first diagnostic contribution for #3820? It reports exact state differences without changing transport or RNG consumption. I would particularly appreciate your feedback on the report format and which remaining fixed-source macOS failure would be most useful as the first reproducer. Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a developer CLI that uses
openmc.Tracksto identify the first exact difference between two recorded particle histories.The JSON report distinguishes a match, a mismatch, and invalid input, with exit codes 0, 1, and 2. Histories are aligned by numeric
(batch, generation, particle number)identifiers. Within each history, the comparison reports the first differing particle track, recorded state, and field, including binary64 bit patterns and finite-value ULP distances. Missing histories and particle/state count differences are reported separately.The tool validates schemas, particle counts, and offsets before the existing reader slices the data. It supports both track format 3.0's legacy particle indices and format 3.1's PDG numbers. Comparison excludes HDF5 padding, byte order, and incidental metadata. Signed zeros and NaN payloads are compared exactly.
This is the diagnostic portion of the proposal on #3820. Transport, RNG consumption, the mathematical backend, and the default execution path are unchanged. The documentation explains explicit history selection, secondary-track ordinals, and the distinction between the first differing recorded state and its causative numerical operation.
Related to #3820.
Validation
git diff --checkpassed.5260b9a0fc51f3f312024c425a5c1c227f8ba555(GCC 15.2.0, strict FP enabled):112 passed in 19.49s.Run the focused tests in an OpenMC development environment:
These tests create self-contained HDF5 records and do not require nuclear cross-section downloads. OpenMC's generic test-session warning about an unset
OPENMC_CROSS_SECTIONSvariable remains visible.The benchmark that reproduces the Linux/macOS difference and the optional math-backend approach are being discussed separately on #3820. This contribution provides the comparison tool for that investigation; it does not introduce a cross-platform math correction.
Checklist