fix data race in resetted_jump_problem, decorrelate jump/noise seeds#556
Merged
isaacsas merged 4 commits intoSciML:masterfrom Feb 23, 2026
Merged
fix data race in resetted_jump_problem, decorrelate jump/noise seeds#556isaacsas merged 4 commits intoSciML:masterfrom
isaacsas merged 4 commits intoSciML:masterfrom
Conversation
Remove dead randexp!(_jump_prob.rng, ...) blocks from resetted_jump_problem and reset_jump_problem! that caused a data race when called from multiple threads via EnsembleThreads. The jump_u values they wrote were unconditionally overwritten by VR_FRMEventCallback's initialize method. Add _derive_jump_seed to decorrelate the jump aggregator's seed from the noise process seed when StochasticDiffEq passes the same seed to both. Add test/ensemble_problems.jl covering serial stream uniqueness, sequential solve independence, threaded completion (no data race), seed-based stream independence, and VR_FRM jump_u threshold uniqueness. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Strengthens _derive_jump_seed by hashing the input seed with a fixed salt before passing through Xoshiro. This ensures decorrelation from the caller's seed regardless of the JumpProblem's stored RNG type. Co-Authored-By: Claude Opus 4.5 <[email protected]>
isaacsas
commented
Feb 23, 2026
Comment on lines
+73
to
+74
| const _JUMP_SEED_SALT = 0x4a756d7050726f63 # "JumPProc" in ASCII | ||
| _derive_jump_seed(seed) = rand(Random.Xoshiro(hash(seed, _JUMP_SEED_SALT)), UInt64) |
Member
Author
There was a problem hiding this comment.
@ChrisRackauckas I'm not sure what the best approach to take here is. The problem is we don't want to just use Xoshiro(seed) as that will sample from the same stream that StochasticDiffEq is using (currently, this will all go away when we get the rng updates here too, but I'd like something right now we can have here for a non-breaking release fix).
Member
Author
There was a problem hiding this comment.
My impression is the Xoshiro seeding should be quite good at mixing, so I'm hoping this is reasonable...
Co-Authored-By: Claude Opus 4.5 <[email protected]>
…mport The variable_rate.jl test was checking prob.u0.jump_u, but VR_FRM's callback initialize sets integrator.u.jump_u (a copy). Updated the test to use init() and check the integrator's jump_u values directly. Also removed the stale randexp! import that was flagged by ExplicitImports. Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.
Remove dead randexp!(_jump_prob.rng, ...) blocks from resetted_jump_problem and reset_jump_problem! that caused a data race when called from multiple threads via EnsembleThreads. The jump_u values they wrote were unconditionally overwritten anyways by VR_FRMEventCallback's initialize method.
Add _derive_jump_seed to decorrelate the jump aggregator's seed from the noise process seed when StochasticDiffEq passes the same seed to both.
Add test/ensemble_problems.jl covering serial stream uniqueness, sequential solve independence, threaded completion (no data race), seed-based stream independence, and VR_FRM jump_u threshold uniqueness.