-
-
Notifications
You must be signed in to change notification settings - Fork 76
Test latest Enzyme #1224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Test latest Enzyme #1224
Conversation
Reproducer 1: using SciMLSensitivity, OrdinaryDiffEq, Enzyme
u0 = [0.0]
p = [2.0, 1.0]
prob = NonlinearProblem((du, u, p) -> du[1] = u[1] - p[1] + p[2], u0, p)
function test_loss(p, prob, alg)
_prob = remake(prob, p = p)
sol = sum(solve(_prob, alg,
sensealg = SteadyStateAdjoint(autojacvec = ReverseDiffVJP())))
return sol
end
function enzyme_gradient(p, prob, alg)
dp = Enzyme.make_zero(p)
dprob = Enzyme.make_zero(prob)
Enzyme.autodiff(Reverse, test_loss, Active, Duplicated(p, dp),
Duplicated(prob, dprob), Const(alg))
return dp
end
dp1_enzyme = enzyme_gradient(p, prob, NewtonRaphson()) Reproducer 2, I think, it's a bit hard to read the GC corruption because it messes with the line numbers, but it seems like it's this: using OrdinaryDiffEq, SciMLSensitivity, Enzyme
Enzyme.API.typeWarning!(false)
odef(du, u, p, t) = du .= u .* p
const prob = ODEProblem(odef, [2.0], (0.0, 1.0), [3.0])
struct senseloss0{T}
sense::T
end
function (f::senseloss0)(u0p)
prob = ODEProblem{true}(odef, u0p[1:1], (0.0, 1.0), u0p[2:2])
sum(solve(prob, Tsit5(), abstol = 1e-12, reltol = 1e-12, saveat = 0.1))
end
u0p = [2.0, 3.0]
du0p = zeros(2)
Enzyme.autodiff(Reverse, senseloss0(InterpolatingAdjoint()), Active, Duplicated(u0p, du0p)) |
Both are related to Enzyme on the outside, not the EnzymeVJP. So it's GC corruption related to https://github.com/SciML/DiffEqBase.jl/blob/master/ext/DiffEqBaseEnzymeExt.jl. But I'm not sure what weird stuff is in that rule... |
appears to be in the deepcopy |
This should now be fixed upstream, @ChrisRackauckas can you rerun? |
No description provided.