-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
autodiff in default algorithm #1027
Comments
try/catch always has a ton of overhead so that's not good for the default method. It only works in the adjoints because the cost of adjoint differentiation is already so high when it makes sense, so the overhead is always negligible. For many default ODEs, you'd just hit a standard explicit RK method and in those cases the try/catch would be noticeable but never used. Maybe the right thing to do would be Core.return_type and check if it's a Union{}. That would tell you if it's provable from the types to error? SciML/OrdinaryDiffEq.jl#2103 should merge this week, and with that we may want to reconsider how this could be done @oscardssmith |
I'm really not sure why you think try catch has so much overhead. I measure it as ~10ns in the case where no exception is thrown.
|
Oh okay, then maybe in the new form we can make the AD more dynamic? Though in future versions when using ADTypes with DI this might be an issue. @gdalle something to consider. |
Also worth pointing out that catching an error is pretty expensive.
|
Probably related to JuliaDiff/DifferentiationInterface.jl#164 |
Is it possible to do a try/catch on the evaluation of the Jac to turn on autodiff?
https://github.com/SciML/DifferentialEquations.jl/blob/master/src/ode_default_alg.jl#L49
The text was updated successfully, but these errors were encountered: