diff --git a/src/alg_utils.jl b/src/alg_utils.jl index 62fd109138..9dd0372f47 100644 --- a/src/alg_utils.jl +++ b/src/alg_utils.jl @@ -170,18 +170,19 @@ function DiffEqBase.prepare_alg(alg::Union{OrdinaryDiffEqAdaptiveImplicitAlgorit isbitstype(T) && sizeof(T) > 24 && return remake(alg, chunk_size=Val{1}(),linsolve=linsolve) - # If chunksize is zero, pick chunksize right at the start of solve and - # then do function barrier to infer the full solve - x = if prob.f.colorvec === nothing - length(u0) - else - maximum(prob.f.colorvec) - end - L = ArrayInterface.known_length(typeof(u0)) if L === nothing # dynamic sized + + # If chunksize is zero, pick chunksize right at the start of solve and + # then do function barrier to infer the full solve + x = if prob.f.colorvec === nothing + length(u0) + else + maximum(prob.f.colorvec) + end + cs = ForwardDiff.pickchunksize(x) - remake(alg,chunk_size=cs,linsolve=linsolve) + remake(alg,chunk_size=Val{cs}(),linsolve=linsolve) else # statically sized cs = pick_static_chunksize(Val{L}()) remake(alg,chunk_size=cs,linsolve=linsolve) diff --git a/src/algorithms.jl b/src/algorithms.jl index 03e648fb3f..f8e9433ef1 100644 --- a/src/algorithms.jl +++ b/src/algorithms.jl @@ -37,10 +37,11 @@ function DiffEqBase.remake(thing::Union{OrdinaryDiffEqAdaptiveImplicitAlgorithm{ DAEAlgorithm{CS,AD,FDT,ST,CJ}}; linsolve, kwargs...) where {CS, AD, FDT, ST, CJ} T = SciMLBase.remaker_of(thing) - T(; chunk_size=Val{CS}(),autodiff=Val{AD}(),standardtag=Val{ST}(), + T(; SciMLBase.struct_as_namedtuple(thing)..., + chunk_size=Val{CS}(),autodiff=Val{AD}(),standardtag=Val{ST}(), concrete_jac = CJ === nothing ? CJ : Val{CJ}(), - linsolve, - SciMLBase.struct_as_namedtuple(thing)...,kwargs...) + linsolve = linsolve, + kwargs...) end ###############################################################################