-
-
Notifications
You must be signed in to change notification settings - Fork 46
Exclude Enzyme from pre-release tests #644
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
Changes from all commits
4765d9c
ba59b58
b035953
98f56d7
4bc910c
7b89745
7fee346
b8519ab
2f4b19f
549dad7
1b83c9a
d70639d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,11 +9,22 @@ end | |||||
using LineSearches: LineSearches | ||||||
using BenchmarkTools: @ballocated | ||||||
using StaticArrays: @SVector | ||||||
using Zygote, Enzyme, ForwardDiff, FiniteDiff | ||||||
using Zygote, ForwardDiff, FiniteDiff | ||||||
|
||||||
# Conditionally import Enzyme only if not on Julia prerelease | ||||||
if isempty(VERSION.prerelease) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
using Enzyme | ||||||
end | ||||||
|
||||||
u0s = ([1.0, 1.0], @SVector[1.0, 1.0], 1.0) | ||||||
|
||||||
@testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | ||||||
# Filter autodiff backends based on Julia version | ||||||
autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | ||||||
if isempty(VERSION.prerelease) | ||||||
push!(autodiff_backends, AutoEnzyme()) | ||||||
end | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
@testset for ad in autodiff_backends | ||||||
@testset "$(nameof(typeof(linesearch)))" for linesearch in ( | ||||||
LineSearchesJL(; method = LineSearches.Static(), autodiff = ad), | ||||||
LineSearchesJL(; method = LineSearches.BackTracking(), autodiff = ad), | ||||||
|
@@ -93,14 +104,25 @@ end | |||||
using ADTypes, Random, LinearSolve, LinearAlgebra | ||||||
using BenchmarkTools: @ballocated | ||||||
using StaticArrays: @SVector | ||||||
using Zygote, Enzyme, ForwardDiff, FiniteDiff | ||||||
using Zygote, ForwardDiff, FiniteDiff | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
# Conditionally import Enzyme only if not on Julia prerelease | ||||||
if isempty(VERSION.prerelease) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
using Enzyme | ||||||
end | ||||||
|
||||||
preconditioners = [ | ||||||
(u0) -> nothing, | ||||||
u0 -> ((args...) -> (Diagonal(rand!(similar(u0))), nothing)) | ||||||
] | ||||||
|
||||||
@testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | ||||||
# Filter autodiff backends based on Julia version | ||||||
autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | ||||||
if isempty(VERSION.prerelease) | ||||||
push!(autodiff_backends, AutoEnzyme()) | ||||||
end | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
@testset for ad in autodiff_backends | ||||||
u0s = ([1.0, 1.0], @SVector[1.0, 1.0], 1.0) | ||||||
|
||||||
@testset "[OOP] u0: $(typeof(u0))" for u0 in u0s | ||||||
|
@@ -176,15 +198,26 @@ end | |||||
using ADTypes, LinearSolve, LinearAlgebra | ||||||
using BenchmarkTools: @ballocated | ||||||
using StaticArrays: @SVector | ||||||
using Zygote, Enzyme, ForwardDiff, FiniteDiff | ||||||
using Zygote, ForwardDiff, FiniteDiff | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
# Conditionally import Enzyme only if not on Julia prerelease | ||||||
if isempty(VERSION.prerelease) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
using Enzyme | ||||||
end | ||||||
|
||||||
radius_update_schemes = [ | ||||||
RadiusUpdateSchemes.Simple, RadiusUpdateSchemes.NocedalWright, | ||||||
RadiusUpdateSchemes.NLsolve, RadiusUpdateSchemes.Hei, | ||||||
RadiusUpdateSchemes.Yuan, RadiusUpdateSchemes.Fan, RadiusUpdateSchemes.Bastin | ||||||
] | ||||||
|
||||||
@testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | ||||||
# Filter autodiff backends based on Julia version | ||||||
autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | ||||||
if isempty(VERSION.prerelease) | ||||||
push!(autodiff_backends, AutoEnzyme()) | ||||||
end | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
@testset for ad in autodiff_backends | ||||||
@testset for radius_update_scheme in radius_update_schemes, | ||||||
linsolve in (nothing, LUFactorization(), KrylovJL_GMRES(), \) | ||||||
|
||||||
|
@@ -296,9 +329,20 @@ end | |||||
using ADTypes, LinearSolve, LinearAlgebra | ||||||
using BenchmarkTools: @ballocated | ||||||
using StaticArrays: SVector, @SVector | ||||||
using Zygote, Enzyme, ForwardDiff, FiniteDiff | ||||||
using Zygote, ForwardDiff, FiniteDiff | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
# Conditionally import Enzyme only if not on Julia prerelease | ||||||
if isempty(VERSION.prerelease) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
using Enzyme | ||||||
end | ||||||
|
||||||
@testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | ||||||
# Filter autodiff backends based on Julia version | ||||||
autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | ||||||
if isempty(VERSION.prerelease) | ||||||
push!(autodiff_backends, AutoEnzyme()) | ||||||
end | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
@testset for ad in autodiff_backends | ||||||
solver = LevenbergMarquardt(; autodiff = ad) | ||||||
|
||||||
@testset "[OOP] u0: $(typeof(u0))" for u0 in ([1.0, 1.0], 1.0, @SVector([1.0, 1.0])) | ||||||
|
@@ -394,8 +438,14 @@ end | |||||
|
||||||
@testitem "Simple Sparse AutoDiff" setup=[CoreRootfindTesting] tags=[:core] begin | ||||||
using ADTypes, SparseConnectivityTracer, SparseMatrixColorings | ||||||
|
||||||
@testset for ad in (AutoForwardDiff(), AutoFiniteDiff(), AutoZygote(), AutoEnzyme()) | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
# Filter autodiff backends based on Julia version | ||||||
autodiff_backends = [AutoForwardDiff(), AutoFiniteDiff(), AutoZygote()] | ||||||
if isempty(VERSION.prerelease) | ||||||
push!(autodiff_backends, AutoEnzyme()) | ||||||
end | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
@testset for ad in autodiff_backends | ||||||
@testset for u0 in ([1.0, 1.0], 1.0) | ||||||
prob = NonlinearProblem( | ||||||
NonlinearFunction(quadratic_f; sparsity = TracerSparsityDetector()), u0, 2.0 | ||||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2,9 +2,13 @@ using NonlinearSolve | |||
using NonlinearSolveHomotopyContinuation | ||||
using SciMLBase: NonlinearSolution | ||||
using ADTypes | ||||
using Enzyme | ||||
import NaNMath | ||||
|
||||
# Conditionally import Enzyme only if not on Julia prerelease | ||||
if isempty(VERSION.prerelease) | ||||
using Enzyme | ||||
end | ||||
|
||||
alg = HomotopyContinuationJL{true}(; threading = false) | ||||
|
||||
@testset "scalar u" begin | ||||
|
@@ -14,9 +18,13 @@ alg = HomotopyContinuationJL{true}(; threading = false) | |||
jac = function (u, p) | ||||
return 2u - p[1] | ||||
end | ||||
@testset "`NonlinearProblem` - $name" for (jac_or_autodiff, name) in [ | ||||
(AutoForwardDiff(), "no jac - forwarddiff"), (AutoEnzyme(), "no jac - enzyme"), ( | ||||
jac, "jac")] | ||||
# Filter autodiff backends based on Julia version | ||||
autodiff_backends = [(AutoForwardDiff(), "no jac - forwarddiff"), (jac, "jac")] | ||||
if isempty(VERSION.prerelease) | ||||
push!(autodiff_backends, (AutoEnzyme(), "no jac - enzyme")) | ||||
end | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
@testset "`NonlinearProblem` - $name" for (jac_or_autodiff, name) in autodiff_backends | ||||
if jac_or_autodiff isa Function | ||||
jac = jac_or_autodiff | ||||
autodiff = nothing | ||||
|
@@ -107,11 +115,17 @@ fjac = function (u, p) | |||
2*p[2]*u[2] 3*u[2]^2+2*p[2]*u[1]+1] | ||||
end | ||||
|
||||
@testset "vector u - $name" for (rhs, jac_or_autodiff, name) in [ | ||||
(f, AutoForwardDiff(), "oop + forwarddiff"), (f, AutoEnzyme(), "oop + enzyme"), ( | ||||
f, fjac, "oop + jac"), | ||||
(f!, AutoForwardDiff(), "iip + forwarddiff"), (f!, AutoEnzyme(), "iip + enzyme"), ( | ||||
f!, fjac!, "iip + jac")] | ||||
# Filter test cases based on Julia version | ||||
vector_test_cases = [ | ||||
(f, AutoForwardDiff(), "oop + forwarddiff"), (f, fjac, "oop + jac"), | ||||
(f!, AutoForwardDiff(), "iip + forwarddiff"), (f!, fjac!, "iip + jac") | ||||
] | ||||
if isempty(VERSION.prerelease) | ||||
push!(vector_test_cases, (f, AutoEnzyme(), "oop + enzyme")) | ||||
push!(vector_test_cases, (f!, AutoEnzyme(), "iip + enzyme")) | ||||
end | ||||
|
||||
@testset "vector u - $name" for (rhs, jac_or_autodiff, name) in vector_test_cases | ||||
sol = nothing | ||||
if jac_or_autodiff isa Function | ||||
jac = jac_or_autodiff | ||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -12,9 +12,13 @@ alg = HomotopyContinuationJL{false}(; threading = false) | |||
jac = function (u, p) | ||||
return 2u - (p + 3) | ||||
end | ||||
@testset "`NonlinearProblem` - $name" for (jac_or_autodiff, name) in [ | ||||
(AutoForwardDiff(), "no jac - forwarddiff"), (AutoEnzyme(), "no jac - enzyme"), ( | ||||
jac, "jac")] | ||||
# Filter autodiff backends based on Julia version | ||||
autodiff_backends = [(AutoForwardDiff(), "no jac - forwarddiff"), (jac, "jac")] | ||||
if isempty(VERSION.prerelease) | ||||
push!(autodiff_backends, (AutoEnzyme(), "no jac - enzyme")) | ||||
end | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
@testset "`NonlinearProblem` - $name" for (jac_or_autodiff, name) in autodiff_backends | ||||
if jac_or_autodiff isa Function | ||||
jac = jac_or_autodiff | ||||
autodiff = nothing | ||||
|
@@ -96,11 +100,17 @@ jac = function (u, p) | |||
2*p[2]*u[2] 3*u[2]^2+2*p[2]*u[1]+1] | ||||
end | ||||
|
||||
@testset "vector u - $name" for (rhs, jac_or_autodiff, name) in [ | ||||
(f, AutoForwardDiff(), "oop + forwarddiff"), (f, AutoEnzyme(), "oop + enzyme"), ( | ||||
f, jac, "oop + jac"), | ||||
(f!, AutoForwardDiff(), "iip + forwarddiff"), (f!, AutoEnzyme(), "iip + enzyme"), ( | ||||
f!, jac!, "iip + jac")] | ||||
# Filter test cases based on Julia version | ||||
vector_test_cases = [ | ||||
(f, AutoForwardDiff(), "oop + forwarddiff"), (f, jac, "oop + jac"), | ||||
(f!, AutoForwardDiff(), "iip + forwarddiff"), (f!, jac!, "iip + jac") | ||||
] | ||||
if isempty(VERSION.prerelease) | ||||
push!(vector_test_cases, (f, AutoEnzyme(), "oop + enzyme")) | ||||
push!(vector_test_cases, (f!, AutoEnzyme(), "iip + enzyme")) | ||||
end | ||||
|
||||
@testset "vector u - $name" for (rhs, jac_or_autodiff, name) in vector_test_cases | ||||
if jac_or_autodiff isa Function | ||||
jac = jac_or_autodiff | ||||
autodiff = nothing | ||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -9,11 +9,22 @@ end | |||
using LineSearches: LineSearches | ||||
using BenchmarkTools: @ballocated | ||||
using StaticArrays: @SVector | ||||
using Zygote, Enzyme, ForwardDiff, FiniteDiff | ||||
using Zygote, ForwardDiff, FiniteDiff | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
# Conditionally import Enzyme only if not on Julia prerelease | ||||
if isempty(VERSION.prerelease) | ||||
using Enzyme | ||||
end | ||||
|
||||
u0s = ([1.0, 1.0], @SVector[1.0, 1.0], 1.0) | ||||
|
||||
@testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | ||||
# Filter autodiff backends based on Julia version | ||||
autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | ||||
if isempty(VERSION.prerelease) | ||||
push!(autodiff_backends, AutoEnzyme()) | ||||
end | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
@testset for ad in autodiff_backends | ||||
@testset "$(nameof(typeof(linesearch)))" for linesearch in ( | ||||
# LineSearchesJL(; method = LineSearches.Static(), autodiff = ad), | ||||
# LineSearchesJL(; method = LineSearches.BackTracking(), autodiff = ad), | ||||
|
@@ -84,9 +95,20 @@ end | |||
using LineSearches: LineSearches | ||||
using BenchmarkTools: @ballocated | ||||
using StaticArrays: @SVector | ||||
using Zygote, Enzyme, ForwardDiff, FiniteDiff | ||||
using Zygote, ForwardDiff, FiniteDiff | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
# Conditionally import Enzyme only if not on Julia prerelease | ||||
if isempty(VERSION.prerelease) | ||||
using Enzyme | ||||
end | ||||
|
||||
@testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | ||||
# Filter autodiff backends based on Julia version | ||||
autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | ||||
if isempty(VERSION.prerelease) | ||||
push!(autodiff_backends, AutoEnzyme()) | ||||
end | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
@testset for ad in autodiff_backends | ||||
@testset "$(nameof(typeof(linesearch)))" for linesearch in ( | ||||
# LineSearchesJL(; method = LineSearches.Static(), autodiff = ad), | ||||
# LineSearchesJL(; method = LineSearches.BackTracking(), autodiff = ad), | ||||
|
@@ -157,9 +179,20 @@ end | |||
using LineSearches: LineSearches | ||||
using BenchmarkTools: @ballocated | ||||
using StaticArrays: @SVector | ||||
using Zygote, Enzyme, ForwardDiff, FiniteDiff | ||||
using Zygote, ForwardDiff, FiniteDiff | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
# Conditionally import Enzyme only if not on Julia prerelease | ||||
if isempty(VERSION.prerelease) | ||||
using Enzyme | ||||
end | ||||
|
||||
@testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | ||||
# Filter autodiff backends based on Julia version | ||||
autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | ||||
if isempty(VERSION.prerelease) | ||||
push!(autodiff_backends, AutoEnzyme()) | ||||
end | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||
@testset for ad in autodiff_backends | ||||
@testset "$(nameof(typeof(linesearch)))" for linesearch in ( | ||||
# LineSearchesJL(; method = LineSearches.Static(), autodiff = ad), | ||||
# LineSearchesJL(; method = LineSearches.BackTracking(), autodiff = ad), | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