Skip to content

Commit a6f4cbd

Browse files
committed
Merge branch 'main' into gd/coherent_map
2 parents 7c97dd8 + 8ef803c commit a6f4cbd

138 files changed

Lines changed: 5547 additions & 2996 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/Test.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ jobs:
3131
- "1.10"
3232
- "1"
3333
group:
34-
- Misc/Internals
35-
- Misc/DifferentiateWith
36-
- Misc/FromPrimitive
37-
- Misc/SparsityDetector
38-
- Misc/ZeroBackends
39-
- Back/ChainRulesBackends
34+
- Core/Internals
35+
- Back/DifferentiateWith
36+
- Core/SimpleFiniteDiff
37+
- Back/SparsityDetector
38+
- Core/ZeroBackends
39+
- Back/ChainRules
40+
# - Back/Diffractor
4041
- Back/Enzyme
4142
- Back/FiniteDiff
4243
- Back/FiniteDifferences
4344
- Back/ForwardDiff
45+
- Back/GTPSA
4446
- Back/Mooncake
4547
- Back/PolyesterForwardDiff
4648
- Back/ReverseDiff
@@ -52,12 +54,10 @@ jobs:
5254
skip_lts:
5355
- ${{ github.event.pull_request.draft }}
5456
exclude:
55-
# - skip_lts: true
56-
# version: "1.10"
57+
- skip_lts: true
58+
version: "1.10"
5759
- version: "1"
58-
group: Back/ChainRulesBackends
59-
- version: "1"
60-
group: Back/Enzyme
60+
group: Back/ChainRules
6161
env:
6262
JULIA_DI_TEST_GROUP: ${{ matrix.group }}
6363
steps:
@@ -76,11 +76,10 @@ jobs:
7676
- uses: julia-actions/julia-processcoverage@v1
7777
with:
7878
directories: ./DifferentiationInterface/src,./DifferentiationInterface/ext,./DifferentiationInterface/test
79-
- uses: codecov/codecov-action@v4
79+
- uses: codecov/codecov-action@v5
8080
with:
8181
files: lcov.info
8282
flags: DI
83-
name: ${{ matrix.version }} - DI (${{ matrix.group }})
8483
token: ${{ secrets.CODECOV_TOKEN }}
8584
fail_ci_if_error: true
8685

@@ -105,9 +104,9 @@ jobs:
105104
- Weird
106105
skip_lts:
107106
- ${{ github.event.pull_request.draft }}
108-
# exclude:
109-
# - skip_lts: true
110-
# version: "1.10"
107+
exclude:
108+
- skip_lts: true
109+
version: "1.10"
111110
env:
112111
JULIA_DIT_TEST_GROUP: ${{ matrix.group }}
113112
steps:
@@ -126,10 +125,9 @@ jobs:
126125
- uses: julia-actions/julia-processcoverage@v1
127126
with:
128127
directories: ./DifferentiationInterfaceTest/src,./DifferentiationInterfaceTest/ext,./DifferentiationInterfaceTest/test
129-
- uses: codecov/codecov-action@v4
128+
- uses: codecov/codecov-action@v5
130129
with:
131130
files: lcov.info
132131
flags: DIT
133-
name: ${{ matrix.version }} - DIT (${{ matrix.group }})
134132
token: ${{ secrets.CODECOV_TOKEN }}
135133
fail_ci_if_error: true

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010

1111
*.csv
1212

13-
playground.jl
13+
playground.jl
14+
.vscode

CITATION.bib

Lines changed: 0 additions & 15 deletions
This file was deleted.

