Repository navigation
Avoid an inference hang in reduce_ode_mod_p on Julia 1.14.0-beta1 - #587
Merged
Merged
Conversation
`new_type` is not inferable here, so the reduced equation dicts infer as
`Dict{_A, Union{FracFieldElem{_A1}, _A1}} where {_A, _A1}`. Building a `Dict`
whose values are those dicts, only to iterate over the two (old, new) pairs,
sends type inference on Julia 1.14.0-beta1 (and master) into a loop of ever
larger `Memory{Union{FracFieldElem{_A}, FracFieldElem{_A1}, ...}}` types, so
compiling `assess_identifiability` never finishes. Iterate over a tuple of the
pairs instead; this also avoids the two pairs colliding as keys when
`x_equations == y_equations`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Thanks a lot for reporting the issue and for proposing the fix ! |
Collaborator
|
@isaacsas I have created a 0.5.x version with the fix, this is 0.5.37. Let me know if this is what you wanted. |
Member
Author
|
Either is fine, thanks! (I believe we now support both .5 and .6 in Catalyst.) I'll give Catalyst CI a test and see if this fixes the hanging pre test. |
isaacsas
added a commit
to SciML/Catalyst.jl
that referenced
this pull request
Nov 20, 2026
…0.6.1 Checks whether Extensions Tests (pre) finishes now that StructuralIdentifiability 0.6.1 avoids the Julia 1.14 inference hang (SciML/StructuralIdentifiability.jl#587). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
On Julia 1.14.0-beta1 (and current Julia master), compiling
assess_identifiabilitynever finishes: type inference loops while inferringreduce_ode_mod_p. This showed up as the Structural Identifiability tests in Catalyst's Extensions (pre) CI running into the 6-hour timeout, and it reproduces with SI alone (checked with v0.5.36; the code is unchanged on master):Cause. In
reduce_ode_mod_p,new_type = typeof(new_vars[1])is not inferable, sonew_x_eqsandnew_y_eqsinfer asDict{_A, Union{FracFieldElem{_A1}, _A1}} where {_A, _A1}. The loop then buildsDict(ode.x_equations => new_x_eqs, ode.y_equations => new_y_eqs), aDictwhose value type is thatUnionAll, only to iterate over the two(old, new)pairs. On 1.14.0-beta1, inferring thatDict's internals (rehash!,copy(::Memory),unsafe_copyto!) builds ever largerMemory{Union{FracFieldElem{_A}, FracFieldElem{_A1}, ...}}types, and subtyping on them blows up. The underlying Julia regression is reported in JuliaLang/julia#65046.Fix. Iterate over a tuple of the two pairs instead. The loop body is unchanged; this also avoids the two pairs collapsing into one entry if
x_equations == y_equations.Testing (macOS aarch64):
test/reduce_ode_mod_p.jlandtest/identifiability.jlpass on Julia 1.13.3 and 1.14.0-beta1.test/extensions/structural_identifiability.jlpasses on 1.14.0-beta1 (64/64 in about a minute) instead of never finishing.Catalyst's extension tests currently use SI 0.5.x, so a 0.5.x patch release with this change would also help, if that is possible.
🤖 Generated with Claude Code 2.1.326 (model: claude-opus-5-5)