|  | 
| 9 | 9 |     using LineSearches: LineSearches | 
| 10 | 10 |     using BenchmarkTools: @ballocated | 
| 11 | 11 |     using StaticArrays: @SVector | 
| 12 |  | -    using Zygote, Enzyme, ForwardDiff, FiniteDiff | 
|  | 12 | +    using Zygote, ForwardDiff, FiniteDiff | 
|  | 13 | +     | 
|  | 14 | +    # Conditionally import Enzyme only if not on Julia prerelease | 
|  | 15 | +    include("test_utilities.jl") | 
|  | 16 | +    if !is_julia_prerelease() | 
|  | 17 | +        using Enzyme | 
|  | 18 | +    end | 
| 13 | 19 | 
 | 
| 14 | 20 |     u0s = ([1.0, 1.0], @SVector[1.0, 1.0], 1.0) | 
| 15 | 21 | 
 | 
| 16 |  | -    @testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | 
|  | 22 | +    # Filter autodiff backends based on Julia version | 
|  | 23 | +    autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | 
|  | 24 | +    if !is_julia_prerelease() | 
|  | 25 | +        push!(autodiff_backends, AutoEnzyme()) | 
|  | 26 | +    end | 
|  | 27 | +     | 
|  | 28 | +    @testset for ad in autodiff_backends | 
| 17 | 29 |         @testset "$(nameof(typeof(linesearch)))" for linesearch in ( | 
| 18 | 30 |             LineSearchesJL(; method = LineSearches.Static(), autodiff = ad), | 
| 19 | 31 |             LineSearchesJL(; method = LineSearches.BackTracking(), autodiff = ad), | 
|  | 
| 93 | 105 |     using ADTypes, Random, LinearSolve, LinearAlgebra | 
| 94 | 106 |     using BenchmarkTools: @ballocated | 
| 95 | 107 |     using StaticArrays: @SVector | 
| 96 |  | -    using Zygote, Enzyme, ForwardDiff, FiniteDiff | 
|  | 108 | +    using Zygote, ForwardDiff, FiniteDiff | 
|  | 109 | +     | 
|  | 110 | +    # Conditionally import Enzyme only if not on Julia prerelease | 
|  | 111 | +    include("test_utilities.jl") | 
|  | 112 | +    if !is_julia_prerelease() | 
|  | 113 | +        using Enzyme | 
|  | 114 | +    end | 
| 97 | 115 | 
 | 
| 98 | 116 |     preconditioners = [ | 
| 99 | 117 |         (u0) -> nothing, | 
| 100 | 118 |         u0 -> ((args...) -> (Diagonal(rand!(similar(u0))), nothing)) | 
| 101 | 119 |     ] | 
| 102 | 120 | 
 | 
| 103 |  | -    @testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | 
|  | 121 | +    # Filter autodiff backends based on Julia version | 
|  | 122 | +    autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | 
|  | 123 | +    if !is_julia_prerelease() | 
|  | 124 | +        push!(autodiff_backends, AutoEnzyme()) | 
|  | 125 | +    end | 
|  | 126 | +     | 
|  | 127 | +    @testset for ad in autodiff_backends | 
| 104 | 128 |         u0s = ([1.0, 1.0], @SVector[1.0, 1.0], 1.0) | 
| 105 | 129 | 
 | 
| 106 | 130 |         @testset "[OOP] u0: $(typeof(u0))" for u0 in u0s | 
| @@ -176,15 +200,27 @@ end | 
| 176 | 200 |     using ADTypes, LinearSolve, LinearAlgebra | 
| 177 | 201 |     using BenchmarkTools: @ballocated | 
| 178 | 202 |     using StaticArrays: @SVector | 
| 179 |  | -    using Zygote, Enzyme, ForwardDiff, FiniteDiff | 
|  | 203 | +    using Zygote, ForwardDiff, FiniteDiff | 
|  | 204 | +     | 
|  | 205 | +    # Conditionally import Enzyme only if not on Julia prerelease | 
|  | 206 | +    include("test_utilities.jl") | 
|  | 207 | +    if !is_julia_prerelease() | 
|  | 208 | +        using Enzyme | 
|  | 209 | +    end | 
| 180 | 210 | 
 | 
| 181 | 211 |     radius_update_schemes = [ | 
| 182 | 212 |         RadiusUpdateSchemes.Simple, RadiusUpdateSchemes.NocedalWright, | 
| 183 | 213 |         RadiusUpdateSchemes.NLsolve, RadiusUpdateSchemes.Hei, | 
| 184 | 214 |         RadiusUpdateSchemes.Yuan, RadiusUpdateSchemes.Fan, RadiusUpdateSchemes.Bastin | 
| 185 | 215 |     ] | 
| 186 | 216 | 
 | 
| 187 |  | -    @testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | 
|  | 217 | +    # Filter autodiff backends based on Julia version | 
|  | 218 | +    autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | 
|  | 219 | +    if !is_julia_prerelease() | 
|  | 220 | +        push!(autodiff_backends, AutoEnzyme()) | 
|  | 221 | +    end | 
|  | 222 | +     | 
|  | 223 | +    @testset for ad in autodiff_backends | 
| 188 | 224 |         @testset for radius_update_scheme in radius_update_schemes, | 
| 189 | 225 |             linsolve in (nothing, LUFactorization(), KrylovJL_GMRES(), \) | 
| 190 | 226 | 
 | 
|  | 
| 296 | 332 |     using ADTypes, LinearSolve, LinearAlgebra | 
| 297 | 333 |     using BenchmarkTools: @ballocated | 
| 298 | 334 |     using StaticArrays: SVector, @SVector | 
| 299 |  | -    using Zygote, Enzyme, ForwardDiff, FiniteDiff | 
|  | 335 | +    using Zygote, ForwardDiff, FiniteDiff | 
|  | 336 | +     | 
|  | 337 | +    # Conditionally import Enzyme only if not on Julia prerelease | 
|  | 338 | +    include("test_utilities.jl") | 
|  | 339 | +    if !is_julia_prerelease() | 
|  | 340 | +        using Enzyme | 
|  | 341 | +    end | 
| 300 | 342 | 
 | 
| 301 |  | -    @testset for ad in (AutoForwardDiff(), AutoZygote(), AutoFiniteDiff(), AutoEnzyme()) | 
|  | 343 | +    # Filter autodiff backends based on Julia version | 
|  | 344 | +    autodiff_backends = [AutoForwardDiff(), AutoZygote(), AutoFiniteDiff()] | 
|  | 345 | +    if !is_julia_prerelease() | 
|  | 346 | +        push!(autodiff_backends, AutoEnzyme()) | 
|  | 347 | +    end | 
|  | 348 | +     | 
|  | 349 | +    @testset for ad in autodiff_backends | 
| 302 | 350 |         solver = LevenbergMarquardt(; autodiff = ad) | 
| 303 | 351 | 
 | 
| 304 | 352 |         @testset "[OOP] u0: $(typeof(u0))" for u0 in ([1.0, 1.0], 1.0, @SVector([1.0, 1.0])) | 
|  | 
| 394 | 442 | 
 | 
| 395 | 443 | @testitem "Simple Sparse AutoDiff" setup=[CoreRootfindTesting] tags=[:core] begin | 
| 396 | 444 |     using ADTypes, SparseConnectivityTracer, SparseMatrixColorings | 
| 397 |  | - | 
| 398 |  | -    @testset for ad in (AutoForwardDiff(), AutoFiniteDiff(), AutoZygote(), AutoEnzyme()) | 
|  | 445 | +     | 
|  | 446 | +    # Include utility functions for prerelease detection | 
|  | 447 | +    include("test_utilities.jl") | 
|  | 448 | + | 
|  | 449 | +    # Filter autodiff backends based on Julia version | 
|  | 450 | +    autodiff_backends = [AutoForwardDiff(), AutoFiniteDiff(), AutoZygote()] | 
|  | 451 | +    if !is_julia_prerelease() | 
|  | 452 | +        push!(autodiff_backends, AutoEnzyme()) | 
|  | 453 | +    end | 
|  | 454 | +     | 
|  | 455 | +    @testset for ad in autodiff_backends | 
| 399 | 456 |         @testset for u0 in ([1.0, 1.0], 1.0) | 
| 400 | 457 |             prob = NonlinearProblem( | 
| 401 | 458 |                 NonlinearFunction(quadratic_f; sparsity = TracerSparsityDetector()), u0, 2.0 | 
|  | 
0 commit comments