Skip to content

Commit db908fb

Browse files
authored
Julia 1.6 compat (#243)
* Parsing works * Fix JET compat * Some tests are passing * Skip formal tests * Widen Symbolics compat * Use Compat * Replace with @compat * Widen FiniteDiff compat * No test on Diffractor * Less diff * Fix stack * Remove more Diffractor * No FastDifferentiation * Fix docs * Remove extensions * Remove Tapir * Add Compat 3 * Remove Symbolics * Remove compat * Fix stuff * Remove PolyesterForwardDiff * Fix * Fix type stability * Reput everything in docs * Fix stdlib compats * Remove stdlib compats * Pkg dark magic * No SparseDiffTools * Right project * Use the right DI * Fix * FiniteDiff is 1.10 * Fix failing tests * Fix Compat * Fix * Fix * Stdlib compat * Relax FillArrays * Force DI compat bounds in tmp env * Revert some compat bounds * FiniteDiff is a subset of FiniteDifferences * Version bumps * Fix FiniteDiff vs FiniteDifferences * Docs warning
1 parent 571133f commit db908fb

32 files changed

Lines changed: 407 additions & 312 deletions

.github/workflows/Test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
dir: './DifferentiationInterfaceTest'
3434
version:
3535
- '1'
36+
- '1.6'
3637
os:
3738
- ubuntu-latest
3839
arch:
@@ -46,6 +47,14 @@ jobs:
4647
arch: ${{ matrix.arch }}
4748
- uses: julia-actions/cache@v2
4849
- uses: julia-actions/julia-buildpkg@v1
50+
- name: Dev dependencies (temporary)
51+
run: julia --project=${{ matrix.pkg.dir}}/ -e '
52+
using Pkg;
53+
Pkg.Registry.update();
54+
if "${{ matrix.pkg.name}}" == "DifferentiationInterfaceTest";
55+
Pkg.develop(PackageSpec(path="./DifferentiationInterface"));
56+
end;
57+
Pkg.instantiate();'
4958
- uses: julia-actions/julia-runtest@v1
5059
with:
5160
project: ${{ matrix.pkg.dir }}

DifferentiationInterface/Project.toml

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

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
8+
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
89
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
910
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
1011
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
12+
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
1113
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1214

1315
[weakdeps]
@@ -20,7 +22,6 @@ FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
2022
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
2123
PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b"
2224
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
23-
SparseDiffTools = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
2425
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
2526
Tapir = "07d77754-e150-4737-8c94-cd238a1fb45b"
2627
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
@@ -44,29 +45,32 @@ DifferentiationInterfaceZygoteExt = "Zygote"
4445
[compat]
4546
ADTypes = "1.0.0"
4647
ChainRulesCore = "1.23.0"
48+
Compat = "3,4"
4749
Diffractor = "=0.2.6"
4850
DocStringExtensions = "0.9.3"
4951
Enzyme = "0.11.20,0.12"
5052
FastDifferentiation = "0.3.9"
51-
FillArrays = "1.9.3"
53+
FillArrays = "1.7.0"
5254
FiniteDiff = "2.23.1"
5355
FiniteDifferences = "0.12.31"
5456
ForwardDiff = "0.10.36"
55-
LinearAlgebra = "1"
57+
LinearAlgebra = "<0.0.1,1"
58+
PackageExtensionCompat = "1.0.2"
5659
PolyesterForwardDiff = "0.1.1"
5760
ReverseDiff = "1.15.1"
58-
SparseArrays = "1"
61+
SparseArrays = "<0.0.1,1"
5962
Symbolics = "5.27.1"
6063
Tapir = "0.2.4"
6164
Tracker = "0.2.33"
6265
Zygote = "0.6.69"
63-
julia = "1.10"
66+
julia = "1.6"
6467

6568
[extras]
6669
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
6770
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
71+
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
6872
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
69-
DifferentiationInterfaceTest = "a82114a7-5aa3-49a8-9643-716bb13727a3"
73+
# DifferentiationInterfaceTest = "a82114a7-5aa3-49a8-9643-716bb13727a3"
7074
Diffractor = "9f5e2b26-1114-432f-b630-d3fe2085c51c"
7175
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
7276
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
@@ -92,24 +96,12 @@ test = [
9296
"ADTypes",
9397
"Aqua",
9498
"DataFrames",
95-
"DifferentiationInterfaceTest",
96-
"Diffractor",
99+
# "DifferentiationInterfaceTest",
97100
"Documenter",
98-
"Enzyme",
99-
"FastDifferentiation",
100-
"FiniteDiff",
101-
"FiniteDifferences",
102-
"ForwardDiff",
103101
"JET",
104102
"JuliaFormatter",
105103
"Pkg",
106-
"PolyesterForwardDiff",
107-
"ReverseDiff",
108104
"SparseArrays",
109105
"SparseConnectivityTracer",
110-
"Symbolics",
111-
"Tapir",
112106
"Test",
113-
"Tracker",
114-
"Zygote",
115107
]

DifferentiationInterface/docs/src/backends.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ For sparse backends, only the Jacobian and Hessian operators are implemented dif
6868
backend_table #hide
6969
```
7070

71+
!!! danger "Compatibility with Julia 1.6"
72+
As of version 0.3.4, DifferentiationInterface.jl is compatible with Julia 1.6, the Long Term Support (LTS) version of the language.
73+
However, we were only able to test the following backends on LTS:
74+
- FiniteDifferences.jl
75+
- ForwardDiff.jl
76+
- ReverseDiff.jl
77+
- Tracker.jl
78+
- Zygote.jl
79+
We strongly recommend that users upgrade to Julia 1.10, where all backends are tested.
80+
7181
## Checks
7282

7383
### Availability

DifferentiationInterface/docs/src/overloads.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ using FiniteDiff: FiniteDiff
3535
using FiniteDifferences: FiniteDifferences
3636
using ForwardDiff: ForwardDiff
3737
using PolyesterForwardDiff: PolyesterForwardDiff
38-
using Symbolics: Symbolics
3938
using ReverseDiff: ReverseDiff
39+
using Symbolics: Symbolics
4040
using Tapir: Tapir
4141
using Tracker: Tracker
4242
using Zygote: Zygote

DifferentiationInterface/ext/DifferentiationInterfaceChainRulesCoreExt/DifferentiationInterfaceChainRulesCoreExt.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ using ChainRulesCore:
99
RuleConfig,
1010
frule_via_ad,
1111
rrule_via_ad
12+
using Compat
1213
import DifferentiationInterface as DI
1314
using DifferentiationInterface: DifferentiateWith, NoPullbackExtras, NoPushforwardExtras
1415

DifferentiationInterface/ext/DifferentiationInterfaceChainRulesCoreExt/differentiate_with.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
function ChainRulesCore.frule((_, dx), dw::DifferentiateWith, x)
2-
(; f, backend) = dw
2+
@compat (; f, backend) = dw
33
y, dy = DI.value_and_pushforward(f, backend, x, dx)
44
return y, dy
55
end
66

77
function ChainRulesCore.rrule(dw::DifferentiateWith, x)
8-
(; f, backend) = dw
8+
@compat (; f, backend) = dw
99
y, pullbackfunc = DI.value_and_pullback_split(f, backend, x)
1010
pullbackfunc_adjusted(dy) = (NoTangent(), pullbackfunc(dy))
1111
return y, pullbackfunc_adjusted

DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/DifferentiationInterfaceForwardDiffExt.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module DifferentiationInterfaceForwardDiffExt
22

33
using ADTypes: AbstractADType, AutoForwardDiff
44
using Base: Fix1
5+
using Compat
56
import DifferentiationInterface as DI
67
using DifferentiationInterface:
78
DerivativeExtras,

DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ end
2121
function compute_ydual_onearg(
2222
f::F, x, dx, extras::ForwardDiffOneArgPushforwardExtras{T}
2323
) where {F,T}
24-
(; xdual_tmp) = extras
24+
@compat (; xdual_tmp) = extras
2525
make_dual!(T, xdual_tmp, x, dx)
2626
ydual = f(xdual_tmp)
2727
return ydual

DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/twoarg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ end
1717
function compute_ydual_twoarg(
1818
f!::F, y, x::Number, dx, extras::ForwardDiffTwoArgPushforwardExtras{T}
1919
) where {F,T}
20-
(; ydual_tmp) = extras
20+
@compat (; ydual_tmp) = extras
2121
xdual_tmp = make_dual(T, x, dx)
2222
f!(ydual_tmp, xdual_tmp)
2323
return ydual_tmp
@@ -26,7 +26,7 @@ end
2626
function compute_ydual_twoarg(
2727
f!::F, y, x, dx, extras::ForwardDiffTwoArgPushforwardExtras{T}
2828
) where {F,T}
29-
(; xdual_tmp, ydual_tmp) = extras
29+
@compat (; xdual_tmp, ydual_tmp) = extras
3030
make_dual!(T, xdual_tmp, x, dx)
3131
f!(ydual_tmp, xdual_tmp)
3232
return ydual_tmp

DifferentiationInterface/ext/DifferentiationInterfaceTrackerExt/DifferentiationInterfaceTrackerExt.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using ADTypes: AutoTracker
44
import DifferentiationInterface as DI
55
using DifferentiationInterface: NoGradientExtras, NoPullbackExtras
66
using Tracker: Tracker, back, data, forward, gradient, jacobian, param, withgradient
7+
using Compat
78

89
DI.check_available(::AutoTracker) = true
910
DI.twoarg_support(::AutoTracker) = DI.TwoArgNotSupported()
@@ -34,12 +35,12 @@ end
3435
DI.prepare_gradient(f, ::AutoTracker, x) = NoGradientExtras()
3536

3637
function DI.value_and_gradient(f, ::AutoTracker, x, ::NoGradientExtras)
37-
(; val, grad) = withgradient(f, x)
38+
@compat (; val, grad) = withgradient(f, x)
3839
return val, data(only(grad))
3940
end
4041

4142
function DI.gradient(f, ::AutoTracker, x, ::NoGradientExtras)
42-
(; grad) = withgradient(f, x)
43+
@compat (; grad) = withgradient(f, x)
4344
return data(only(grad))
4445
end
4546

0 commit comments

Comments
 (0)