Repository navigation
ExpRK: cache ishermitian (rebase of #4305, + review fixes) - #4497
Merged
ChrisRackauckas merged 7 commits intoSep 11, 2026
Merged
ChrisRackauckas merged 7 commits into
ChrisRackauckas merged 7 commits into
Conversation
The docstring justified the snapshot with "a SplitFunction's linear part is fixed for the whole solve". It is not. A split linear part is an operator like any other, and evaluating the split right-hand side runs update_coefficients! on it, so a non-constant one really does change its entries mid-solve -- symmetric at t=0 and asymmetric afterwards. `isconstant(A)` is the whole licence for caching; the `SplitFunction` test only picks out which object `A` is, as against a Jacobian that `calc_J!` overwrites every step. The guard already checked `isconstant`, so this corrects the stated reasoning and pins the behavior it protects: after two steps of a split problem whose operator loses symmetry, the flag reaching `arnoldi!` is `false`, not the `true` snapshot taken at t=0. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_01H8v7A5YkRi8bj8eqWR3wht
…sing it NorsettEuler destructured the cached flag out of KsCache and then called arnoldi! without it, so ETDRK1 kept paying for a full ishermitian scan per Krylov build -- the cost this PR exists to remove -- and the binding sat unused. The two Exprb caches destructured it and hand-rolled the same keyword tuple; theirs is always nothing (a per-step Jacobian cannot be cached), so routing them through _arnoldi_kwargs changes no behavior, just drops the duplicated block and the unused binding. The existing loop only asserts that the flag is stored in the cache, which cannot catch a perform_step! that receives it and ignores it. The new test counts how often the operator is asked for its symmetry across five steps: once while the cache is built, and never again. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_01H8v7A5YkRi8bj8eqWR3wht
Formatting only, no behavior change. `runic --check` is clean on master for this sublibrary, so everything here is code this branch added. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_01H8v7A5YkRi8bj8eqWR3wht
SciML#4305 bumped 2.3.0 -> 2.3.1, but master has since released 2.3.1, so the rebase left the version equal to the released one. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_01H8v7A5YkRi8bj8eqWR3wht
`using SciMLOperators: isconstant` alone trips ExplicitImports in the QA group
("relying on the following implicit imports: SciMLOperators"), which is why
every other dependency in this file is spelled `using Foo: Foo, bar`.
GROUP=QA julia --project -e 'using Pkg; Pkg.test()'
Aqua | 21 pass, 21 total (was 20 pass, 1 error)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_01H8v7A5YkRi8bj8eqWR3wht
ChrisRackauckas
marked this pull request as ready for review
September 11, 2026 10:35
This was referenced Sep 11, 2026
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 11, 2026
- Unify companion global error estimators into GlobalErrorEstimation (#4492) - Add adjoint-based global error control as a SciMLSensitivity extension (#3953) - ExpRK: cache ishermitian (rebase of #4305, + review fixes) (#4497) - Mark discrete time-grid search helpers as Enzyme inactive (#4496) - GlobalAdjoint: every-step trajectory scope and step-grid control (#4495) - GlobalAdjoint: defer to adjoint_sensitivities default instead of pinning an adjoint (#4498) - Release GlobalDiffEq 1.7.1 (#4501) - Fix GlobalDiffEq precompilation on Julia 1.13 and companion accuracy (#4500) - Make mass-matrix identity/zero/diagonal checks GPU-safe (#4502) - Fix BDF step rejection for backward-in-time integration (#4503) 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]>
ChrisRackauckas
referenced
this pull request
Sep 11, 2026
- Add serial SDC solver family (OrdinaryDiffEqSDC) (#4208) - Give each threaded complex stage its own JVP operator (#4430) - Fix the adaptive error estimates of MRIGARKERK22a and MIS (#4232) - Skip sparsity prep for matrix-free jac_prototype operators (#4445) - Format differentiation tests (#4446) - Fix SciMLBase reexport QA on Julia LTS (#4450) - Preserve conditioning in OOP no-init solves (#4438) - Read the test group from GROUP like the CI passes it (#4447) - Raise root GPU test timeout (#4449) - Fix default SDE dt vector lengths (#4454) 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]>
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 12, 2026
- Release OrdinaryDiffEqBDF 2.4.7 (#4490) - Unify companion global error estimators into GlobalErrorEstimation (#4492) - Add adjoint-based global error control as a SciMLSensitivity extension (#3953) - ExpRK: cache ishermitian (rebase of #4305, + review fixes) (#4497) - Mark discrete time-grid search helpers as Enzyme inactive (#4496) - GlobalAdjoint: every-step trajectory scope and step-grid control (#4495) - GlobalAdjoint: defer to adjoint_sensitivities default instead of pinning an adjoint (#4498) - Release GlobalDiffEq 1.7.1 (#4501) - Fix GlobalDiffEq precompilation on Julia 1.13 and companion accuracy (#4500) - Make mass-matrix identity/zero/diagonal checks GPU-safe (#4502) 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]>
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 13, 2026
- Unify companion global error estimators into GlobalErrorEstimation (#4492) - Add adjoint-based global error control as a SciMLSensitivity extension (#3953) - ExpRK: cache ishermitian (rebase of #4305, + review fixes) (#4497) - Mark discrete time-grid search helpers as Enzyme inactive (#4496) - GlobalAdjoint: every-step trajectory scope and step-grid control (#4495) - GlobalAdjoint: defer to adjoint_sensitivities default instead of pinning an adjoint (#4498) - Release GlobalDiffEq 1.7.1 (#4501) - Fix GlobalDiffEq precompilation on Julia 1.13 and companion accuracy (#4500) - Make mass-matrix identity/zero/diagonal checks GPU-safe (#4502) - Fix BDF step rejection for backward-in-time integration (#4503) 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.
Rebase of #4305 onto current master (
eed19e7a0), with the review comment on_cached_ishermitianaddressed in commits stacked on top. @KeshavVenkatesh's two commits arecherry-picked unchanged with authorship preserved; everything after them is new. Credit for the
optimization is his — this only rebases it and answers the review.
Please ignore until reviewed by @ChrisRackauckas. Supersedes #4305.
What the review comment was about
Correct, and the docstring said otherwise: it justified the snapshot with "a
SplitFunction'slinear part is fixed for the whole solve". A split linear part is an operator like any other,
and evaluating the split right-hand side runs
update_coefficients!on it, so a non-constantone really does change its entries mid-solve. Measured directly on a
MatrixOperatorcarryingan
update_func, over 5 steps ofETDRK4(krylov = true):That is exactly the "hermitian at t=0 because the initial point is odd, not for any t>0" case
from the earlier review comment, and
isconstant(A)— already in the guard as of594dcd19a—is the whole thing that rules it out. The
SplitFunctiontest only picks out which objectAis:
f.f1.f, as against a Jacobiancalc_J!overwrites every step. So the code was right andits stated reason was wrong;
74e40ab5efixes the reason and pins the behavior with a test.Commits
2210f5345,e0e7a407e74e40ab5e1ae996b96arnoldi!calls that were still missing it3beea3685fe3099b285edca8df9SciMLOperatorsmodule import, required by the QA group1ae996b96fixes something separate that the rebase surfaced:NorsettEulerCachedestructuredthe cached flag out of
KsCacheand then calledarnoldi!without it, so ETDRK1 kept paying forthe full
ishermitianscan per Krylov build — the cost this PR exists to remove — and thebinding sat unused. The two
Exprbcaches destructured it and hand-rolled the same keywordtuple; theirs is always
nothing(a per-step Jacobian cannot be cached), so routing themthrough
_arnoldi_kwargschanges no behavior, it just drops the duplicated block and the unusedbinding. Drop that commit if you would rather it went separately.
Verification
All runs on Julia 1.12.4,
lib/OrdinaryDiffEqExponentialRK.Tests, final branch state:
The 2 broken in each group are pre-existing (
CFNLIRK3()and friends), unchanged from master.Both new tests discriminate. Dropping the
isconstantgate — i.e. the state of the firstcommit, which assumed split ⇒ fixed — fails the new mid-solve assertion, along with two of
@KeshavVenkatesh's own:
Reverting only the
NorsettEulerhunk of1ae996b96fails the new counter test — the operatorgets asked for its symmetry once per step instead of once per solve:
Both pass on the final state (126/128 above).
End-to-end timing, N=4096 periodic 1-D Laplacian (symmetric, sparse) as the split linear
part,
dt = 1e-2tot = 1, min of 5 runs, this branch vs master:NorsettEuleris the one1ae996b96unblocks; on master's code it is unchanged by #4305.Format and spelling:
runic --checkandtyposare both clean on the sublibrary. Runic isclean on master for these files, so
3beea3685only reformats lines this branch added.Not verified
julia prejobs — not run locally.LawsonEulerstill derivesishermitianper step. It goes throughexpvwith a two-elementKsCachebuilt by a differentalg_cache, so it is outside the shape ExpRK: cache ishermitian implementation #4305 introduced.expvdoes accept the keyword, so this is reachable, just not done here.ConstantCache) paths pass_arnoldi_kwargs(alg, A, integrator, nothing)and so derive the flag per call, as before. No cache exists to hold it on those paths.
Worth pushing back on
isconstantisfalsefor anything that is not anAbstractSciMLOperator, so the cache isdeclined for linear parts that are not operators. That is deliberately conservative — a stale
trueroutesarnoldi!intolanczos!and is silently wrong, a stalefalseonly coststime — but it does mean the optimization is narrower than "split problems".
SymmetryCountertest helper definesLinearAlgebra.ishermitian/mul!on a test-localmatrix type to count calls. It is the only way I found to assert that the flag actually
reaches
arnoldi!rather than merely being stored in the cache.🤖 Generated with Claude Code (model: claude-opus-5[1m])
https://claude.ai/code/session_01H8v7A5YkRi8bj8eqWR3wht