Skip to content

Add ode integrator rng#3064

Merged
ChrisRackauckas merged 3 commits into
SciML:masterfrom
isaacsas:add-ode-integrator-rng
Feb 22, 2026
Merged

Add ode integrator rng#3064
ChrisRackauckas merged 3 commits into
SciML:masterfrom
isaacsas:add-ode-integrator-rng

Conversation

@isaacsas

@isaacsas isaacsas commented Feb 21, 2026

Copy link
Copy Markdown
Member

Needs SciML/SciMLBase.jl#1240 and a SciMLBase release before merging.

Implement Phase 1 Step 2 of the SciML RNG design: add an rng::RNGType field to ODEIntegrator so callbacks can access a per-integrator RNG via get_rng(integrator).

  • Add RNGType type parameter and rng field to ODEIntegrator struct
  • Implement has_rng, get_rng, set_rng! for ODEIntegrator
  • Accept rng kwarg in __init (defaults to Random.default_rng())
  • Accept rng kwarg in reinit!, applied before callback initialization
  • Add Random as a runtime dependency of OrdinaryDiffEqCore
  • Add set_rng! type check with clear ArgumentError on mismatch
  • Add comprehensive tests including StableRNG reproducibility checks

isaacsas and others added 2 commits February 21, 2026 09:20
Implement Phase 1 Step 2 of the SciML RNG design: add an `rng::RNGType`
field to `ODEIntegrator` so callbacks (e.g. JumpProcesses aggregations)
can access a per-integrator RNG via `get_rng(integrator)`.

- Add `RNGType` type parameter and `rng` field to ODEIntegrator struct
- Implement `has_rng`, `get_rng`, `set_rng!` for ODEIntegrator
- Accept `rng` kwarg in `__init` (defaults to `Random.default_rng()`)
- Accept `rng` kwarg in `reinit!`, applied before callback initialization
- Add `Random` as a runtime dependency of OrdinaryDiffEqCore
- Add `set_rng!` type check with clear ArgumentError on mismatch
- Add comprehensive tests including StableRNG reproducibility checks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move has_rng/get_rng/set_rng! implementations to group with other
SciMLBase interface methods (has_reinit/reinit!) for consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comment thread lib/OrdinaryDiffEqCore/src/solve.jl
@isaacsas isaacsas closed this Feb 22, 2026
@isaacsas isaacsas reopened this Feb 22, 2026
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@isaacsas

Copy link
Copy Markdown
Member Author

@ChrisRackauckas this should be done if the tests pass now. The 1.10 integrator II failure is expected due to how sources work.

@ChrisRackauckas

Copy link
Copy Markdown
Member

Yes, and Rosenbrock because of a functionwrapping bug I was working through this morning in #3069 when it expanded to mass matrices. So if it's just that then we should be good to go.

@ChrisRackauckas

Copy link
Copy Markdown
Member

I'll merge and rebase on this

@ChrisRackauckas ChrisRackauckas merged commit 1ccc77a into SciML:master Feb 22, 2026
257 of 275 checks passed
@isaacsas

Copy link
Copy Markdown
Member Author

Thanks! I'll move on to StochasticDiffEq next. Now it will start getting a bit messier due to the coupling with JumpProcesses, so that may require a StochasticDiffEq update, then JumpProcesses, then another StochasticDiffEq to get everything in the right shape.

@isaacsas isaacsas deleted the add-ode-integrator-rng branch February 22, 2026 14:32
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.

2 participants