Skip to content

Commit

Permalink
Update the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Dec 21, 2024
1 parent 9b3b90e commit d110e83
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
10 changes: 5 additions & 5 deletions docs/src/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ The functions used internally to define the NLPModel API and the possible backen
| Functions | FowardDiff backends | ReverseDiff backends | Zygote backends | Enzyme backend | Sparse backend |
| --------- | ------------------- | -------------------- | --------------- | -------------- | -------------- |
| `gradient` and `gradient!` | `ForwardDiffADGradient`/`GenericForwardDiffADGradient` | `ReverseDiffADGradient`/`GenericReverseDiffADGradient` | `ZygoteADGradient` | `EnzymeADGradient` | -- |
| `jacobian` | `ForwardDiffADJacobian` | `ReverseDiffADJacobian` | `ZygoteADJacobian` | -- | `SparseADJacobian` |
| `hessian` | `ForwardDiffADHessian` | `ReverseDiffADHessian` | `ZygoteADHessian` | -- | `SparseADHessian`/`SparseReverseADHessian` |
| `Jprod` | `ForwardDiffADJprod`/`GenericForwardDiffADJprod` | `ReverseDiffADJprod`/`GenericReverseDiffADJprod` | `ZygoteADJprod` | -- | -- |
| `Jtprod` | `ForwardDiffADJtprod`/`GenericForwardDiffADJtprod` | `ReverseDiffADJtprod`/`GenericReverseDiffADJtprod` | `ZygoteADJtprod` | -- | -- |
| `Hvprod` | `ForwardDiffADHvprod`/`GenericForwardDiffADHvprod` | `ReverseDiffADHvprod`/`GenericReverseDiffADHvprod` | -- | -- | -- |
| `jacobian` | `ForwardDiffADJacobian` | `ReverseDiffADJacobian` | `ZygoteADJacobian` | `EnzymeADJacobian` | `SparseADJacobian` |
| `hessian` | `ForwardDiffADHessian` | `ReverseDiffADHessian` | `ZygoteADHessian` | `EnzymeADHessian` | `SparseADHessian`/`SparseReverseADHessian` |
| `Jprod` | `ForwardDiffADJprod`/`GenericForwardDiffADJprod` | `ReverseDiffADJprod`/`GenericReverseDiffADJprod` | `ZygoteADJprod` | `EnzymeADJprod` | -- |
| `Jtprod` | `ForwardDiffADJtprod`/`GenericForwardDiffADJtprod` | `ReverseDiffADJtprod`/`GenericReverseDiffADJtprod` | `ZygoteADJtprod` | `EnzymeADJtprod` | -- |
| `Hvprod` | `ForwardDiffADHvprod`/`GenericForwardDiffADHvprod` | `ReverseDiffADHvprod`/`GenericReverseDiffADHvprod` | -- | `EnzymeADHvprod` | -- |
| `directional_second_derivative` | `ForwardDiffADGHjvprod` | -- | -- | -- | -- |

The functions `hess_structure!`, `hess_coord!`, `jac_structure!` and `jac_coord!` defined in `ad.jl` are generic to all the backends for now.
Expand Down
14 changes: 14 additions & 0 deletions docs/src/predefined.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,17 @@ It is possible to use these pre-defined backends using the keyword argument `bac
nlp = ADNLPModel!(f, x0, lvar, uvar, c!, lcon, ucon, backend = :optimized)
get_adbackend(nlp)
```

The backend `:enzyme` focuses on backend based on [Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl).

```@example ex1
nlp = ADNLPModel!(f, x0, lvar, uvar, c!, lcon, ucon, backend = :enzyme)
get_adbackend(nlp)
```

The backend `:zygote` focuses on backend based on [Zygote.jl](https://github.com/FluxML/Zygote.jl).

```@example ex1
nlp = ADNLPModel!(f, x0, lvar, uvar, c!, lcon, ucon, backend = :zygote)
get_adbackend(nlp)
```
8 changes: 4 additions & 4 deletions src/predefined_backend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ enzyme_backend = Dict(
:jprod_backend => EnzymeReverseADJprod,
:jtprod_backend => EnzymeReverseADJtprod,
:hprod_backend => EnzymeReverseADHvprod,
:jacobian_backend => EnzymeReverseADJacobian,
:hessian_backend => EnzymeReverseADHessian,
:jacobian_backend => SparseEnzymeADJacobian,
:hessian_backend => SparseEnzymeADHessian,
:ghjvprod_backend => ForwardDiffADGHjvprod,
:jprod_residual_backend => EnzymeReverseADJprod,
:jtprod_residual_backend => EnzymeReverseADJtprod,
:hprod_residual_backend => EnzymeReverseADHvprod,
:jacobian_residual_backend => EnzymeReverseADJacobian,
:hessian_residual_backend => EnzymeReverseADHessian,
:jacobian_residual_backend => SparseEnzymeADJacobian,
:hessian_residual_backend => SparseEnzymeADHessian,
)

zygote_backend = Dict(
Expand Down

0 comments on commit d110e83

Please sign in to comment.