From 3072d4aa15a11a3057b4caac4d588bfefec3cc69 Mon Sep 17 00:00:00 2001 From: Adrian Hill Date: Wed, 2 Oct 2024 13:56:56 +0200 Subject: [PATCH] Remove ForwardDiff extension (#203) --- Project.toml | 4 ---- ext/SparseConnectivityTracerForwardDiffExt.jl | 14 ------------- src/SparseConnectivityTracer.jl | 5 +---- test/ext/test_ForwardDiff.jl | 20 ------------------- test/linting.jl | 1 - test/runtests.jl | 2 +- 6 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 ext/SparseConnectivityTracerForwardDiffExt.jl delete mode 100644 test/ext/test_ForwardDiff.jl diff --git a/Project.toml b/Project.toml index 24f178d..1947a04 100644 --- a/Project.toml +++ b/Project.toml @@ -14,7 +14,6 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [weakdeps] DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" -ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688" NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" @@ -22,7 +21,6 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" [extensions] SparseConnectivityTracerDataInterpolationsExt = "DataInterpolations" -SparseConnectivityTracerForwardDiffExt = "ForwardDiff" SparseConnectivityTracerLogExpFunctionsExt = "LogExpFunctions" SparseConnectivityTracerNNlibExt = "NNlib" SparseConnectivityTracerNaNMathExt = "NaNMath" @@ -33,7 +31,6 @@ ADTypes = "1" DataInterpolations = "6.2" DocStringExtensions = "0.9" FillArrays = "1" -ForwardDiff = "0.10" LinearAlgebra = "<0.0.1, 1" LogExpFunctions = "0.3.28" NNlib = "0.8, 0.9" @@ -46,7 +43,6 @@ julia = "1.6" [extras] DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" -ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688" NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" diff --git a/ext/SparseConnectivityTracerForwardDiffExt.jl b/ext/SparseConnectivityTracerForwardDiffExt.jl deleted file mode 100644 index d30d215..0000000 --- a/ext/SparseConnectivityTracerForwardDiffExt.jl +++ /dev/null @@ -1,14 +0,0 @@ -module SparseConnectivityTracerForwardDiffExt - -if isdefined(Base, :get_extension) - import SparseConnectivityTracer as SCT - using ForwardDiff: ForwardDiff -else - import ..SparseConnectivityTracer as SCT - using ..ForwardDiff: ForwardDiff -end - -# Overload 2-to-1 functions on ForwardDiff.Dual -eval(SCT.generate_code_2_to_1_typed(:Base, SCT.ops_2_to_1, ForwardDiff.Dual)) - -end # module diff --git a/src/SparseConnectivityTracer.jl b/src/SparseConnectivityTracer.jl index 3cf804e..b507da6 100644 --- a/src/SparseConnectivityTracer.jl +++ b/src/SparseConnectivityTracer.jl @@ -44,9 +44,6 @@ export jacobian_sparsity, hessian_sparsity function __init__() @static if !isdefined(Base, :get_extension) - @require ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" include( - "../ext/SparseConnectivityTracerForwardDiffExt.jl" - ) @require LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688" include( "../ext/SparseConnectivityTracerLogExpFunctionsExt.jl" ) @@ -59,7 +56,7 @@ function __init__() @require SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" include( "../ext/SparseConnectivityTracerSpecialFunctionsExt.jl" ) - # NOTE: SparseConnectivityTracerDataInterpolationsExt is not loaded on Julia <1.10 + # NOTE: DataInterpolations extension is not loaded on Julia <1.10 end end diff --git a/test/ext/test_ForwardDiff.jl b/test/ext/test_ForwardDiff.jl deleted file mode 100644 index e94999b..0000000 --- a/test/ext/test_ForwardDiff.jl +++ /dev/null @@ -1,20 +0,0 @@ -using SparseConnectivityTracer -using ForwardDiff: ForwardDiff - -using Test - -d = ForwardDiff.Dual{ForwardDiff.Tag{*,Float64}}(1.2, 3.4) -@testset "$D" for D in (TracerSparsityDetector, TracerLocalSparsityDetector) - detector = D() - # Testing on multiplication ensures that methods from Base have been overloaded, - # Since this would otherwise throw an ambiguity error: - # https://github.com/adrhill/SparseConnectivityTracer.jl/issues/196 - @testset "Jacobian" begin - @test jacobian_sparsity(x -> x * d, 1.0, detector) ≈ [1;;] - @test jacobian_sparsity(x -> d * x, 1.0, detector) ≈ [1;;] - end - @testset "Hessian" begin - @test hessian_sparsity(x -> x * d, 1.0, detector) ≈ [0;;] - @test hessian_sparsity(x -> d * x, 1.0, detector) ≈ [0;;] - end -end diff --git a/test/linting.jl b/test/linting.jl index 8f57052..4ae6a26 100644 --- a/test/linting.jl +++ b/test/linting.jl @@ -7,7 +7,6 @@ using JET: JET using ExplicitImports: ExplicitImports # Load package extensions so they get tested by ExplicitImports.jl -using ForwardDiff: ForwardDiff using DataInterpolations: DataInterpolations using NaNMath: NaNMath using NNlib: NNlib diff --git a/test/runtests.jl b/test/runtests.jl index 3db4bb2..453f40c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -72,7 +72,7 @@ GROUP = get(ENV, "JULIA_SCT_TEST_GROUP", "Core") if GROUP in ("Core", "All") @info "Testing package extensions..." @testset verbose = true "Package extensions" begin - for ext in (:ForwardDiff, :LogExpFunctions, :NaNMath, :NNlib, :SpecialFunctions) + for ext in (:LogExpFunctions, :NaNMath, :NNlib, :SpecialFunctions) @testset "$ext" begin @info "...$ext" include("ext/test_$ext.jl")