CITATION.cff

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This CITATION.cff file was generated with cffinit.
2+
# Visit https://bit.ly/cffinit to generate yours today!
3+
4+
cff-version: 1.2.0
5+
title: DifferentiationInterface.jl
6+
message: >-
7+
If you use this software, please cite it using the
8+
metadata from this file, and also cite the AbstractDifferentiation.jl software.
9+
type: software
10+
authors:
11+
- given-names: Guillaume
12+
family-names: Dalle
13+
email: guillaume.dalle@enpc.fr
14+
affiliation: >-
15+
LVMT, ENPC, Institut Polytechnique de Paris, Univ
16+
Gustave Eiffel, Marne-la-Vallée, France
17+
orcid: 'https://orcid.org/0000-0003-4866-1687'
18+
- given-names: Adrian
19+
family-names: Hill
20+
email: hill@tu-berlin.de
21+
affiliation: 'Machine Learning Group, BIFOLD, TU Berlin'
22+
orcid: 'https://orcid.org/0009-0009-5977-301X'
23+
identifiers:
24+
- type: doi
25+
value: 10.5281/zenodo.11092033
26+
description: Zenodo DOI
27+
repository-code: 'https://github.com/JuliaDiff/DifferentiationInterface.jl'
28+
abstract: >-
29+
An interface to various automatic differentiation backends
30+
in Julia.
31+
keywords:
32+
- automatic differentiation
33+
- julia
34+
license: MIT
35+
references:
36+
- title: >-
37+
AbstractDifferentiation.jl: Backend-Agnostic
38+
Differentiable Programming in Julia
39+
type: software
40+
authors:
41+
- given-names: Frank
42+
family-names: Schäfer
43+
orcid: 'https://orcid.org/0000-0003-2684-4984'
44+
- given-names: Mohamed
45+
family-names: Tarek
46+
orcid: 'https://orcid.org/0000-0003-3074-0678'
47+
- given-names: Lyndon
48+
family-names: White
49+
orcid: 'https://orcid.org/0000-0003-1386-1646'
50+
- given-names: Chris
51+
family-names: Rackauckas
52+
orcid: 'https://orcid.org/0000-0001-5850-0663'
53+
identifiers:
54+
- type: other
55+
value: 'https://arxiv.org/abs/2109.12449'
56+
description: Arxiv
57+
repository-code: 'https://github.com/JuliaDiff/AbstractDifferentiation.jl'
58+
abstract: An abstract interface for automatic differentiation.
59+
license: MIT

DifferentiationInterface/Project.toml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
name = "DifferentiationInterface"
22
uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
33
authors = ["Guillaume Dalle", "Adrian Hill"]
4-
version = "0.6.22"
4+
version = "0.6.35"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
99

1010
[weakdeps]
1111
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
12+
DiffResults = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
1213
Diffractor = "9f5e2b26-1114-432f-b630-d3fe2085c51c"
1314
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
15+
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
1416
FastDifferentiation = "eb9bf01b-bf85-4b60-bf87-ee5de06c00be"
1517
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
1618
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
1719
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
20+
GTPSA = "b27dd330-f138-47c5-815b-40db9dd9b6e8"
1821
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
1922
PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b"
2023
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
@@ -28,14 +31,15 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
2831
[extensions]
2932
DifferentiationInterfaceChainRulesCoreExt = "ChainRulesCore"
3033
DifferentiationInterfaceDiffractorExt = "Diffractor"
31-
DifferentiationInterfaceEnzymeExt = "Enzyme"
34+
DifferentiationInterfaceEnzymeExt = ["EnzymeCore", "Enzyme"]
3235
DifferentiationInterfaceFastDifferentiationExt = "FastDifferentiation"
3336
DifferentiationInterfaceFiniteDiffExt = "FiniteDiff"
3437
DifferentiationInterfaceFiniteDifferencesExt = "FiniteDifferences"
35-
DifferentiationInterfaceForwardDiffExt = "ForwardDiff"
38+
DifferentiationInterfaceForwardDiffExt = ["ForwardDiff", "DiffResults"]
39+
DifferentiationInterfaceGTPSAExt = "GTPSA"
3640
DifferentiationInterfaceMooncakeExt = "Mooncake"
3741
DifferentiationInterfacePolyesterForwardDiffExt = "PolyesterForwardDiff"
38-
DifferentiationInterfaceReverseDiffExt = "ReverseDiff"
42+
DifferentiationInterfaceReverseDiffExt = ["ReverseDiff", "DiffResults"]
3943
DifferentiationInterfaceSparseArraysExt = "SparseArrays"
4044
DifferentiationInterfaceSparseMatrixColoringsExt = "SparseMatrixColorings"
4145
DifferentiationInterfaceStaticArraysExt = "StaticArrays"
@@ -44,27 +48,30 @@ DifferentiationInterfaceTrackerExt = "Tracker"
4448
DifferentiationInterfaceZygoteExt = ["Zygote", "ForwardDiff"]
4549

