diff --git a/DifferentiationInterface/Project.toml b/DifferentiationInterface/Project.toml index 3439adfbd..c113a11fc 100644 --- a/DifferentiationInterface/Project.toml +++ b/DifferentiationInterface/Project.toml @@ -1,7 +1,7 @@ name = "DifferentiationInterface" uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63" authors = ["Guillaume Dalle", "Adrian Hill"] -version = "0.4.0" +version = "0.4.1" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceFiniteDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceFiniteDiffExt/onearg.jl index 1e1574b8e..8f30c94be 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceFiniteDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceFiniteDiffExt/onearg.jl @@ -42,12 +42,6 @@ function DI.derivative( return finite_difference_derivative(f, x, fdtype(backend)) end -function DI.derivative!( - f, der, backend::AutoFiniteDiff, x, extras::FiniteDiffOneArgDerivativeExtras{Nothing} -) - return copyto!(der, DI.derivative(f, backend, x, extras)) -end - function DI.value_and_derivative( f, backend::AutoFiniteDiff, x, ::FiniteDiffOneArgDerivativeExtras{Nothing} ) @@ -55,13 +49,6 @@ function DI.value_and_derivative( return y, finite_difference_derivative(f, x, fdtype(backend), eltype(y), y) end -function DI.value_and_derivative!( - f, der, backend::AutoFiniteDiff, x, extras::FiniteDiffOneArgDerivativeExtras{Nothing} -) - y, new_der = DI.value_and_derivative(f, backend, x, extras) - return y, copyto!(der, new_der) -end - ### Scalar to array function DI.derivative( diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceFiniteDifferencesExt/DifferentiationInterfaceFiniteDifferencesExt.jl b/DifferentiationInterface/ext/DifferentiationInterfaceFiniteDifferencesExt/DifferentiationInterfaceFiniteDifferencesExt.jl index 9e1f88523..1d3d96668 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceFiniteDifferencesExt/DifferentiationInterfaceFiniteDifferencesExt.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceFiniteDifferencesExt/DifferentiationInterfaceFiniteDifferencesExt.jl @@ -31,7 +31,7 @@ end ## Pullback -DI.prepare_pullback(f, ::AutoFiniteDifferences, x) = NoPullbackExtras() +DI.prepare_pullback(f, ::AutoFiniteDifferences, x, dy) = NoPullbackExtras() function DI.pullback(f, backend::AutoFiniteDifferences, x, dy, ::NoPullbackExtras) return only(j′vp(backend.fdm, f, dy, x)) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/utils.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/utils.jl index 9d7c08928..ecd5815dd 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/utils.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/utils.jl @@ -4,12 +4,10 @@ choose_chunk(::AutoForwardDiff{C}, x) where {C} = Chunk{C}() tag_type(f, ::AutoForwardDiff{C,T}, x) where {C,T} = T tag_type(f, ::AutoForwardDiff{C,Nothing}, x) where {C} = Tag{typeof(f),eltype(x)} -make_dual(::Type{T}, x::Number, dx) where {T} = Dual{T}(x, dx) -make_dual(::Type{T}, x, dx) where {T} = Dual{T}.(x, dx) # TODO: map causes Enzyme to fail - make_dual_similar(::Type{T}, x::Number) where {T} = Dual{T}(x, x) make_dual_similar(::Type{T}, x) where {T} = similar(x, Dual{T,eltype(x),1}) +make_dual(::Type{T}, x::Number, dx) where {T} = Dual{T}(x, dx) make_dual!(::Type{T}, xdual, x, dx) where {T} = map!(Dual{T}, xdual, x, dx) myvalue(::Type{T}, ydual::Number) where {T} = value(T, ydual) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceSymbolicsExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceSymbolicsExt/onearg.jl index 1ccbbc260..da809b60f 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceSymbolicsExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceSymbolicsExt/onearg.jl @@ -109,11 +109,7 @@ function DI.prepare_gradient(f, ::AutoSymbolics, x) grad_var = gradient(f(x_var), vec(x_var)) res = build_function(grad_var, vec(x_var); expression=Val(false)) - (grad_exe, grad_exe!) = if res isa Tuple - res - elseif res isa RuntimeGeneratedFunction - res, nothing - end + (grad_exe, grad_exe!) = res return SymbolicsOneArgGradientExtras(grad_exe, grad_exe!) end @@ -156,11 +152,7 @@ function DI.prepare_jacobian( end res = build_function(jac_var, x_var; expression=Val(false)) - (jac_exe, jac_exe!) = if res isa Tuple - res - elseif res isa RuntimeGeneratedFunction - res, nothing - end + (jac_exe, jac_exe!) = res return SymbolicsOneArgJacobianExtras(jac_exe, jac_exe!) end @@ -220,11 +212,7 @@ function DI.prepare_hessian(f, backend::Union{AutoSymbolics,AutoSparse{<:AutoSym end res = build_function(hess_var, vec(x_var); expression=Val(false)) - (hess_exe, hess_exe!) = if res isa Tuple - res - elseif res isa RuntimeGeneratedFunction - res, nothing - end + (hess_exe, hess_exe!) = res return SymbolicsOneArgHessianExtras(hess_exe, hess_exe!) end diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceSymbolicsExt/twoarg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceSymbolicsExt/twoarg.jl index 98cf176a2..14ee93f96 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceSymbolicsExt/twoarg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceSymbolicsExt/twoarg.jl @@ -23,11 +23,7 @@ function DI.prepare_pushforward(f!, y, ::AutoSymbolics, x, dx) pf_var = substitute(step_der_var, Dict(t_var => zero(eltype(x)))) res = build_function(pf_var, vcat(myvec(x_var), myvec(dx_var)); expression=Val(false)) - (pushforward_exe, pushforward_exe!) = if res isa Tuple - res - elseif res isa RuntimeGeneratedFunction - res, nothing - end + (pushforward_exe, pushforward_exe!) = res return SymbolicsTwoArgPushforwardExtras(pushforward_exe, pushforward_exe!) end @@ -77,11 +73,7 @@ function DI.prepare_derivative(f!, y, ::AutoSymbolics, x) der_var = derivative(y_var, x_var) res = build_function(der_var, x_var; expression=Val(false)) - (der_exe, der_exe!) = if res isa Tuple - res - elseif res isa RuntimeGeneratedFunction - res, nothing - end + (der_exe, der_exe!) = res return SymbolicsTwoArgDerivativeExtras(der_exe, der_exe!) end @@ -132,11 +124,7 @@ function DI.prepare_jacobian( end res = build_function(jac_var, x_var; expression=Val(false)) - (jac_exe, jac_exe!) = if res isa Tuple - res - elseif res isa RuntimeGeneratedFunction - res, nothing - end + (jac_exe, jac_exe!) = res return SymbolicsTwoArgJacobianExtras(jac_exe, jac_exe!) end diff --git a/DifferentiationInterface/src/sparse/coloring.jl b/DifferentiationInterface/src/sparse/coloring.jl index 306f1e6f3..b86b9b2f6 100644 --- a/DifferentiationInterface/src/sparse/coloring.jl +++ b/DifferentiationInterface/src/sparse/coloring.jl @@ -130,12 +130,6 @@ function neighbors(g::AdjacencyGraph, j::Integer) return filter(!isequal(j), nz_in_col(g.A_colmajor, j)) end -function colored_neighbors(g::AdjacencyGraph, j::Integer, colors::AbstractVector{<:Integer}) - return filter(neighbors(g, j)) do i - !iszero(colors[i]) - end -end - function star_coloring(g::AdjacencyGraph) n = length(columns(g)) colors = zeros(Int, n) diff --git a/DifferentiationInterface/src/utils/exceptions.jl b/DifferentiationInterface/src/utils/exceptions.jl index f0dd08809..3a8d93c4e 100644 --- a/DifferentiationInterface/src/utils/exceptions.jl +++ b/DifferentiationInterface/src/utils/exceptions.jl @@ -1,6 +1,7 @@ struct MissingBackendError <: Exception backend::AbstractADType end + function Base.showerror(io::IO, e::MissingBackendError) println(io, "failed to use $(backend_str(e.backend)) backend.") if !check_available(e.backend) diff --git a/DifferentiationInterface/test/Internals/coloring.jl b/DifferentiationInterface/test/Internals/coloring.jl index 3fe0425c9..d39f125ad 100644 --- a/DifferentiationInterface/test/Internals/coloring.jl +++ b/DifferentiationInterface/test/Internals/coloring.jl @@ -3,20 +3,41 @@ import DifferentiationInterface as DI import DifferentiationInterfaceTest as DIT using LinearAlgebra: I, Symmetric using SparseArrays: sprand +using Test alg = DI.GreedyColoringAlgorithm() -A = sprand(Bool, 100, 200, 0.05) +@testset "Grouping" begin + colors = [1, 3, 1, 3, 1, 2] + @test DI.color_groups(colors) == [[1, 3, 5], [6], [2, 4]] + colors = [2, 3, 2, 3, 2, 1] + @test DI.color_groups(colors) == [[6], [1, 3, 5], [2, 4]] + colors = [2, 3, 2, 3, 2] + @test_throws AssertionError DI.color_groups(colors) +end -column_colors = ADTypes.column_coloring(A, alg) -@test DIT.check_structurally_orthogonal_columns(A, column_colors) -@test maximum(column_colors) < size(A, 2) ÷ 2 +@testset "Column coloring" begin + for A in (sprand(Bool, 100, 200, 0.05), sprand(Bool, 200, 100, 0.05)) + column_colors = ADTypes.column_coloring(A, alg) + @test DIT.check_structurally_orthogonal_columns(A, column_colors) + @test minimum(column_colors) == 1 + @test maximum(column_colors) < size(A, 2) ÷ 2 + end +end -row_colors = ADTypes.row_coloring(A, alg) -@test DIT.check_structurally_orthogonal_rows(A, row_colors) -@test maximum(row_colors) < size(A, 1) ÷ 2 +@testset "Row coloring" begin + for A in (sprand(Bool, 100, 200, 0.05), sprand(Bool, 200, 100, 0.05)) + row_colors = ADTypes.row_coloring(A, alg) + @test DIT.check_structurally_orthogonal_rows(A, row_colors) + @test minimum(row_colors) == 1 + @test maximum(row_colors) < size(A, 1) ÷ 2 + end +end -S = Symmetric(sprand(Bool, 100, 100, 0.05)) + I -symmetric_colors = ADTypes.symmetric_coloring(S, alg) -@test DIT.check_symmetrically_structurally_orthogonal(S, symmetric_colors) -@test maximum(symmetric_colors) < size(A, 2) ÷ 2 +@testset "Symmetric coloring" begin + S = Symmetric(sprand(Bool, 100, 100, 0.05)) + I + symmetric_colors = ADTypes.symmetric_coloring(S, alg) + @test DIT.check_symmetrically_structurally_orthogonal(S, symmetric_colors) + @test minimum(symmetric_colors) == 1 + @test maximum(symmetric_colors) < size(S, 2) ÷ 2 +end diff --git a/DifferentiationInterface/test/Internals/exceptions.jl b/DifferentiationInterface/test/Internals/exceptions.jl index 0f78d3030..aa0659f3b 100644 --- a/DifferentiationInterface/test/Internals/exceptions.jl +++ b/DifferentiationInterface/test/Internals/exceptions.jl @@ -1,5 +1,7 @@ using ADTypes: ADTypes, AbstractADType +using DifferentiationInterface import DifferentiationInterface as DI +using Test """ AutoBrokenForward <: ADTypes.AbstractADType @@ -19,16 +21,20 @@ Used to test error messages. """ struct AutoBrokenReverse <: AbstractADType end ADTypes.mode(::AutoBrokenReverse) = ADTypes.ReverseMode() -DI.check_available(::AutoBrokenReverse) = true ## Test exceptions @testset "MissingBackendError" begin - f(x::AbstractArray) = sum(abs2, x) - x = [1.0, 2.0, 3.0] + x = [1.0] + y = similar(x) + dx = similar(x) + dy = similar(y) - @test_throws DI.MissingBackendError gradient(f, AutoBrokenForward(), x) - @test_throws DI.MissingBackendError gradient(f, AutoBrokenReverse(), x) + @test_throws DI.MissingBackendError jacobian(copy, AutoBrokenForward(), x) + @test_throws DI.MissingBackendError jacobian(copy, AutoBrokenReverse(), x) - @test_throws DI.MissingBackendError hvp(f, AutoBrokenForward(), x, x) - @test_throws DI.MissingBackendError hvp(f, AutoBrokenReverse(), x, x) + @test_throws DI.MissingBackendError jacobian(copyto!, y, AutoBrokenForward(), x) + @test_throws DI.MissingBackendError jacobian(copyto!, y, AutoBrokenReverse(), x) + + @test_throws DI.MissingBackendError hessian(sum, AutoBrokenForward(), x) + @test_throws DI.MissingBackendError hessian(sum, AutoBrokenReverse(), x) end diff --git a/DifferentiationInterface/test/Internals/second_order.jl b/DifferentiationInterface/test/Internals/second_order.jl new file mode 100644 index 000000000..38bde4b5f --- /dev/null +++ b/DifferentiationInterface/test/Internals/second_order.jl @@ -0,0 +1,7 @@ +using ADTypes +using DifferentiationInterface +using Test + +@test ADTypes.mode(SecondOrder(AutoForwardDiff(), AutoZygote())) isa ADTypes.ForwardMode + +@test startswith(string(SecondOrder(AutoForwardDiff(), AutoZygote())), "SecondOrder") diff --git a/DifferentiationInterface/test/Single/ForwardDiff.jl b/DifferentiationInterface/test/Single/ForwardDiff.jl index 19d919049..579c81139 100644 --- a/DifferentiationInterface/test/Single/ForwardDiff.jl +++ b/DifferentiationInterface/test/Single/ForwardDiff.jl @@ -8,7 +8,14 @@ for backend in [AutoForwardDiff(), AutoSparse(AutoForwardDiff())] @test check_hessian(backend) end -test_differentiation([AutoForwardDiff(), AutoSparse(AutoForwardDiff())]; logging=LOGGING); +test_differentiation( + [ + AutoForwardDiff(), + AutoForwardDiff(; chunksize=2, tag=:hello), + AutoSparse(AutoForwardDiff()), + ]; + logging=LOGGING, +); test_differentiation( MyAutoSparse(AutoForwardDiff()), sparse_scenarios(); sparsity=true, logging=LOGGING diff --git a/DifferentiationInterface/test/Single/ForwardDiff/efficiency.jl b/DifferentiationInterface/test/Single/ForwardDiff/efficiency.jl index 740f6d6e6..c51660dc4 100644 --- a/DifferentiationInterface/test/Single/ForwardDiff/efficiency.jl +++ b/DifferentiationInterface/test/Single/ForwardDiff/efficiency.jl @@ -14,7 +14,7 @@ using DataFrames: DataFrame output_type=Number, second_order=false, excluded=[PullbackScenario], - logging=get(ENV, "CI", "false") == "false", + logging=LOGGING, ) # derivative and jacobian for f!(x, y) @@ -28,7 +28,7 @@ using DataFrames: DataFrame output_type=AbstractVector, second_order=false, excluded=[PullbackScenario], - logging=get(ENV, "CI", "false") == "false", + logging=LOGGING, ) data = vcat(DataFrame(results1), DataFrame(results2)) @@ -58,7 +58,7 @@ end outofplace=false, onearg=false, second_order=false, - logging=get(ENV, "CI", "false") == "false", + logging=LOGGING, ) data = vcat(DataFrame(results1)) diff --git a/DifferentiationInterface/test/Single/Symbolics.jl b/DifferentiationInterface/test/Single/Symbolics.jl index cc24d8b6a..473d5434e 100644 --- a/DifferentiationInterface/test/Single/Symbolics.jl +++ b/DifferentiationInterface/test/Single/Symbolics.jl @@ -17,3 +17,7 @@ test_differentiation( test_differentiation( AutoSparse(AutoSymbolics()), sparse_scenarios(); sparsity=true, logging=LOGGING ); + +if VERSION >= v"1.10" + include("Symbolics/detector.jl") +end diff --git a/DifferentiationInterface/test/Single/Symbolics/detector.jl b/DifferentiationInterface/test/Single/Symbolics/detector.jl new file mode 100644 index 000000000..6d1f1df99 --- /dev/null +++ b/DifferentiationInterface/test/Single/Symbolics/detector.jl @@ -0,0 +1,21 @@ +using ADTypes: ADTypes +using DifferentiationInterface: SymbolicsSparsityDetector +using Symbolics +using Test + +detector = SymbolicsSparsityDetector() +@test detector isa ADTypes.AbstractSparsityDetector + +f(x) = reshape(vcat(x[1], diff(vec(x))), size(x)) +f!(y, x) = copyto!(vec(y), vec(f(x))) + +for x in (rand(4), rand(4, 5)) + @test sum(ADTypes.jacobian_sparsity(f, x, detector)) == 2length(x) - 1 + @test sum(ADTypes.jacobian_sparsity(f!, similar(x), x, detector)) == 2length(x) - 1 +end + +g(x) = sum(abs2, diff(vec(x))) + +for x in (rand(4), rand(4, 5)) + @test sum(ADTypes.hessian_sparsity(g, x, detector)) == 3length(x) - 2 +end diff --git a/DifferentiationInterfaceTest/test/coloring.jl b/DifferentiationInterfaceTest/test/coloring.jl index d39f125ad..03c5debe0 100644 --- a/DifferentiationInterfaceTest/test/coloring.jl +++ b/DifferentiationInterfaceTest/test/coloring.jl @@ -1,43 +1,47 @@ -using ADTypes: ADTypes -import DifferentiationInterface as DI import DifferentiationInterfaceTest as DIT -using LinearAlgebra: I, Symmetric -using SparseArrays: sprand using Test -alg = DI.GreedyColoringAlgorithm() - -@testset "Grouping" begin - colors = [1, 3, 1, 3, 1, 2] - @test DI.color_groups(colors) == [[1, 3, 5], [6], [2, 4]] - colors = [2, 3, 2, 3, 2, 1] - @test DI.color_groups(colors) == [[6], [1, 3, 5], [2, 4]] - colors = [2, 3, 2, 3, 2] - @test_throws AssertionError DI.color_groups(colors) -end +A = [ + 1 0 0 + 0 1 0 + 0 1 0 + 0 0 0 +] @testset "Column coloring" begin - for A in (sprand(Bool, 100, 200, 0.05), sprand(Bool, 200, 100, 0.05)) - column_colors = ADTypes.column_coloring(A, alg) - @test DIT.check_structurally_orthogonal_columns(A, column_colors) - @test minimum(column_colors) == 1 - @test maximum(column_colors) < size(A, 2) ÷ 2 - end + A = [ + 1 0 0 + 0 1 0 + 0 1 1 + ] + @test DIT.check_structurally_orthogonal_columns(A, [1, 2, 3]) + @test DIT.check_structurally_orthogonal_columns(A, [1, 2, 1]) + @test DIT.check_structurally_orthogonal_columns(A, [1, 1, 2]) + @test !DIT.check_structurally_orthogonal_columns(A, [1, 2, 2]) end @testset "Row coloring" begin - for A in (sprand(Bool, 100, 200, 0.05), sprand(Bool, 200, 100, 0.05)) - row_colors = ADTypes.row_coloring(A, alg) - @test DIT.check_structurally_orthogonal_rows(A, row_colors) - @test minimum(row_colors) == 1 - @test maximum(row_colors) < size(A, 1) ÷ 2 - end + A = [ + 1 0 0 + 0 1 0 + 0 1 1 + ] + @test DIT.check_structurally_orthogonal_rows(A, [1, 2, 3]) + @test DIT.check_structurally_orthogonal_rows(A, [1, 2, 1]) + @test DIT.check_structurally_orthogonal_rows(A, [1, 1, 2]) + @test !DIT.check_structurally_orthogonal_rows(A, [1, 2, 2]) end @testset "Symmetric coloring" begin - S = Symmetric(sprand(Bool, 100, 100, 0.05)) + I - symmetric_colors = ADTypes.symmetric_coloring(S, alg) - @test DIT.check_symmetrically_structurally_orthogonal(S, symmetric_colors) - @test minimum(symmetric_colors) == 1 - @test maximum(symmetric_colors) < size(S, 2) ÷ 2 + # example from "What color is your Jacobian", fig 4.1 + A = [ + 1 1 0 0 0 0 + 1 1 1 0 1 1 + 0 1 1 1 0 0 + 0 0 1 1 0 1 + 0 1 0 0 1 0 + 0 1 0 1 0 1 + ] + @test DIT.check_symmetrically_structurally_orthogonal(A, [1, 2, 1, 3, 1, 1]) + @test !DIT.check_symmetrically_structurally_orthogonal(A, [1, 3, 1, 3, 1, 1]) end diff --git a/DifferentiationInterfaceTest/test/forwarddiff.jl b/DifferentiationInterfaceTest/test/forwarddiff.jl index d4ee4b748..6006ec680 100644 --- a/DifferentiationInterfaceTest/test/forwarddiff.jl +++ b/DifferentiationInterfaceTest/test/forwarddiff.jl @@ -10,18 +10,12 @@ function MyAutoSparse(backend::AbstractADType) return AutoSparse(backend; sparsity_detector, coloring_algorithm) end -test_differentiation(AutoForwardDiff(); logging=get(ENV, "CI", "false") == "false") +test_differentiation(AutoForwardDiff(); logging=LOGGING) test_differentiation( - MyAutoSparse(AutoForwardDiff()), - sparse_scenarios(); - sparsity=true, - logging=get(ENV, "CI", "false") == "false", + MyAutoSparse(AutoForwardDiff()), sparse_scenarios(); sparsity=true, logging=LOGGING ) test_differentiation( - AutoForwardDiff(), - component_scenarios(); - excluded=[HessianScenario], - logging=get(ENV, "CI", "false") == "false", + AutoForwardDiff(), component_scenarios(); excluded=[HessianScenario], logging=LOGGING ) diff --git a/DifferentiationInterfaceTest/test/runtests.jl b/DifferentiationInterfaceTest/test/runtests.jl index 4a2eb926a..e995e943b 100644 --- a/DifferentiationInterfaceTest/test/runtests.jl +++ b/DifferentiationInterfaceTest/test/runtests.jl @@ -10,6 +10,8 @@ if isdir(DI_PATH) Pkg.develop(; path=DI_PATH) end +LOGGING = get(ENV, "CI", "false") == "false" + ## Main tests @testset verbose = true "DifferentiationInterfaceTest.jl" begin diff --git a/DifferentiationInterfaceTest/test/zero_backends.jl b/DifferentiationInterfaceTest/test/zero_backends.jl index a3c4cf29f..6e571c2fd 100644 --- a/DifferentiationInterfaceTest/test/zero_backends.jl +++ b/DifferentiationInterfaceTest/test/zero_backends.jl @@ -13,11 +13,7 @@ using DataFrames: DataFrames for backend in [AutoZeroForward(), AutoZeroReverse()] test_differentiation( - backend, - default_scenarios(); - correctness=true, - ref_backend=backend, - logging=get(ENV, "CI", "false") == "false", + backend, default_scenarios(); correctness=true, ref_backend=backend, logging=LOGGING ) end @@ -31,7 +27,7 @@ for backend in [ correctness=true, first_order=false, ref_backend=backend, - logging=get(ENV, "CI", "false") == "false", + logging=LOGGING, ) end @@ -42,7 +38,7 @@ if VERSION >= v"1.10" [AutoZeroForward(), AutoZeroReverse()]; correctness=false, type_stability=true, - logging=get(ENV, "CI", "false") == "false", + logging=LOGGING, ) test_differentiation( @@ -53,23 +49,21 @@ if VERSION >= v"1.10" correctness=false, type_stability=true, first_order=false, - logging=get(ENV, "CI", "false") == "false", + logging=LOGGING, ) end ## Benchmark data1 = benchmark_differentiation( - [AutoZeroForward(), AutoZeroReverse()], - default_scenarios(); - logging=get(ENV, "CI", "false") == "false", + [AutoZeroForward(), AutoZeroReverse()], default_scenarios(); logging=LOGGING ); data2 = benchmark_differentiation( [SecondOrder(AutoZeroForward(), AutoZeroReverse())], default_scenarios(); first_order=false, - logging=get(ENV, "CI", "false") == "false", + logging=LOGGING, ); df1 = DataFrames.DataFrame(data1) @@ -99,18 +93,10 @@ end for backend in [AutoZeroForward(), AutoZeroReverse()] test_differentiation( - backend, - gpu_scenarios(); - correctness=true, - ref_backend=backend, - logging=get(ENV, "CI", "false") == "false", + backend, gpu_scenarios(); correctness=true, ref_backend=backend, logging=LOGGING ) test_differentiation( - backend, - static_scenarios(); - correctness=true, - ref_backend=backend, - logging=get(ENV, "CI", "false") == "false", + backend, static_scenarios(); correctness=true, ref_backend=backend, logging=LOGGING ) # stack fails on component vectors test_differentiation( @@ -119,6 +105,6 @@ for backend in [AutoZeroForward(), AutoZeroReverse()] correctness=true, excluded=[HessianScenario], ref_backend=backend, - logging=get(ENV, "CI", "false") == "false", + logging=LOGGING, ) end