Seems like its missing some tracing for now ?
using OrdinaryDiffEq,SciMLSensitivity,Reactant,Enzyme,Optimization,OptimizationPolyalgorithms
function lotka_volterra!(du, u, p, t)
x, y = u
α, β, δ, γ = p
du[1] = α * x - β * x * y
du[2] = -δ * y + γ * x * y
end
Reactant.set_default_backend("cpu")
dev = to_rarray
Reactant.allowscalar(true)
# Initial condition
u0 = [1.0, 1.0] |> dev
# Simulation interval and intermediary points
tspan = (0.0, 10.0)
tsteps = 0.0:0.1:10.0
# LV equation parameter. p = [α, β, δ, γ]
p = [1.5, 1.0, 3.0, 1.0] |> dev
# Setup the ODE problem, then solve
prob = ODEProblem(lotka_volterra!, u0, tspan, p)
dt = 1e-2
sol = @jit solve(prob,Tsit5(),dt=dt)
ERROR: MethodError: objects of type Base.RefValue{typeof(DiffEqBase.ODE_DEFAULT_NORM)} are not callable
The object of type `Base.RefValue{typeof(DiffEqBase.ODE_DEFAULT_NORM)}` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object.
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/Reactant/Efoni/src/utils.jl:0 [inlined]
[2] call_with_reactant(::Reactant.MustThrowError, ::Base.RefValue{…}, ::Reactant.TracedRNumber{…}, ::Reactant.TracedRNumber{…})
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:875
[3] calculate_residuals
@ ~/.julia/packages/DiffEqBase/SwbtQ/src/calculate_residuals.jl:11 [inlined]
[4] (::Nothing)(none::typeof(DiffEqBase.calculate_residuals), none::Reactant.TracedRNumber{…}, none::Reactant.TracedRNumber{…}, none::Reactant.TracedRNumber{…}, none::Reactant.TracedRNumber{…}, none::Reactant.TracedRNumber{…}, none::Base.RefValue{…}, none::Reactant.TracedRNumber{…})
@ Reactant ./<missing>:0
[5] calculate_residuals
@ ~/.julia/packages/DiffEqBase/SwbtQ/src/calculate_residuals.jl:11 [inlined]
[6] call_with_reactant(::typeof(DiffEqBase.calculate_residuals), ::Reactant.TracedRNumber{…}, ::Reactant.TracedRNumber{…}, ::Reactant.TracedRNumber{…}, ::Reactant.TracedRNumber{…}, ::Reactant.TracedRNumber{…}, ::Base.RefValue{…}, ::Reactant.TracedRNumber{…})
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:0
[7] make_mlir_fn(f::typeof(DiffEqBase.calculate_residuals), args::Tuple{…}, kwargs::Tuple{}, name::String, concretein::Bool; toscalar::Bool, return_dialect::Symbol, args_in_result::Symbol, construct_function_without_args::Bool, do_transpose::Bool, input_shardings::Nothing, output_shardings::Nothing, runtime::Nothing, verify_arg_names::Nothing, argprefix::Symbol, resprefix::Symbol, resargprefix::Symbol, num_replicas::Int64, optimize_then_pad::Bool)
@ Reactant.TracedUtils ~/.julia/packages/Reactant/Efoni/src/TracedUtils.jl:330
[8] elem_apply(::Function, ::Reactant.TracedRArray{…}, ::Reactant.TracedRArray{…}, ::Reactant.TracedRArray{…}, ::Reactant.TracedRArray{…}, ::Reactant.TracedRArray{…}, ::Base.RefValue{…}, ::Reactant.TracedRArray{…})
@ Reactant.TracedUtils ~/.julia/packages/Reactant/Efoni/src/TracedUtils.jl:1082
[9] _copyto!
@ ~/.julia/packages/Reactant/Efoni/src/TracedRArray.jl:779 [inlined]
[10] (::Nothing)(none::typeof(Reactant.TracedRArrayOverrides._copyto!), none::Reactant.TracedRArray{…}, none::Base.Broadcast.Broadcasted{…})
@ Reactant ./<missing>:0
[11] getproperty
@ ./Base.jl:49 [inlined]
[12] size
@ ~/.julia/packages/Reactant/Efoni/src/TracedRArray.jl:489 [inlined]
[13] axes
@ ./abstractarray.jl:98 [inlined]
[14] _copyto!
@ ~/.julia/packages/Reactant/Efoni/src/TracedRArray.jl:772 [inlined]
[15] call_with_reactant(::typeof(Reactant.TracedRArrayOverrides._copyto!), ::Reactant.TracedRArray{…}, ::Base.Broadcast.Broadcasted{…})
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:0
[16] materialize!
@ ~/.julia/packages/Reactant/Efoni/src/TracedRArray.jl:730 [inlined]
[17] materialize!
@ ./broadcast.jl:880 [inlined]
[18] fast_materialize!
@ ~/.julia/packages/FastBroadcast/wfdTr/src/FastBroadcast.jl:279 [inlined]
[19] calculate_residuals!
@ ~/.julia/packages/DiffEqBase/SwbtQ/src/calculate_residuals.jl:97 [inlined]
[20] perform_step!
@ ~/.julia/packages/OrdinaryDiffEqTsit5/UmDPY/src/tsit_perform_step.jl:224 [inlined]
[21] (::Nothing)(none::typeof(OrdinaryDiffEqCore.perform_step!), none::OrdinaryDiffEqCore.ODEIntegrator{…}, none::OrdinaryDiffEqTsit5.Tsit5Cache{…}, none::Bool)
@ Reactant ./<missing>:0
[22] getproperty
@ ~/.julia/packages/SciMLBase/DbVzk/src/integrator_interface.jl:487 [inlined]
[23] perform_step!
@ ~/.julia/packages/OrdinaryDiffEqTsit5/UmDPY/src/tsit_perform_step.jl:181 [inlined]
[24] call_with_reactant(::typeof(OrdinaryDiffEqCore.perform_step!), ::OrdinaryDiffEqCore.ODEIntegrator{…}, ::OrdinaryDiffEqTsit5.Tsit5Cache{…}, ::Bool)
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:0
[25] perform_step!
@ ~/.julia/packages/OrdinaryDiffEqTsit5/UmDPY/src/tsit_perform_step.jl:181 [inlined]
[26] solve!
@ ~/.julia/packages/OrdinaryDiffEqCore/zs1s7/src/solve.jl:620 [inlined]
[27] (::Nothing)(none::typeof(solve!), none::OrdinaryDiffEqCore.ODEIntegrator{…})
@ Reactant ./<missing>:0
[28] call_with_reactant(::typeof(solve!), ::OrdinaryDiffEqCore.ODEIntegrator{…})
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:501
[29] #__solve#62
@ ~/.julia/packages/OrdinaryDiffEqCore/zs1s7/src/solve.jl:7 [inlined]
[30] (::Nothing)(none::OrdinaryDiffEqCore.var"##__solve#62", none::@Kwargs{…}, none::typeof(SciMLBase.__solve), none::ODEProblem{…}, none::Tsit5{…}, none::Tuple{})
@ Reactant ./<missing>:0
[31] merge
@ ./namedtuple.jl:349 [inlined]
[32] #__solve#62
@ ~/.julia/packages/OrdinaryDiffEqCore/zs1s7/src/solve.jl:6 [inlined]
[33] call_with_reactant(::OrdinaryDiffEqCore.var"##__solve#62", ::@Kwargs{…}, ::typeof(SciMLBase.__solve), ::ODEProblem{…}, ::Tsit5{…})
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:0
[34] __solve
@ ~/.julia/packages/OrdinaryDiffEqCore/zs1s7/src/solve.jl:1 [inlined]
[35] #solve_call#36
@ ~/.julia/packages/DiffEqBase/SwbtQ/src/solve.jl:657 [inlined]
[36] solve_call
@ ~/.julia/packages/DiffEqBase/SwbtQ/src/solve.jl:614 [inlined]
[37] (::Nothing)(none::typeof(Core.kwcall), none::@NamedTuple{…}, none::typeof(DiffEqBase.solve_call), none::ODEProblem{…}, none::Tuple{…})
@ Reactant ./<missing>:0
[38]
call_with_reactant(::typeof(Core.kwcall), ::@NamedTuple{…}, ::typeof(DiffEqBase.solve_call), ::ODEProblem{…}, ::Tsit5{…})
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:501
[39] #solve_up#45
@ ~/.julia/packages/DiffEqBase/SwbtQ/src/solve.jl:1211 [inlined]
[40] (::Nothing)(none::DiffEqBase.var"##solve_up#45", none::SciMLBase.ChainRulesOriginator, none::@Kwargs{…}, none::typeof(DiffEqBase.solve_up), none::ODEProblem{…}, none::Nothing, none::Reactant.TracedRArray{…}, none::Reactant.TracedRArray{…}, none::Tuple{…})
@ Reactant ./<missing>:0
[41] call_with_reactant(::DiffEqBase.var"##solve_up#45", ::SciMLBase.ChainRulesOriginator, ::@Kwargs{…}, ::typeof(DiffEqBase.solve_up), ::ODEProblem{…}, ::Nothing, ::Reactant.TracedRArray{…}, ::Reactant.TracedRArray{…}, ::Tsit5{…})
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:501
[42] solve_up
@ ~/.julia/packages/DiffEqBase/SwbtQ/src/solve.jl:1188 [inlined]
[43] #solve#43
@ ~/.julia/packages/DiffEqBase/SwbtQ/src/solve.jl:1083 [inlined]
[44] (::Nothing)(none::DiffEqBase.var"##solve#43", none::Nothing, none::Nothing, none::Nothing, none::Val{…}, none::@Kwargs{…}, none::typeof(solve), none::ODEProblem{…}, none::Tuple{…})
@ Reactant ./<missing>:0
[45] call_with_reactant(::DiffEqBase.var"##solve#43", ::Nothing, ::Nothing, ::Nothing, ::Val{…}, ::@Kwargs{…}, ::typeof(solve), ::ODEProblem{…}, ::Tsit5{…})
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:501
[46] solve
@ ~/.julia/packages/DiffEqBase/SwbtQ/src/solve.jl:1073 [inlined]
[47] (::Nothing)(none::typeof(Core.kwcall), none::@NamedTuple{…}, none::typeof(solve), none::ODEProblem{…}, none::Tuple{…})
@ Reactant ./<missing>:0
[48] call_with_reactant(::typeof(Core.kwcall), ::@NamedTuple{…}, ::typeof(solve), ::ODEProblem{…}, ::Tsit5{…})
@ Reactant ~/.julia/packages/Reactant/Efoni/src/utils.jl:501
[49] make_mlir_fn(f::typeof(solve), args::Tuple{…}, kwargs::@NamedTuple{…}, name::String, concretein::Bool; toscalar::Bool, return_dialect::Symbol, args_in_result::Symbol, construct_function_without_args::Bool, do_transpose::Bool, input_shardings::Nothing, output_shardings::Nothing, runtime::Val{…}, verify_arg_names::Nothing, argprefix::Symbol, resprefix::Symbol, resargprefix::Symbol, num_replicas::Int64, optimize_then_pad::Bool)
@ Reactant.TracedUtils ~/.julia/packages/Reactant/Efoni/src/TracedUtils.jl:332
[50] compile_mlir!(mod::Reactant.MLIR.IR.Module, f::Function, args::Tuple{…}, compile_options::CompileOptions, callcache::Dict{…}, sdycache::Dict{…}; fn_kwargs::@NamedTuple{…}, backend::String, runtime::Val{…}, legalize_stablehlo_to_mhlo::Bool, kwargs::@Kwargs{})
@ Reactant.Compiler ~/.julia/packages/Reactant/Efoni/src/Compiler.jl:1528
[51] compile_mlir! (repeats 2 times)
@ ~/.julia/packages/Reactant/Efoni/src/Compiler.jl:1495 [inlined]
[52] compile_xla(f::Function, args::Tuple{…}; before_xla_optimizations::Bool, client::Nothing, serializable::Bool, kwargs::@Kwargs{…})
@ Reactant.Compiler ~/.julia/packages/Reactant/Efoni/src/Compiler.jl:3386
[53] compile_xla
@ ~/.julia/packages/Reactant/Efoni/src/Compiler.jl:3359 [inlined]
[54] compile(f::Function, args::Tuple{…}; kwargs::@Kwargs{…})
@ Reactant.Compiler ~/.julia/packages/Reactant/Efoni/src/Compiler.jl:3458
Some type information was truncated. Use `show(err)` to see complete types.
Kinda of trying Reactant a bit everywhere rn :')