SciML / SciMLSensitivity.jl

A component of the DiffEq ecosystem for enabling sensitivity analysis for scientific machine learning (SciML). Optimize-then-discretize, discretize-then-optimize, adjoint methods, and more for ODEs, SDEs, DDEs, DAEs, etc.
https://docs.sciml.ai/SciMLSensitivity/stable/
Other
327 stars 70 forks source link

EnzymeVJP often fails is automatic sensealg determination #1001

Open ArnoStrouwen opened 6 months ago

ArnoStrouwen commented 6 months ago

Deleting the sensealg keyword in e.g. this tutorial: https://docs.sciml.ai/SciMLSensitivity/dev/examples/optimal_control/optimal_control/ gives the warning that EnzymeVJP does not work on the problem. However, manually specifying Enzyme, e.g. InterpolatingAdjoint(autojacvec = EnzymeVJP), seems to work fine. The vjp calculation thus differ in the two places?

A first weird thing I found was the use of du in duplicated. https://github.com/SciML/SciMLSensitivity.jl/blob/master/src/concrete_solve.jl#L19

ChrisRackauckas commented 6 months ago

Is there an internal alias check? Try changing one of the du's to a copy and see if that fixes it. Other than that, I don't think there's a difference in the vjps, but there must be if that is failing

ArnoStrouwen commented 6 months ago

Already tried that before, did not work. I'll have to dive deeper into the code.