-
-
Notifications
You must be signed in to change notification settings - Fork 235
Open
Labels
Description
--trim
is almost compatible with ImplicitEuler
, except for this:
controller::Symbol |
since this is ::Symbol
, the compiler does not know which branch of default_controller(::ImplicitEuler)
we'll take and we end up with Union{PIController{...}, IController{...}, PredictiveController{...}}
, which is moderately type-unstable (and rapidly worsens once put into a type parameter)
If I override this behavior manually:
@eval OrdinaryDiffEqSDIRK OrdinaryDiffEqCore.ispredictive(alg::OrdinaryDiffEqNewtonAdaptiveAlgorithm) = false
@eval OrdinaryDiffEqSDIRK OrdinaryDiffEqCore.isstandard(alg::OrdinaryDiffEqNewtonAdaptiveAlgorithm) = false
Then the solver trims OK:
function @main(ARGS)
prob = ODEProblem(ODEFunction{true, SciMLBase.FullSpecialize}(lorenz), u0, tspan)
solver = ImplicitEuler(autodiff=AutoForwardDiff(; chunksize=1))
sol = solve(prob, solver)
println(Core.stdout, sol.t[end])
println(Core.stdout, sum(sol.u[end]))
end
$ julia --project=../NonlinearSolve.jl/test/trim ./contrib/juliac/juliac.jl --trim=safe --experimental --output-exe trimmed_solve ../NonlinearSolve.jl/test/trim/main_once_per_process.jl
$ ./trimmed_solve 0.5
100.0
10.029437251508632
so this is the last issue blocking ImplicitEuler
from being --trim
compatible