Repository navigation
Fix FlexUnits/ReverseDiff/Tracker/Measurements/MCM ODE_DEFAULT_NORM to RMS (#4610) - #4611
Merged
ChrisRackauckas merged 7 commits intoOct 31, 2026
Conversation
This was referenced Sep 23, 2026
ChrisRackauckas-Claude
force-pushed
the
agent/4610-ext-norms-rms
branch
3 times, most recently
from
September 26, 2026 22:47
6f7d541 to
710ca4f
Compare
ChrisRackauckas-Claude
pushed a commit
to ChrisRackauckas-Claude/OrdinaryDiffEq.jl
that referenced
this pull request
Sep 26, 2026
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/adopt/SciML_OrdinaryDiffEq.jl-4611/log.txt on amdci2.julia.csail.mit.edu
ChrisRackauckas
marked this pull request as ready for review
September 27, 2026 12:14
Regression tests for SciML#4610: FlexUnits, Measurements, MonteCarloMeasurements, ReverseDiff, and Tracker array ODE_DEFAULT_NORM must match plain RMS. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.18-9a7762b Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/OrdinaryDiffEq.jl/jobs/4610-cursor/log.txt on amdci2.julia.csail.mit.edu
Array norms in FlexUnits, Measurements, MonteCarloMeasurements, ReverseDiff, and Tracker extensions used abs via the scalar ODE_DEFAULT_NORM, yielding sqrt(mean(|x|)) instead of RMS. Match the Unitful fix: abs2 of value(x). Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.18-9a7762b Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/OrdinaryDiffEq.jl/jobs/4610-cursor/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.157.1 Agent-Model: gpt-6-luna Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/adopt/SciML_OrdinaryDiffEq.jl-4611/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/adopt/SciML_OrdinaryDiffEq.jl-4611/log.txt on amdci2.julia.csail.mit.edu
Address review: varied MCM particles with known means, drop hardcoded 3.5355 checks, and keep every element type covered in a single testset. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/adopt/SciML_OrdinaryDiffEq.jl-4611/log.txt on amdci2.julia.csail.mit.edu
ChrisRackauckas-Claude
force-pushed
the
agent/4610-ext-norms-rms
branch
from
September 30, 2026 11:43
91fdb5d to
0479538
Compare
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: Devin CLI 3000.11.3 (conflict resolution), Claude Code 2.1.285 (orchestration) Agent-Model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium Agent-Session: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master); Devin log /Users/chrisrackauckas/sandbox/master/fusion-fixes/SciML_OrdinaryDiffEq.jl-4611/log.txt
Member
Merged the default branch into this PR (clean merge, no conflicts; head efbb97b) so CI runs on current master. Its earlier failures in SciMLSensitivity Core1 and the downgrade jobs were fixed on master after this PR's last CI run. 🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (merge), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
This was referenced Oct 13, 2026
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.
Please ignore until reviewed by @ChrisRackauckas.
Summary
Five DiffEqBase extensions copied the Unitful bug from #4596: array
ODE_DEFAULT_NORMcalled the scalar method (abs) on stripped values, computingsqrt(mean(|x|))instead of RMS. They now usesqrt(sum(abs2(value(x))) / max(length(u), 1))(MonteCarloMeasurementsvalueis the particle mean). This is a numerical change only (adaptive step counts for these element types); not an API break; Unitful left untouched (see #4609).Behaviour change
With Tsit5 at default tolerances, adaptive step counts for these element types move toward the Float64 baseline instead of taking 25–33% more steps:
Verification
Fail before / negative control
Scratch env with DiffEqBase developed; extension sources reverted to pre-fix:
Tails:
Pass after fix
DiffEqBase Core suite
Tail:
Runic
--checkandtyposon touched files: clean.Not verified
test/downstream).Points to weigh
sum(abs2, u)(done here) vs always stripping.mean(...)spelling vssum/max(length,1)(functionally same for non-empty).MonteCarloMeasurements+Trackerto DiffEqBase test targets (needed so Core CI loads the extensions).Fixes #4610
Please ignore this draft until reviewed by @ChrisRackauckas.
Harness: Cursor Agent CLI 2026.09.18-9a7762b; model: auto; transcript: /log.txt
Adoption update
Rebased the original two Cursor commits plus the prior Codex cleanup commit onto current
origin/masterat85110ac2a6(Reuse W across the sweeps of an adaptive SDC step), preserving authorship and commit separation (no squash). Force-pushed toforkwith--force-with-lease. Draft status unchanged; not merged.No unresolved review comments or review threads. Issue #4610 remains open; master still has the buggy
sqrt(mean(|x|))extension norms (confirmed viagit show origin/master:lib/DiffEqBase/ext/DiffEqBaseMeasurementsExt.jl). No other open PR duplicates this fix (related: #4609 Unitful-only, #4600@fastmath).Fail before / pass after
With the five extension sources reverted to master and the regression tests retained (
scratch/norm-ext-test):With the fix restored:
GROUP=CoreDiffEqBase (Pkg.test()):Testing DiffEqBase tests passed(133.2 s); extension suites 9/9, 9/9, 11/11, 12/12, 12/12. Runic--checkon touched.jlfiles: clean. PR CI DiffEqBase Julia 1 Core: pass.CI classification
All seven red checks are inherited from master / unrelated packages (this PR only changes DiffEqBase extension norms + tests; DiffEqBase Julia 1/pre/Downstream/QA/Static/Sundials are green):
high_level_solve.jl:94despecialized_solved !== despecialized_default_problemdiag(::ScalarOperator)MethodErrorAnyconstructor, ComplexF64 dual, SIGSEGVhigh_level_solvefailure; reproduced on clean master tree under LTS locally; master Sublibrary CI still queued (f9ce35, 85110ac)diag(::ScalarOperator); identical to master Differentiation downgradeGlobalErrorEstimation does not currently support callbacksincompanion_tests.jl(untouched by this PR); same signature on pre-adoption PR runsArgumentErrorinmass_matrix_tests.jl(untouched); same on pre-adoption PR; NonlinearSolve downgrade on this PR passesGPU jobs were still pending on the pre-rebase CI matrix; not re-run locally.
Not verified
85110actip (push will retrigger).🤖 Adoption work by Cursor Agent CLI 2026.09.26-dd393fe (model: auto).
Session: local transcript at
<local>/log.txt.Independent review
Review follow-up (Opus 5.5 MERGE)
Addressed the three small asks from the independent review:
[1,2,3,4,5]/[0,2,4,6,8]) with hand-checked means 3 and 4, so the suite exercisesvalue(= particle mean) rather than constant fills.*_norm_ext.jlfiles intoextension_norm_ext.jlwith a loop over the five types; dropped the redundantexpected ≈ 3.5355…lines.Merged-suite verification (extension sources reverted → restored):
Runic
--checkonextension_norm_ext.jlandruntests.jl: clean. Pushed91fdb5d9f5.Risk assessment
Risk assessment and review coordination by 🤖 Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01NdFVhANTF4nepTbqYxjfRP
Adoption update: rebased onto master 7393799
Rebased onto
739379950d(Bump OrdinaryDiffEqSDC to 1.0.0), preserving the five PR commits and their authorship. Force-pushed toforkwith--force-with-lease.Conflicts
Only file:
lib/DiffEqBase/test/runtests.jl(twice during the rebase).@safetestset "Unitful extension" include("unitful_ext.jl")(Fix Unitful ODE_DEFAULT_NORM to compute RMS (#4596) #4609); the PR added the five*_norm_ext.jlincludes in the same place. Kept both: Unitful include from master, then the five PR includes.extension_norm_ext.jl. Kept Unitful from master and the mergedExtension ODE_DEFAULT_NORMinclude from the PR.lib/DiffEqBase/Project.tomlauto-merged cleanly (PR adds MonteCarloMeasurements/Tracker to test targets atop master’s Unitful extras).Re-verify tails
Risk assessment (independent review, Codex gpt-6.1-sol, head ce79ecd)
git diff origin/HEAD...HEAD. Exported HEAD and origin/HEAD (0139bdc) into scratch; installed a local scratch environment with the requested depot, JULIA_NUM_THREADS=4 and JULIA_NUM_PRECOMPILE_TASKS=4. Rantimeout 3600 julia --project=<scratch/env> -e 'include("<scratch/head/lib/DiffEqBase/test/extension_norm_ext.jl>")'with each exported DiffEqBase selected in the manifest: head exited 0 with 34/34 passes; base exited 1 with 20 passes and 14 assertion failures covering all five extensions. Rantimeout 3600 julia --project=<scratch/env>with scratch/ad.jl on head: 5/5 assertions passed, then included the existingtest/ode_default_norm.jl, which completed without failures (process exit 0). ReverseDiff.gradient and Tracker.gradient both returned [0.4242640687119285, 0.565685424949238] for arrays and views, matching the analytic derivative u/(2*sqrt(12.5)); the particle-valued-time overload returned sqrt(12.5). G1 PASS: independent RMS formula for [3,4] and analytic derivatives, not solver-generated reference values. G2 PASS for affected AD paths: forward values and actual ReverseDiff/Tracker gradients exercised locally; GPU/Reactant/MPI not applicable to this diff. G3 NOT APPLICABLE: no mutable shared state, cache, threading, or global-default configuration is changed. Diff inspection found no skipped or loosened assertions, new production dependency, new public name, or dependency-internal access introduced by the patch.🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol
Conversation: local headless review run (no public session URL); transcript kept by the fleet master.
Independent review
Risk assessment (independent review, Claude Opus 5.5 (claude-opus-5-5), head ce79ecd)
ReverseDiffAdjointgradients at default tolerances change visibly (below).ReverseDiff.TrackedArrayandTracker.TrackedArraykeep their own existing RMS methods and are untouched, so out-of-place ReverseDiffAdjoint/TrackerAdjoint gradients are bit-identical.lib/DiffEqBase/test/extension_norm_ext.jlrun against the merge-base 59ba40e (base) and against the head, each in its own env with the base or headlib/developed. Base: 20 pass, 14 fail, each failureEvaluated: 1.8708286933869707 ≈ 3.5355339059327378, i.e. sqrt(mean(|[3,4]|)) against RMS. Head: 34/34 pass.GROUP=Core1viaPkg.test, with DiffEqBase developed from the base and from the head: both pass, 242 pass / 6 broken / 248 total.GROUP=Coreon the head: passes, including the new testset at 34/34.GROUP=QA(Aqua) on the head: 9/9 pass. Runic--checkclean,typosclean.🤖 Posted by an AI agent — harness: Claude Code · model: claude-opus-5-5
Conversation: local headless review run (no public session URL); transcript kept by the fleet master.