4650
[compat]
47-
ADTypes = "1.9.0"
51+
ADTypes = "1.12.1"
4852
ChainRulesCore = "1.23.0"
53+
DiffResults = "1.1.0"
4954
Diffractor = "=0.2.6"
50-
Enzyme = "0.13.6"
55+
Enzyme = "0.13.17"
56+
EnzymeCore = "0.8.8"
5157
ExplicitImports = "1.10.1"
52-
FastDifferentiation = "0.4.1"
58+
FastDifferentiation = "0.4.3"
5359
FiniteDiff = "2.23.1"
5460
FiniteDifferences = "0.12.31"
5561
ForwardDiff = "0.10.36"
62+
GTPSA = "1.4.0"
5663
JuliaFormatter = "1"
5764
LinearAlgebra = "<0.0.1,1"
58-
Mooncake = "0.4.11"
65+
Mooncake = "0.4.52"
5966
PolyesterForwardDiff = "0.1.2"
6067
ReverseDiff = "1.15.1"
6168
SparseArrays = "<0.0.1,1"
6269
SparseConnectivityTracer = "0.5.0,0.6"
63-
StaticArrays = "1.9.7"
6470
SparseMatrixColorings = "0.4.9"
71+
StaticArrays = "1.9.7"
6572
Symbolics = "5.27.1, 6"
6673
Tracker = "0.2.33"
67-
Zygote = "0.6.69"
74+
Zygote = "0.6.69, 0.7"
6875
julia = "1.10"
6976

7077
[extras]
@@ -80,6 +87,7 @@ FastDifferentiation = "eb9bf01b-bf85-4b60-bf87-ee5de06c00be"
8087
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
8188
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
8289
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
90+
GTPSA = "b27dd330-f138-47c5-815b-40db9dd9b6e8"
8391
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
8492
JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb"
8593
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
@@ -99,4 +107,4 @@ Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
99107
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
100108

