Skip to content
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

Support Enzyme.jl #314

Merged
merged 44 commits into from
Dec 21, 2024
Merged

Support Enzyme.jl #314

merged 44 commits into from
Dec 21, 2024

Conversation

amontoison
Copy link
Member

@amontoison amontoison commented Nov 27, 2024

Just opened for CI, will be included in #311
-> Compute sparse jacobian with Enzyme.

Copy link
Contributor

github-actions bot commented Nov 27, 2024

Package name latest stable
ExpressionTreeForge
JSOSuite
PartiallySeparableNLPModels
PartiallySeparableSolvers
SolverTest

@amontoison
Copy link
Member Author

@michel2323

Basic Hessian derivative with backend=ADNLPModels.SparseEnzymeADHessian and T=Float32: Test Failed at /cache/build/tester-amdci4-13/julialang/adnlpmodels-dot-jl/test/sparse_hessian.jl:76
  Expression: H == [x[2] 0; x[1] + x[2] x[1]] + y[2] * [-20 0; 0 0]
   Evaluated: sparse([1, 2, 2], [1, 1, 2], Float32[0.15454096, 0.81299055, 0.6584496], 2, 2) == Float32[-2.5177271 0.0; 0.81299055 0.6584496]

@amontoison amontoison marked this pull request as ready for review December 4, 2024 16:11
@amontoison amontoison mentioned this pull request Dec 20, 2024
@amontoison amontoison changed the title Am/sparse enzyme Support Enzyme.jl Dec 21, 2024
@amontoison
Copy link
Member Author

@michel2323
I have this error with the latest release of Enzyme.jl:

Basic Hessian derivative with backend=ADNLPModels.SparseEnzymeADHessian and T=Float64: Error During Test at /cache/build/tester-amdci4-13/julialang/adnlpmodels-dot-jl/test/sparse_hessian.jl:73
  Test threw exception
  Expression: hess(nlp, x) == T[802 -400 0 0; -400 1002 -400 0; 0 -400 1002 -400; 0 0 -400 200]
  Constant memory is stored (or returned) to a differentiable variable.
  As a result, Enzyme cannot provably ensure correctness and throws this error.
  This might be due to the use of a constant variable as temporary storage for active memory (https://enzyme.mit.edu/julia/stable/faq/#Runtime-Activity).
  If Enzyme should be able to prove this use non-differentable, open an issue!
  To work around this issue, either:
   a) rewrite this variable to not be conditionally active (fastest, but requires a code change), or
   b) set the Enzyme mode to turn on runtime activity (e.g. autodiff(set_runtime_activity(Reverse), ...) ). This will maintain correctness, but may slightly reduce performance.

It is in the sparse Hessian of the Lagrangian.
Do you have an idea of what is the issue?

@amontoison amontoison merged commit 9988f4e into main Dec 21, 2024
29 of 31 checks passed
@amontoison amontoison deleted the am/sparse_enzyme branch December 21, 2024 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants