From 7920626dd0f7ba6de5a328c5555e79a67ded46f2 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 20 May 2024 08:24:44 -0400 Subject: [PATCH 1/3] Fix initialization size to not try/catch --- src/initialize_dae.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/initialize_dae.jl b/src/initialize_dae.jl index 2618ea1b79..ad6e4c2060 100644 --- a/src/initialize_dae.jl +++ b/src/initialize_dae.jl @@ -528,9 +528,10 @@ function _initialize_dae!(integrator, prob::ODEProblem, if isAD csize = count(algebraic_vars) if !(p isa SciMLBase.NullParameters) && typeof(_u) !== typeof(u) - try + if SciMLSturctures.isscimlstructure(p) csize = max(csize, length(canonicalize(Tunable(), p)[1])) - catch + else + csize = max(csize, length(p)) end end chunk = ForwardDiff.pickchunksize(csize) From f7db57803adc095cfd40eec4b35394c21d675063 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 20 May 2024 09:20:34 -0400 Subject: [PATCH 2/3] Update src/initialize_dae.jl --- src/initialize_dae.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/initialize_dae.jl b/src/initialize_dae.jl index ad6e4c2060..6d6669a5ec 100644 --- a/src/initialize_dae.jl +++ b/src/initialize_dae.jl @@ -528,7 +528,7 @@ function _initialize_dae!(integrator, prob::ODEProblem, if isAD csize = count(algebraic_vars) if !(p isa SciMLBase.NullParameters) && typeof(_u) !== typeof(u) - if SciMLSturctures.isscimlstructure(p) + if SciMLStructures.isscimlstructure(p) csize = max(csize, length(canonicalize(Tunable(), p)[1])) else csize = max(csize, length(p)) From aa02da738bac1ab4acea79fd5dd2a974aa162704 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 20 May 2024 13:25:42 -0400 Subject: [PATCH 3/3] fix import --- src/OrdinaryDiffEq.jl | 2 +- src/initialize_dae.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OrdinaryDiffEq.jl b/src/OrdinaryDiffEq.jl index ae6b2001ab..505f8c72ac 100644 --- a/src/OrdinaryDiffEq.jl +++ b/src/OrdinaryDiffEq.jl @@ -108,7 +108,7 @@ import ADTypes: AbstractADType, import Polyester using MacroTools, Adapt -using SciMLStructures: canonicalize, Tunable +using SciMLStructures: canonicalize, Tunable, isscimlstructure const CompiledFloats = Union{Float32, Float64, ForwardDiff.Dual{ diff --git a/src/initialize_dae.jl b/src/initialize_dae.jl index 6d6669a5ec..9404d9531f 100644 --- a/src/initialize_dae.jl +++ b/src/initialize_dae.jl @@ -528,7 +528,7 @@ function _initialize_dae!(integrator, prob::ODEProblem, if isAD csize = count(algebraic_vars) if !(p isa SciMLBase.NullParameters) && typeof(_u) !== typeof(u) - if SciMLStructures.isscimlstructure(p) + if isscimlstructure(p) csize = max(csize, length(canonicalize(Tunable(), p)[1])) else csize = max(csize, length(p))