You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using OrdinaryDiffEq, StaticArrays, BenchmarkTools
functionrober2(u,p,t)
y₁,y₂,y₃ = u
k₁,k₂,k₃ = p
du1 =-k₁*y₁+k₃*y₂*y₃
du2 = k₁*y₁-k₂*y₂^2-k₃*y₂*y₃
du3 = k₂*y₂^2
SA[du1,du2,du3]
end
prob2 =ODEProblem{false}(rober2,SA[1.0,0.0,0.0],(0.0,1e5),SA[0.04,3e7,1e4])
@btime sol =solve(prob2,Rosenbrock23(),save_everystep=false)
This falls apart in SparseDiffTools
@inlinefunctionforwarddiff_color_jacobian(f,
x::AbstractArray{<:Number};
colorvec =1:length(x),
sparsity =nothing,
jac_prototype =nothing,
chunksize =nothing,
dx = sparsity ===nothing&& jac_prototype ===nothing?nothing:copy(x)) #if dx is nothing, we will estimate dx at the cost of a function call@showtypeof(chunksize)
if sparsity ===nothing&& jac_prototype ===nothing
cfg =if chunksize ===nothingiftypeof(x) <:StaticArrays.StaticArray
ForwardDiff.JacobianConfig(f, x, ForwardDiff.Chunk{StaticArrays.Size(vec(x))[1]}())
else
ForwardDiff.JacobianConfig(f, x)
endelse
ForwardDiff.JacobianConfig(f, x, ForwardDiff.Chunk(getsize(chunksize)))
endreturn ForwardDiff.jacobian(f, x, cfg)
endif dx isa Nothing
dx =f(x)
endreturnforwarddiff_color_jacobian(f,x,ForwardColorJacCache(f,x,chunksize,dx=dx,colorvec=colorvec,sparsity=sparsity),jac_prototype)
end
because chunksize is now an Int. @chriselrod did you make this Val based?
function DiffEqBase.prepare_alg(alg::Union{OrdinaryDiffEqAdaptiveImplicitAlgorithm{0,AD,FDT},
OrdinaryDiffEqImplicitAlgorithm{0,AD,FDT},
DAEAlgorithm{0,AD,FDT}},u0::AbstractArray,p,prob) where {AD,FDT}
# 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 ===nothinglength(u0)
elsemaximum(prob.f.colorvec)
endiftypeof(alg) <:OrdinaryDiffEqImplicitExtrapolationAlgorithmreturn alg # remake fails, should get fixedelseremake(alg,chunk_size=Val{ForwardDiff.pickchunksize(x)}())
endend
fails
The text was updated successfully, but these errors were encountered:
This falls apart in SparseDiffTools
because
chunksize
is now anInt
. @chriselrod did you make thisVal
based?fails
The text was updated successfully, but these errors were encountered: