Skip to content

Commit

Permalink
Merge pull request #2202 from SciML/initialize_size
Browse files Browse the repository at this point in the history
Fix initialization size to not try/catch
  • Loading branch information
ChrisRackauckas authored May 20, 2024
2 parents 6a6efe5 + aa02da7 commit 6d35d93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/OrdinaryDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
5 changes: 3 additions & 2 deletions src/initialize_dae.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 isscimlstructure(p)
csize = max(csize, length(canonicalize(Tunable(), p)[1]))
catch
else
csize = max(csize, length(p))
end
end
chunk = ForwardDiff.pickchunksize(csize)
Expand Down

0 comments on commit 6d35d93

Please sign in to comment.