Repository navigation
Choose the SCC block container from the specialization level, and precompile a multi-block SCC initialization - #5202
Draft
ChrisRackauckas wants to merge 2 commits into
Draft
ChrisRackauckas wants to merge 2 commits into
ChrisRackauckas wants to merge 2 commits into
Conversation
AutoDespecialize always stores the blocks of an SCCNonlinearProblem in a vector, FullSpecialize always in a tuple, and AutoSpecialize keeps the tuple-for-at-most-5-blocks heuristic. A tuple makes the problem type depend on the block count and on each block's kind, so initialization problems (AutoDespecialize by default) could not share compiled code across models. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Agent-Harness: Claude Code 2.1.280 Agent-Model: claude-opus-5-5[1m] Agent-Session: https://claude.ai/code/session_01Wt79fZeNaZxiwQ3LagMYXH Claude-Session: https://claude.ai/code/session_01Wt79fZeNaZxiwQ3LagMYXH
precompile_dae_problem has a single algebraic block, so its initialization is a plain NonlinearProblem and the SCC path was never precompiled (its docstring said SCC; fixed). precompile_scc_dae_problem builds a nonlinear block followed by a linear block and is solved in the FBDF, Rodas5P and default-algorithm workloads. Tests pin the container per specialization level and that initialization problems with 2, 3 and 7 blocks share the workload's type. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Agent-Harness: Claude Code 2.1.280 Agent-Model: claude-opus-5-5[1m] Agent-Session: https://claude.ai/code/session_01Wt79fZeNaZxiwQ3LagMYXH Claude-Session: https://claude.ai/code/session_01Wt79fZeNaZxiwQ3LagMYXH
Contributor
Benchmark Results (Julia vlts)Time benchmarks
Memory benchmarks
|
Contributor
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
This was referenced Sep 24, 2026
ChrisRackauckas-Claude
pushed a commit
to ChrisRackauckas-Claude/ModelingToolkit.jl
that referenced
this pull request
Sep 30, 2026
Address independent review of SciML#5221: leave the Homotopy SCC container policy to SciML#5202, return InitializeprobParameterMap only under AutoDespecialize, retarget type-equality to DAE sizes (6, 9), and cover non-tunable array-parameter indices in CopyParamsByTemplate. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/initdata/log.txt on amdci2.julia.csail.mit.edu
This was referenced Oct 1, 2026
This branch has not been deployed
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.
Depends on an SCCNonlinearSolve release. At
AutoDespecialize, small homotopy initialization problems now take SCCNonlinearSolve's vector path, which threwMethodError: no method matching probvec(::HomotopyProblem). Fixed in SciML/NonlinearSolve.jl#1321 and released by SciML/NonlinearSolve.jl#1323. Until 1.15.4 is registered,test/homotopy_initialization_scc.jlwill error on CI here. TheSCCNonlinearSolvefloor (currently"1.13") must be raised to"1.15.4"before merging. I left it unchanged so CI can resolve now.What changed and why
SCCNonlinearProblemnow picks its block container from the specialization level:AutoDespecializealways stores the blocks in a vector,FullSpecializealways in a tuple, andAutoSpecializekeeps the existing heuristic (tuple for ≤ 5 blocks). Previously every level used the heuristic, so an initialization problem with 2–5 blocks had a type specific to its block count and the kind of each block, and no precompile workload could cover a user's model. Initialization problems built byODEProblemareAutoDespecializeby default, so they now share one type across models.The DAE precompile workload also never reached this path:
precompile_dae_problemhas a single algebraic block, which builds a plainNonlinearProbleminitialization (its docstring said SCC; corrected). This addsprecompile_scc_dae_problem— a nonlinear block followed by a linear block — built in the package workload and solved in the FBDF, Rodas5P and default-algorithm extension workloads.Verification
Julia 1.12.6, aarch64-linux (Jetson AGX Orin),
--startup-file=no.New tests fail without the container change and pass with it.
test/scc_nonlinear_problem.jl, the two added testsets, run withsrc/problems/sccnonlinearproblem.jlreverted to master:With the change:
18/18and9/9pass.First
solveof a user model in a fresh session, this checkout at master versus master + this PR, everything else identical, pkgimages built before each timed run. Chain DAE with array parameters, FBDF:abstol/reltolThe 6-block case improves too although it was already a vector on master, because nothing precompiled the SCC path before. The row with tolerances barely moves: the workloads solve without keyword arguments, and passing
abstol/reltolre-specializes__init's keyword body — a separate, finite axis for a follow-up.Runtime cost of the vector container, the same blocks stored as a tuple versus a vector, warm
solve(prob, NewtonRaphson()), 10th percentile of 2000 (medians were noisier; a test suite was running alongside):About 10–20 µs per initialization solve, once per
solve.FullSpecializekeeps the tuple for anyone for whom that matters.Suite (this branch, with SCCNonlinearSolve from SciML/NonlinearSolve.jl#1321 dev'd):
GROUP=InterfaceII:Pass 1367, Broken 7—Testing ModelingToolkit tests passed.GROUP=Initialization:Pass 922, Broken 12—Testing ModelingToolkit tests passed. Against registered SCCNonlinearSolve 1.15.3 the same group has one error, theprobvec(::HomotopyProblem)above.GROUP=QA:Pass 39, Fail 1. The failure isNo unapproved public reexportsfor[:ap_var, :canonical_constraints, :constraint_residual], none of which this PR touches. Master's own CI fails identically at e167d97: https://github.com/SciML/ModelingToolkit.jl/actions/runs/35838708180/job/107109419276docs/make.jl): builds through doctests,@docsexpansion and cross-references. The only error islinkcheckonhttps://docs.sciml.ai/PDEBase/stable/interface/indocs/src/API/PDESystem.md(not touched here), which returns HTTP 403 from this machine withcurltoo.Runic: no changes on the touched files.
typos: clean on added lines.Not verified
InterfaceIIandInitialization; no downstream packages.NoSpecializeandFunctionWrapperSpecializetake the vector path here (anything that is notFullSpecializeor theAutoSpecializeheuristic). That was not specified; push back if either should keep the heuristic.🤖 Posted by an AI agent — harness: Claude Code 2.1.280 · model: claude-opus-5-5[1m]
Conversation: https://claude.ai/code/session_01Wt79fZeNaZxiwQ3LagMYXH
🤖 Generated with Claude Code
https://claude.ai/code/session_01Wt79fZeNaZxiwQ3LagMYXH