From b4ce45d49b435c2481df3fe86388024bfa2950c1 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 16 Jan 2024 09:47:35 -0500 Subject: [PATCH 1/4] Default to polyester forward diff --- Project.toml | 8 ++++++-- docs/src/tutorials/large_systems.md | 1 + ext/NonlinearSolvePolyesterForwardDiffExt.jl | 7 +++++++ src/internal/helpers.jl | 9 ++++++++- 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 ext/NonlinearSolvePolyesterForwardDiffExt.jl diff --git a/Project.toml b/Project.toml index 81ac8a571..1197aadb9 100644 --- a/Project.toml +++ b/Project.toml @@ -36,6 +36,7 @@ FixedPointAcceleration = "817d07cb-a79a-5c30-9a31-890123675176" LeastSquaresOptim = "0fc2ff8b-aaa3-5acd-a817-1944a5e08891" MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9" NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" +PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b" SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4" SpeedMapping = "f1835b91-879b-4a3f-a438-e4baacf14412" Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" @@ -48,6 +49,7 @@ NonlinearSolveFixedPointAccelerationExt = "FixedPointAcceleration" NonlinearSolveLeastSquaresOptimExt = "LeastSquaresOptim" NonlinearSolveMINPACKExt = "MINPACK" NonlinearSolveNLsolveExt = "NLsolve" +NonlinearSolvePolyesterForwardDiffExt = "PolyesterForwardDiff" NonlinearSolveSIAMFANLEquationsExt = "SIAMFANLEquations" NonlinearSolveSpeedMappingExt = "SpeedMapping" NonlinearSolveSymbolicsExt = "Symbolics" @@ -83,6 +85,7 @@ Pkg = "1.10" PrecompileTools = "1.2" Preferences = "1.4" Printf = "1.10" +PolyesterForwardDiff = "0.1.1" Random = "1.91" RecursiveArrayTools = "3.4" Reexport = "1.2" @@ -91,7 +94,7 @@ SafeTestsets = "0.1" SciMLBase = "2.19.0" SimpleNonlinearSolve = "1.2" SparseArrays = "1.10" -SparseDiffTools = "2.14" +SparseDiffTools = "2.16" SpeedMapping = "0.3" StableRNGs = "1" StaticArrays = "1.7" @@ -121,6 +124,7 @@ NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" NonlinearProblemLibrary = "b7050fa9-e91f-4b37-bcee-a89a063da141" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" @@ -134,4 +138,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [targets] -test = ["Aqua", "Enzyme", "BenchmarkTools", "SafeTestsets", "Pkg", "Test", "ForwardDiff", "StaticArrays", "Symbolics", "LinearSolve", "Random", "LinearAlgebra", "Zygote", "SparseDiffTools", "NonlinearProblemLibrary", "LeastSquaresOptim", "FastLevenbergMarquardt", "NaNMath", "BandedMatrices", "DiffEqBase", "StableRNGs", "MINPACK", "NLsolve", "OrdinaryDiffEq", "SpeedMapping", "FixedPointAcceleration", "SIAMFANLEquations", "Sundials"] +test = ["Aqua", "Enzyme", "BenchmarkTools", "SafeTestsets", "Pkg", "Test", "ForwardDiff", "StaticArrays", "Symbolics", "LinearSolve", "Random", "LinearAlgebra", "Zygote", "SparseDiffTools", "NonlinearProblemLibrary", "LeastSquaresOptim", "FastLevenbergMarquardt", "NaNMath", "BandedMatrices", "DiffEqBase", "StableRNGs", "MINPACK", "NLsolve", "OrdinaryDiffEq", "SpeedMapping", "FixedPointAcceleration", "SIAMFANLEquations", "Sundials", "PolyesterForwardDiff"] diff --git a/docs/src/tutorials/large_systems.md b/docs/src/tutorials/large_systems.md index 38242c19f..4b9856b8b 100644 --- a/docs/src/tutorials/large_systems.md +++ b/docs/src/tutorials/large_systems.md @@ -61,6 +61,7 @@ The resulting `NonlinearProblem` definition is: ```@example ill_conditioned_nlprob using NonlinearSolve, LinearAlgebra, SparseArrays, LinearSolve, SparseDiffTools +import PolyesterForwardDiff const N = 32 const xyd_brusselator = range(0, stop = 1, length = N) diff --git a/ext/NonlinearSolvePolyesterForwardDiffExt.jl b/ext/NonlinearSolvePolyesterForwardDiffExt.jl new file mode 100644 index 000000000..52de8335f --- /dev/null +++ b/ext/NonlinearSolvePolyesterForwardDiffExt.jl @@ -0,0 +1,7 @@ +module NonlinearSolvePolyesterForwardDiffExt + +using NonlinearSolve, PolyesterForwardDiff + +NonlinearSolve.is_extension_loaded(::Val{:PolyesterForwardDiff}) = true + +end diff --git a/src/internal/helpers.jl b/src/internal/helpers.jl index 8f18686db..9fb3d838e 100644 --- a/src/internal/helpers.jl +++ b/src/internal/helpers.jl @@ -63,7 +63,14 @@ function get_concrete_forward_ad(autodiff, prob, sp::Val{test_sparse} = True, ar use_sparse_ad ? AutoSparseFiniteDiff() : AutoFiniteDiff() else tag = ForwardDiff.Tag(NonlinearSolveTag(), eltype(prob.u0)) - (use_sparse_ad ? AutoSparseForwardDiff : AutoForwardDiff)(; tag) + if use_sparse_ad + AutoSparseForwardDiff(; tag) # Polyester Sparse Mode is not implemented yet + elseif is_extension_loaded(Val(:PolyesterForwardDiff)) && + !(prob.u0 isa Number || prob.u0 isa SArray) + AutoPolyesterForwardDiff() + else + AutoForwardDiff(; tag) + end end return ad end From c9f7d3c969428725f556e6a2380848ca2041c049 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 30 Jan 2024 02:21:16 -0500 Subject: [PATCH 2/4] Revert "Default to polyester forward diff" This reverts commit bb62c6c53db671b3de2d917983f170bce1f4cf7d. --- Project.toml | 8 ++------ docs/src/tutorials/large_systems.md | 1 - ext/NonlinearSolvePolyesterForwardDiffExt.jl | 7 ------- src/internal/helpers.jl | 9 +-------- 4 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 ext/NonlinearSolvePolyesterForwardDiffExt.jl diff --git a/Project.toml b/Project.toml index 1197aadb9..81ac8a571 100644 --- a/Project.toml +++ b/Project.toml @@ -36,7 +36,6 @@ FixedPointAcceleration = "817d07cb-a79a-5c30-9a31-890123675176" LeastSquaresOptim = "0fc2ff8b-aaa3-5acd-a817-1944a5e08891" MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9" NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" -PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b" SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4" SpeedMapping = "f1835b91-879b-4a3f-a438-e4baacf14412" Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" @@ -49,7 +48,6 @@ NonlinearSolveFixedPointAccelerationExt = "FixedPointAcceleration" NonlinearSolveLeastSquaresOptimExt = "LeastSquaresOptim" NonlinearSolveMINPACKExt = "MINPACK" NonlinearSolveNLsolveExt = "NLsolve" -NonlinearSolvePolyesterForwardDiffExt = "PolyesterForwardDiff" NonlinearSolveSIAMFANLEquationsExt = "SIAMFANLEquations" NonlinearSolveSpeedMappingExt = "SpeedMapping" NonlinearSolveSymbolicsExt = "Symbolics" @@ -85,7 +83,6 @@ Pkg = "1.10" PrecompileTools = "1.2" Preferences = "1.4" Printf = "1.10" -PolyesterForwardDiff = "0.1.1" Random = "1.91" RecursiveArrayTools = "3.4" Reexport = "1.2" @@ -94,7 +91,7 @@ SafeTestsets = "0.1" SciMLBase = "2.19.0" SimpleNonlinearSolve = "1.2" SparseArrays = "1.10" -SparseDiffTools = "2.16" +SparseDiffTools = "2.14" SpeedMapping = "0.3" StableRNGs = "1" StaticArrays = "1.7" @@ -124,7 +121,6 @@ NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" NonlinearProblemLibrary = "b7050fa9-e91f-4b37-bcee-a89a063da141" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" @@ -138,4 +134,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [targets] -test = ["Aqua", "Enzyme", "BenchmarkTools", "SafeTestsets", "Pkg", "Test", "ForwardDiff", "StaticArrays", "Symbolics", "LinearSolve", "Random", "LinearAlgebra", "Zygote", "SparseDiffTools", "NonlinearProblemLibrary", "LeastSquaresOptim", "FastLevenbergMarquardt", "NaNMath", "BandedMatrices", "DiffEqBase", "StableRNGs", "MINPACK", "NLsolve", "OrdinaryDiffEq", "SpeedMapping", "FixedPointAcceleration", "SIAMFANLEquations", "Sundials", "PolyesterForwardDiff"] +test = ["Aqua", "Enzyme", "BenchmarkTools", "SafeTestsets", "Pkg", "Test", "ForwardDiff", "StaticArrays", "Symbolics", "LinearSolve", "Random", "LinearAlgebra", "Zygote", "SparseDiffTools", "NonlinearProblemLibrary", "LeastSquaresOptim", "FastLevenbergMarquardt", "NaNMath", "BandedMatrices", "DiffEqBase", "StableRNGs", "MINPACK", "NLsolve", "OrdinaryDiffEq", "SpeedMapping", "FixedPointAcceleration", "SIAMFANLEquations", "Sundials"] diff --git a/docs/src/tutorials/large_systems.md b/docs/src/tutorials/large_systems.md index 4b9856b8b..38242c19f 100644 --- a/docs/src/tutorials/large_systems.md +++ b/docs/src/tutorials/large_systems.md @@ -61,7 +61,6 @@ The resulting `NonlinearProblem` definition is: ```@example ill_conditioned_nlprob using NonlinearSolve, LinearAlgebra, SparseArrays, LinearSolve, SparseDiffTools -import PolyesterForwardDiff const N = 32 const xyd_brusselator = range(0, stop = 1, length = N) diff --git a/ext/NonlinearSolvePolyesterForwardDiffExt.jl b/ext/NonlinearSolvePolyesterForwardDiffExt.jl deleted file mode 100644 index 52de8335f..000000000 --- a/ext/NonlinearSolvePolyesterForwardDiffExt.jl +++ /dev/null @@ -1,7 +0,0 @@ -module NonlinearSolvePolyesterForwardDiffExt - -using NonlinearSolve, PolyesterForwardDiff - -NonlinearSolve.is_extension_loaded(::Val{:PolyesterForwardDiff}) = true - -end diff --git a/src/internal/helpers.jl b/src/internal/helpers.jl index 9fb3d838e..8f18686db 100644 --- a/src/internal/helpers.jl +++ b/src/internal/helpers.jl @@ -63,14 +63,7 @@ function get_concrete_forward_ad(autodiff, prob, sp::Val{test_sparse} = True, ar use_sparse_ad ? AutoSparseFiniteDiff() : AutoFiniteDiff() else tag = ForwardDiff.Tag(NonlinearSolveTag(), eltype(prob.u0)) - if use_sparse_ad - AutoSparseForwardDiff(; tag) # Polyester Sparse Mode is not implemented yet - elseif is_extension_loaded(Val(:PolyesterForwardDiff)) && - !(prob.u0 isa Number || prob.u0 isa SArray) - AutoPolyesterForwardDiff() - else - AutoForwardDiff(; tag) - end + (use_sparse_ad ? AutoSparseForwardDiff : AutoForwardDiff)(; tag) end return ad end From b04170ecfdf45aa5e055d1706010714118d324ab Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 30 Jan 2024 06:51:48 -0500 Subject: [PATCH 3/4] Documentation for AD Backends --- .github/workflows/Documentation.yml | 2 +- docs/pages.jl | 1 + docs/src/basics/autodiff.md | 51 ++++++++++ src/NonlinearSolve.jl | 3 +- src/adtypes.jl | 148 ++++++++++++++++++++++++++++ 5 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 docs/src/basics/autodiff.md create mode 100644 src/adtypes.jl diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index 73a1826ca..b926cb4fd 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -23,7 +23,7 @@ jobs: JULIA_DEBUG: "Documenter" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key - run: julia --project=docs/ --code-coverage=user docs/make.jl + run: julia --project=docs/ --code-coverage=user --color=yes docs/make.jl - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v3 with: diff --git a/docs/pages.jl b/docs/pages.jl index 9b15d694a..5c77d7f2c 100644 --- a/docs/pages.jl +++ b/docs/pages.jl @@ -13,6 +13,7 @@ pages = [ "basics/nonlinear_functions.md", "basics/solve.md", "basics/nonlinear_solution.md", + "basics/autodiff.md", "basics/termination_condition.md", "basics/diagnostics_api.md", "basics/sparsity_detection.md", diff --git a/docs/src/basics/autodiff.md b/docs/src/basics/autodiff.md new file mode 100644 index 000000000..a49af7578 --- /dev/null +++ b/docs/src/basics/autodiff.md @@ -0,0 +1,51 @@ +# Automatic Differentiation Backends + +## Summary of Finite Differencing Backends + + - [`AutoFiniteDiff`](@ref): Finite differencing, not optimal but always applicable. + - [`AutoSparseFiniteDiff`](@ref): Sparse version of [`AutoFiniteDiff`](@ref). + +## Summary of Forward Mode AD Backends + + - [`AutoForwardDiff`](@ref): The best choice for dense problems. + - [`AutoSparseForwardDiff`](@ref): Sparse version of [`AutoForwardDiff`](@ref). + - [`AutoPolyesterForwardDiff`](@ref): Might be faster than [`AutoForwardDiff`](@ref) for + large problems. Requires `PolyesterForwardDiff.jl` to be installed and loaded. + +## Summary of Reverse Mode AD Backends + + - [`AutoZygote`](@ref): The fastest choice for non-mutating array-based (BLAS) functions. + - [`AutoSparseZygote`](@ref): Sparse version of [`AutoZygote`](@ref). + - [`AutoEnzyme`](@ref): Uses `Enzyme.jl` Reverse Mode and should be considered + experimental. + +!!! note + + If `PolyesterForwardDiff.jl` is installed and loaded, then `SimpleNonlinearSolve.jl` + will automatically use `AutoPolyesterForwardDiff` as the default AD backend. + +## API Reference + +### Finite Differencing Backends + +```@docs +AutoFiniteDiff +AutoSparseFiniteDiff +``` + +### Forward Mode AD Backends + +```@docs +AutoForwardDiff +AutoSparseForwardDiff +AutoPolyesterForwardDiff +``` + +### Reverse Mode AD Backends + +```@docs +AutoZygote +AutoSparseZygote +AutoEnzyme +NonlinearSolve.AutoSparseEnzyme +``` diff --git a/src/NonlinearSolve.jl b/src/NonlinearSolve.jl index 2f3d0cf13..a2321ef83 100644 --- a/src/NonlinearSolve.jl +++ b/src/NonlinearSolve.jl @@ -24,7 +24,7 @@ import PrecompileTools: @recompile_invalidations, @compile_workload, @setup_work import SciMLBase: AbstractNonlinearAlgorithm, JacobianWrapper, AbstractNonlinearProblem, AbstractSciMLOperator, NLStats, _unwrap_val, has_jac, isinplace - import SparseDiffTools: AbstractSparsityDetection + import SparseDiffTools: AbstractSparsityDetection, AutoSparseEnzyme import StaticArraysCore: StaticArray, SVector, SArray, MArray, Size, SMatrix, MMatrix end @@ -40,6 +40,7 @@ const True = Val(true) const False = Val(false) include("abstract_types.jl") +include("adtypes.jl") include("timer_outputs.jl") include("internal/helpers.jl") diff --git a/src/adtypes.jl b/src/adtypes.jl new file mode 100644 index 000000000..45507ecdf --- /dev/null +++ b/src/adtypes.jl @@ -0,0 +1,148 @@ +# This just documents the AD types from ADTypes.jl + +""" + AutoFiniteDiff(; fdtype = Val(:forward), fdjtype = fdtype, fdhtype = Val(:hcentral)) + +This uses [FiniteDiff.jl](https://github.com/JuliaDiff/FiniteDiff.jl). While not necessarily +the most efficient, this is the only choice that doesn't require the `f` function to be +automatically differentiable, which means it applies to any choice. However, because it's +using finite differencing, one needs to be careful as this procedure introduces numerical +error into the derivative estimates. + + - Compatible with GPUs + - Can be used for Jacobian-Vector Products (JVPs) + - Can be used for Vector-Jacobian Products (VJPs) + - Supports both inplace and out-of-place functions + +### Keyword Arguments + + - `fdtype`: the method used for defining the gradient + - `fdjtype`: the method used for defining the Jacobian of constraints. + - `fdhtype`: the method used for defining the Hessian +""" +AutoFiniteDiff + +""" + AutoSparseFiniteDiff() + +Sparse Version of [`AutoFiniteDiff`](@ref) that uses +[FiniteDiff.jl](https://github.com/JuliaDiff/FiniteDiff.jl) and the column color vector of +the Jacobian Matrix to efficiently compute the Sparse Jacobian. + + - Supports both inplace and out-of-place functions +""" +AutoSparseFiniteDiff + +""" + AutoForwardDiff(; chunksize = nothing, tag = nothing) + AutoForwardDiff{chunksize, tagType}(tag::tagType) + +This uses the [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl) package. It is +the fastest choice for square or wide systems. It is easy to use and compatible with most +Julia functions which have loose type restrictions. + + - Compatible with GPUs + - Can be used for Jacobian-Vector Products (JVPs) + - Supports both inplace and out-of-place functions + +For type-stability of internal operations, a positive `chunksize` must be provided. + +### Keyword Arguments + + - `chunksize`: Count of dual numbers that can be propagated simultaneously. Setting this + number to a high value will lead to slowdowns. Use + [`NonlinearSolve.pickchunksize`](@ref) to get a proper value. + - `tag`: Used to avoid perturbation confusion. If set to `nothing`, we use a custom tag. +""" +AutoForwardDiff + +""" + AutoSparseForwardDiff(; chunksize = nothing, tag = nothing) + AutoSparseForwardDiff{chunksize, tagType}(tag::tagType) + +Sparse Version of [`AutoForwardDiff`](@ref) that uses +[ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl) and the column color vector of +the Jacobian Matrix to efficiently compute the Sparse Jacobian. + + - Supports both inplace and out-of-place functions + +For type-stability of internal operations, a positive `chunksize` must be provided. + +### Keyword Arguments + + - `chunksize`: Count of dual numbers that can be propagated simultaneously. Setting this + number to a high value will lead to slowdowns. Use + [`NonlinearSolve.pickchunksize`](@ref) to get a proper value. + - `tag`: Used to avoid perturbation confusion. If set to `nothing`, we use a custom tag. +""" +AutoSparseForwardDiff + +""" + AutoPolyesterForwardDiff(; chunksize = nothing) + +Uses [`PolyesterForwardDiff.jl`](https://github.com/JuliaDiff/PolyesterForwardDiff.jl) +to compute the jacobian. This is essentially parallelized `ForwardDiff.jl`. + + - Supports both inplace and out-of-place functions + +### Keyword Arguments + + - `chunksize`: Count of dual numbers that can be propagated simultaneously. Setting + this number to a high value will lead to slowdowns. Use + [`NonlinearSolve.pickchunksize`](@ref) to get a proper value. +""" +AutoPolyesterForwardDiff + +""" + AutoZygote() + +Uses [`Zygote.jl`](https://github.com/FluxML/Zygote.jl) package. This is the staple +reverse-mode AD that handles a large portion of Julia with good efficiency. + + - Compatible with GPUs + - Can be used for Vector-Jacobian Products (VJPs) + - Supports only out-of-place functions + +For VJPs this is the current best choice. This is the most efficient method for long +jacobians. +""" +AutoZygote + +""" + AutoSparseZygote() + +Sparse version of [`AutoZygote`](@ref) that uses +[`Zygote.jl`](https://github.com/FluxML/Zygote.jl) and the row color vector of +the Jacobian Matrix to efficiently compute the Sparse Jacobian. + + - Supports only out-of-place functions + +This is efficient only for long jacobians or if the maximum value of the row color vector is +significantly lower than the maximum value of the column color vector. +""" +AutoSparseZygote + +""" + AutoEnzyme() + +Uses reverse mode [Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl). This is currently +experimental, and not extensively tested on our end. We only support Jacobian construction +and VJP support is currently not implemented. + + - Supports both inplace and out-of-place functions +""" +AutoEnzyme + +""" + AutoSparseEnzyme() + +Sparse version of [`AutoEnzyme`](@ref) that uses +[Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl) and the row color vector of +the Jacobian Matrix to efficiently compute the Sparse Jacobian. + + - Supports both inplace and out-of-place functions + +This is efficient only for long jacobians or if the maximum value of the row color vector is +significantly lower than the maximum value of the column color vector. +""" +AutoSparseEnzyme From 812f6fba461528b40013c049cfb0094a7c96fba5 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Mon, 5 Feb 2024 09:00:19 -0500 Subject: [PATCH 4/4] Add a note on sparse --- docs/src/basics/autodiff.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/src/basics/autodiff.md b/docs/src/basics/autodiff.md index a49af7578..73e096a4b 100644 --- a/docs/src/basics/autodiff.md +++ b/docs/src/basics/autodiff.md @@ -24,6 +24,17 @@ If `PolyesterForwardDiff.jl` is installed and loaded, then `SimpleNonlinearSolve.jl` will automatically use `AutoPolyesterForwardDiff` as the default AD backend. +!!! note + + The `Sparse` versions of the methods refers to automated sparsity detection. These + methods automatically discover the sparse Jacobian form from the function `f`. Note that + all methods specialize the differentiation on a sparse Jacobian if the sparse Jacobian + is given as `prob.f.jac_prototype` in the `NonlinearFunction` definition, and the + `AutoSparse` here simply refers to whether this `jac_prototype` should be generated + automatically. For more details, see + [SparseDiffTools.jl](https://github.com/JuliaDiff/SparseDiffTools.jl) and + [Sparsity Detection Manual Entry](@ref sparsity-detection). + ## API Reference ### Finite Differencing Backends