Repository navigation
Fix threaded stochastic work-precision race - #4462
Merged
ChrisRackauckas merged 1 commit intoSep 7, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Claude-Session: https://chatgpt.com/codex/tasks/01a03a17-ad6f-7131-82fc-d0fd57ea6512
ChrisRackauckas
marked this pull request as ready for review
September 7, 2026 06:19
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 7, 2026
- DiffEqBase: wrap mass-matrix problems on the finite-difference promote_f path (#4459) - Preserve the DAE step start during callback interpolation (#4466) - Release DiffEqBase 7.20.1 (#4474) - Release OrdinaryDiffEqCore 4.16.1 (#4475) - Release OrdinaryDiffEqNonlinearSolve 2.9.5 (#4476) - Run IDSolve's nonlinear solve at the integrator's tolerances (#4468) - Build W through the allocating path for a sparse GPU Jacobian with a scalar mass matrix (#4452) - Fix threaded stochastic work-precision isolation (#4462) - Differentiate wrapped DAEFunctions with chunk size 1, like ODEFunctions (#4464) - Rebuild MethodOfSteps W after history updates (#4396) Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R Co-authored-by: Claude Opus 5 (1M context) <[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.
Ignore until reviewed by @ChrisRackauckas.
What changed and why
WorkPrecisionSet(...; parallel_type = :threads)expanded@error_calculationdirectly inside a threaded loop. The macro-created locals were captured by the enclosing function, so concurrent stochastic error calculations could replace one another's tolerance and timestep bindings. In mixed adaptive/fixed-step setups, an RKMil solve could therefore receive the adaptive setup's zero/absent timestep and fail nondeterministically.Move one error calculation into the private module-level
_calculate_error!function so every threaded call owns its bindings. Add a regression using an analyticless SDE with adaptive SRIW1 and fixed-step RKMil setups across at least 32 threaded error samples. The same helper also replaces the duplicate macro expansion inget_sample_errors.No public API or dependency changed.
Failing before the fix
On DiffEqDevTools v3.6.2 (
cd5ccd7f8e) with the regression test applied but the implementation reverted:The clean standalone reproducer passed with one Julia thread and failed with 128 threads. A diagnostic assertion also observed the shared
_dtsbinding change between evaluating a condition and capturing its value.Passing after the fix
The exact official test file passes with 128 threads:
An independent clean worktree repeated that test successfully in 6m40s. A 10-trial standalone threaded reproducer also completed all trials successfully in 46.95s; an independent clean worktree repeated it in 57.54s.
The SciMLBenchmarks page that originally exposed the race completed against this local source:
The generated Markdown referenced four valid 576×384 PNGs. Inspection found all strong-error, weak-error, and sample-error curves populated and no runtime error markers.
Local verification
All three final checks exited 0 with no output.
Not verified
No GPU or downstream test groups were run. Documentation was not built because this changes no public API, docstring, or documentation source.
🤖 Generated with Claude Code
https://chatgpt.com/codex/tasks/01a03a17-ad6f-7131-82fc-d0fd57ea6512