I’m trying to autodiff an ODE problem that I’m solving with DifferentialEquations.jl. Here’s my code:
begin
# Import needed packages
using DifferentialEquations
using Enzyme
#using Zygote
#using SciMLSensitivity
end
function exp_ode(t)
f(u,p,t) = 0.98u
u0 = 1.0
tspan = (0.0,1.0)
prob = DifferentialEquations.ODEProblem(f,u0,tspan)
sol = DifferentialEquations.solve(prob,abstol=1e-8,reltol=1e-8,saveat=t)
return sol.u
end
times = Vector(LinRange(0, 1, 10))
du_dt = Enzyme.jacobian(set_runtime_activity(Reverse), t -> exp_ode(t), times)
The error message:
Enzyme execution failed.
Enzyme: Non-constant keyword argument found for Tuple{UInt64, typeof(Core.kwcall), EnzymeCore.Duplicated{@NamedTuple{abstol::Float64, reltol::Float64, saveat::Vector{Float64}}}, typeof(EnzymeCore.EnzymeRules.augmented_primal), EnzymeCore.EnzymeRules.RevConfigWidth{1, true, true, (false, true, false, false, false), true}, EnzymeCore.Const{typeof(DiffEqBase.solve_up)}, Type{EnzymeCore.Duplicated{Any}}, EnzymeCore.Duplicated{SciMLBase.ODEProblem{Float64, Tuple{Float64, Float64}, false, SciMLBase.NullParameters, SciMLBase.ODEFunction{false, SciMLBase.AutoSpecialize, Main.var"workspace#102".var"#f#1", LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, SciMLBase.StandardODEProblem}}, EnzymeCore.Const{Nothing}, EnzymeCore.Active{Float64}, EnzymeCore.Const{SciMLBase.NullParameters}}
This is on Julia 1.11.3 and Enzyme v0.13.30