Honor ran_seed in deterministic runs#476
Merged
Merged
Conversation
Fixes #464 ## Risk tier - [ ] T0: docs, comments, small build metadata - [ ] T1: pure refactor, no behavior change intended - [ ] T2: local numerical logic - [x] T3: physics, output behavior, coordinate convention - [ ] T4: parallelism, GPU, dependency, CI, or security-sensitive build logic ## Correctness contract ### Intended behavior change `ran_seed` controls the Fortran random stream when `deterministic=.true.`. Equal seeds reproduce the stream; different seeds change it. ### Behavior that must not change Orbit equations, integrators, field evaluation, loss criteria, parallel dispatch, and deterministic replay for an explicitly fixed seed are unchanged. ### Coordinate / unit conventions No coordinate, unit, boundary, or symmetry convention changes. ### Numerical invariants Only sampled initial conditions may change. The historical NetCDF fixture now explicitly requests seed 42. The chartmap pipeline keeps its existing calculations, assertions, and plots. ## Tests added - unit: namelist-level deterministic seed regression - integration: existing NetCDF orbit output, verification, and plot tests - system: full `fo` pipeline - golden record: not regenerated ## Golden-record impact - [x] unchanged - [ ] changed ## Failure modes considered Same-seed non-reproducibility, ignored distinct seeds, invalid orbit fixture sample, and plot-enabled chartmap runtime exceeding its former 60 s timeout. ## Manual validation The NetCDF fixture passes with its historical seed 42. The plot-enabled chartmap pipeline passes in 59.71 s with a 120 s timeout. ## Verification ### Test fails on main ```text fo test test_deterministic_seed ERROR STOP different ran_seed values produce the same random stream Summary: 0 passed, 1 failed ``` ### Test passes after fix ```text fo test test_deterministic_seed test_deterministic_seed PASS 0.06s Summary: 1 passed, 0 failed, 0 skipped fo Static: OK Build: OK Tests: OK Lint: OK All stages passed ```
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.
Re-lands #452 on
main. That pull request was squash-merged into its stackedbase
fix/ci-slow-test-gates(#454), somainnever received the fix. Thisbranch cherry-picks the squash commit
d8506f9onto currentmain(
3cfba79); it applied without conflicts.Deterministic runs ignored
ran_seedand always produced the default stream,so distinct seeds could not generate independent particle sets.
params.f90now forwards the configured seed,
test_deterministic_seed.f90checks thatdistinct seeds change the stream while the default seed reproduces the
previous one, and the orbit-output example input records the seed it uses.
Verification
Test fails on main
src/params.f90reverted toorigin/main, test kept:Test passes after fix
fo buildandfo lintpass on the branch (no new warnings; 0 unusedimports).