101109
[targets]
102-
test = ["ADTypes", "Aqua", "ComponentArrays", "DataFrames", "ExplicitImports", "ForwardDiff", "JET", "JLArrays", "JuliaFormatter", "Pkg", "Random", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings", "StableRNGs", "StaticArrays", "Test", "Zygote"]
110+
test = ["ADTypes", "Aqua", "ComponentArrays", "DataFrames", "ExplicitImports", "JET", "JLArrays", "JuliaFormatter", "Pkg", "Random", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings", "StableRNGs", "StaticArrays", "Test"]

DifferentiationInterface/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ This package provides a unified syntax to differentiate functions, including:
3131
We support the following backends defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl):
3232

3333
- [ChainRulesCore.jl](https://github.com/JuliaDiff/ChainRulesCore.jl)
34-
- [Diffractor.jl](https://github.com/JuliaDiff/Diffractor.jl)
34+
- [Diffractor.jl](https://github.com/JuliaDiff/Diffractor.jl) (currently broken)
3535
- [Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl)
3636
- [FastDifferentiation.jl](https://github.com/brianguenter/FastDifferentiation.jl)
3737
- [FiniteDiff.jl](https://github.com/JuliaDiff/FiniteDiff.jl)
3838
- [FiniteDifferences.jl](https://github.com/JuliaDiff/FiniteDifferences.jl)
3939
- [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl)
40+
- [GTPSA.jl](https://github.com/bmad-sim/GTPSA.jl)
4041
- [Mooncake.jl](https://github.com/compintell/Mooncake.jl)
4142
- [PolyesterForwardDiff.jl](https://github.com/JuliaDiff/PolyesterForwardDiff.jl)
4243
- [ReverseDiff.jl](https://github.com/JuliaDiff/ReverseDiff.jl)
@@ -89,4 +90,4 @@ To improve your performance by up to several orders of magnitude compared to thi
8990

9091
## Citation
9192

92-
Please cite both DifferentiationInterface.jl and its inspiration [AbstractDifferentiation.jl](https://github.com/JuliaDiff/AbstractDifferentiation.jl), using the provided `CITATION.bib` file.
93+
Please cite both DifferentiationInterface.jl and its inspiration [AbstractDifferentiation.jl](https://github.com/JuliaDiff/AbstractDifferentiation.jl), using the provided `CITATION.cff` file.

DifferentiationInterface/docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
99
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1010
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
1111
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
12+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1213
SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5"
1314
SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35"
1415
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

DifferentiationInterface/docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ makedocs(;
3131
"explanation/backends.md",
3232
"explanation/advanced.md",
3333
],
34+
"FAQ" => ["faq/limitations.md", "faq/differentiability.md"],
3435
"api.md",
3536
"dev_guide.md",
3637
],

DifferentiationInterface/docs/src/api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ jacobian
6868
jacobian!
6969
value_and_jacobian
7070
value_and_jacobian!
71-
MixedMode
7271
```
7372

7473
## Second order
@@ -125,9 +124,10 @@ DifferentiationInterface.inner
125124
DifferentiateWith
126125
```
127126

128-
### Sparsity detection
127+
### Sparsity tools
129128

130129
```@docs
130+
MixedMode
131131
DenseSparsityDetector
132132
```
133133

DifferentiationInterface/docs/src/explanation/advanced.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,26 @@ But after preparation, the more zeros are present in the matrix, the greater the
7171
### Tuning the coloring algorithm
7272

7373
The complexity of sparse Jacobians or Hessians grows with the number of distinct colors in a coloring of the sparsity pattern.
74-
To reduce this number of colors, [`GreedyColoringAlgorithm`](@ref) has two main settings: the order used for vertices and the decompression method.
74+
To reduce this number of colors, [`GreedyColoringAlgorithm`](@extref SparseMatrixColorings.GreedyColoringAlgorithm) has two main settings: the order used for vertices and the decompression method.
7575
Depending on your use case, you may want to modify either of these options to increase performance.
7676
See the documentation of [SparseMatrixColorings.jl](https://github.com/gdalle/SparseMatrixColorings.jl) for details.
7777

78+
### Mixed mode
79+
80+
When a Jacobian matrix has both dense rows and dense columns, it can be more efficient to use "mixed-mode" differentiation, a mixture of forward and reverse.
81+
The associated bidirectional coloring algorithm automatically decides how to cover the Jacobian using a set of columns (computed in forward mode) plus a set of rows (computed in reverse mode).
82+
This behavior is triggered as soon as you put a [`MixedMode`](@ref) object inside `AutoSparse`, like so:
83+
84+
```julia
85+
AutoSparse(
86+
MixedMode(forward_backend, reverse_backend);
87+
sparsity_detector,
88+
coloring_algorithm
89+
)
90+
```
91+
92+
At the moment, mixed mode tends to work best when the [`GreedyColoringAlgorithm`](@extref SparseMatrixColorings.GreedyColoringAlgorithm) is provided with a [`RandomOrder`](@extref SparseMatrixColorings.RandomOrder) instead of the usual [`NaturalOrder`](@extref SparseMatrixColorings.NaturalOrder).
93+
7894
## Batch mode
7995

8096
### Multiple tangents

0 commit comments

Comments
 (0)