Comments (5)
I think the next step here in improving Enzyme support is finishing up the DifferentiationInterface integration. We're working with @gdalle on this, I'm thinking it may not take more than 2 more weeks. When that's the case, DI will be used as the AD system within Optimization.jl. That means isolating this bug is simpler, as it isolates it to how DI handles Enzyme, which should be improved. If there is still an error, this becomes an Enzyme+DI issue which is something we can solve there.
from optimization.jl.
SciML/OptimizationBase.jl#43 is the solution. Maybe try that branch and see?
from optimization.jl.
Thanks, Chris. I got an error:
ERROR: LoadError: Function to differentiate `MethodInstance for OptimizationEnzymeExt.firstapply(::typeof(DJUICE.costfunction), ::Vector{Float64}, ::DJUICE.FemModel, ::DJUICE.FemModel)` is guaranteed to return an error and doesn't make sense to autodiff. Giving up
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] macro expansion
@ ~/.julia/packages/Enzyme/srACB/src/compiler.jl:5845 [inlined]
[3] macro expansion
@ ./none:0 [inlined]
[4] thunk(::Val{…}, ::Type{…}, ::Type{…}, tt::Type{…}, ::Val{…}, ::Val{…}, ::Val{…}, ::Val{…}, ::Val{…}, ::Type{…})
@ Enzyme.Compiler ./none:0
[5] autodiff
@ ~/.julia/packages/Enzyme/srACB/src/Enzyme.jl:234 [inlined]
[6] (::OptimizationEnzymeExt.var"#grad#50"{OptimizationFunction{…}, DJUICE.FemModel})(res::Vector{Float64}, θ::Vector{Float64}, args::DJUICE.FemModel)
@ OptimizationEnzymeExt ~/.julia/packages/OptimizationBase/kgHps/ext/OptimizationEnzymeExt.jl:165
[7] top-level scope
@ ~/Dartmouth/DJUICE/test/testoptimization.jl:46
[8] include(fname::String)
@ Base.MainInclude ./client.jl:489
[9] top-level scope
@ REPL[4]:1
in expression starting at /Users/gongcheng/Dartmouth/DJUICE/test/testoptimization.jl:46
The followings are the packages I'm uisng:
[7da242da] Enzyme v0.12.6
[7f7a1694] Optimization v3.25.0
[bca83a33] OptimizationBase v0.0.7 `https://github.com/SciML/OptimizationBase.jl#ChrisRackauckas-patch-1`
[36348300] OptimizationOptimJL v0.2.3
from optimization.jl.
Well that's progress. Why DJUICE.FemModel
is doubled is a good question.
from optimization.jl.
Interesting.
Enzyme.autodiff(Enzyme.Reverse, DJUICE.costfunction, Duplicated(α, ∂J_∂α), Duplicated(femmodel,dfemmodel))
works
sol.cache.f.f(prob.u0, prob.p)
also works for me.
This error only occurs when I call
sol.cache.f.grad(∂J_∂α, prob.u0, prob.p)
And, the solution from optimization did not change.
from optimization.jl.
Related Issues (20)
- Include `searchdirection` in `OptimizationState` HOT 2
- The `callback` appears to be called for linesearch iterations HOT 1
- `PolyOpt` only accept functions without any extra inputs HOT 1
- US spelling preferred? HOT 1
- Augmented Lagrangian HOT 5
- Multithreading support for Optimizers like BBO
- Is there currently a feasible way to use NamedTuple or ComponentArray as x0 for Optimization.jl HOT 1
- How to get latest minimizer (u) instead of the best one for optimization? HOT 5
- Callback signature doesn't match with the docs for PRIMA HOT 1
- BBO always returns retcode Failure HOT 1
- ERROR: UndefVarError: `NoAD` not defined HOT 5
- callback-generated stopping criteria no longer work in OptimizationNLopt HOT 9
- BFGS fails with user-supplied derivative and bounds (regression in v3.25.0, v3.25.1)
- OptimizationOptimJL.Optim.BFGS() missing tests for user-supplied derivatives (grad), upper/lower bounds, and the combination
- Reopen issue 755 : OptimizationOptimJL.Optim.BFGS() missing tests for user-supplied derivatives (grad), upper/lower bounds, and the combination
- FORCED_STOP from OptimizationNLopt callback returns best point PRIOR to callback, making it unuseful for custom stopping criteria. Is that intended? HOT 2
- Update `OptimizationPRIMA` `[compat]` for `PRIMA` to `0.2.0` HOT 1
- OptimizationOptimJL fails to precompile HOT 2
- Disassociate batching from the `data` arg to `solve` and remove `data`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from optimization.jl.