From 1b056357eb9a9d7824d6843519de69678da0af0c Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 10 Nov 2026 21:37:39 -0500 Subject: [PATCH 1/2] Release 10.2.0 Name the Unreleased HISTORY section 10.2.0, add the missing entry for #675 (matrix rates of SpatialMassActionJump scaled for every reaction), and say explicitly that StochasticDiffEq's off-thread copies of a jump problem now share `p`, the stored callbacks and a user noise process with it. Co-Authored-By: Claude Opus 5.5 --- HISTORY.md | 12 ++++++++++-- Project.toml | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 4ebaff1ea..a7bb05b8e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,16 +1,24 @@ # Breaking updates and feature summaries across releases -## Unreleased +## 10.2.0 - New `isolated_copy(jprob)` returns a `JumpProblem` with its own jump state, for concurrent solves and for integrators that are alive at the same time. It copies only the jump aggregator's working data and rebuilds the jump callbacks around it, sharing everything else, including the wrapped problem, the jumps and the stored callbacks, so it is much cheaper than `deepcopy`, especially for problems built with ModelingToolkit or Catalyst. StochasticDiffEq's copies of the jump state (`alias_jumps = false`, the - default off thread 1) now use it. The docs no longer recommend `deepcopy`, which + default off thread 1) now use it, so these copies share `p`, the stored callbacks and a + noise process passed to the `SDEProblem` with the original problem, where they used to + be deep copies. Ensembles are unaffected, since they copy the problem for each task + first; to solve one problem from several threads, give each its own copy, and its own + `p` with `remake` if callbacks modify it. The docs no longer recommend `deepcopy`, which copies `p`, `u0` and the stored callbacks too, but with `FunctionWrapper`-based aggregators can call the original problem's rate and affect functions and needs the original kept alive. + - `SpatialMassActionJump`s with site-dependent rates (a matrix) and `scale_rates = true`, + the default, now divide the rates of every reaction by the factorials of its reactant + stoichiometry. Only the last reaction was scaled, so the others with a stoichiometric + coefficient above one fired too often, for example `2A → ∅` twice as often. - `VR_Direct` and `VR_DirectFW` no longer also simulate the bounded `VariableRateJump`s that `Coevolve` handles. In problems with both bounded and general `VariableRateJump`s, those bounded jumps fired twice as often. diff --git a/Project.toml b/Project.toml index 29da40edc..019c0088d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "JumpProcesses" uuid = "ccbc3e58-028d-4f4c-8cd5-9ae44345cda5" authors = ["Chris Rackauckas "] -version = "10.1.1" +version = "10.2.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" From 903e14874b1ffa4c8b90d9e6e6a7e834c647388d Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 10 Nov 2026 23:46:45 -0500 Subject: [PATCH 2/2] Say how to share a supplied SDE noise process safely across threads StochasticDiffEq writes each solve's noise path back into `prob.noise` unless `solve` is given `alias_noise = false`. The isolated_copy docstring and the 10.2.0 HISTORY entry now give that keyword as the way to solve copies of a jump problem whose SDEProblem has a noise process from several threads. Co-Authored-By: Claude Opus 5.5 --- HISTORY.md | 12 +++++++----- src/isolated_copy.jl | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index a7bb05b8e..88e1fe9de 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -10,11 +10,13 @@ default off thread 1) now use it, so these copies share `p`, the stored callbacks and a noise process passed to the `SDEProblem` with the original problem, where they used to be deep copies. Ensembles are unaffected, since they copy the problem for each task - first; to solve one problem from several threads, give each its own copy, and its own - `p` with `remake` if callbacks modify it. The docs no longer recommend `deepcopy`, which - copies `p`, `u0` and the stored callbacks too, but with `FunctionWrapper`-based - aggregators can call the original problem's rate and affect functions and needs the - original kept alive. + first. To solve one problem from several threads, give each thread its own + `isolated_copy`, with its own `p` (through `remake`) if callbacks modify it, and pass + `alias_noise = false` to `solve` if the `SDEProblem` has a noise process: + StochasticDiffEq otherwise writes each solve's noise path back into it, as it does for + any `SDEProblem`. The docs no longer recommend `deepcopy`, which copies `p`, `u0` and + the stored callbacks too, but with `FunctionWrapper`-based aggregators can call the + original problem's rate and affect functions and needs the original kept alive. - `SpatialMassActionJump`s with site-dependent rates (a matrix) and `scale_rates = true`, the default, now divide the rates of every reaction by the factorials of its reactant stoichiometry. Only the last reaction was scaled, so the others with a stoichiometric diff --git a/src/isolated_copy.jl b/src/isolated_copy.jl index 7307da620..55ef3cb9e 100644 --- a/src/isolated_copy.jl +++ b/src/isolated_copy.jl @@ -90,8 +90,9 @@ not take one while another thread is solving `jprob`. - State captured by rate, affect or callback functions. Pass callbacks with such state to `init` or `solve` instead of storing them in the problem. - A noise process passed to an `SDEProblem` with `noise`. StochasticDiffEq copies each - solve's noise back into `prob.noise`, so copies that share it must not be solved - concurrently. Give a copy its own with + solve's noise back into `prob.noise` unless `solve` is given `alias_noise = false`, so + without that keyword, copies that share it must not be solved concurrently. A copy can + also be given its own with `remake(isolated_copy(jprob); prob = remake(jprob.prob; noise = new_noise))`. `deepcopy(jprob)` also copies `p`, `u0`, the stored callbacks and the wrapped problem, at a