From 2ad7a1da86c8967fa76355bf09b1cc2ab411481f Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Thu, 3 Oct 2024 09:45:43 -0400 Subject: [PATCH] refactor: remove Zygote extension --- Project.toml | 2 -- ext/NonlinearSolveZygoteExt.jl | 7 ------- src/NonlinearSolve.jl | 3 --- src/internal/helpers.jl | 2 +- test/misc/qa_tests.jl | 3 +-- 5 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 ext/NonlinearSolveZygoteExt.jl diff --git a/Project.toml b/Project.toml index 7e0bcb4c8..69dd08304 100644 --- a/Project.toml +++ b/Project.toml @@ -45,7 +45,6 @@ NLSolvers = "337daf1e-9722-11e9-073e-8b9effe078ba" NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4" SpeedMapping = "f1835b91-879b-4a3f-a438-e4baacf14412" -Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [extensions] NonlinearSolveBandedMatricesExt = "BandedMatrices" @@ -57,7 +56,6 @@ NonlinearSolveNLSolversExt = "NLSolvers" NonlinearSolveNLsolveExt = "NLsolve" NonlinearSolveSIAMFANLEquationsExt = "SIAMFANLEquations" NonlinearSolveSpeedMappingExt = "SpeedMapping" -NonlinearSolveZygoteExt = "Zygote" [compat] ADTypes = "1.9" diff --git a/ext/NonlinearSolveZygoteExt.jl b/ext/NonlinearSolveZygoteExt.jl deleted file mode 100644 index 8ed2e1853..000000000 --- a/ext/NonlinearSolveZygoteExt.jl +++ /dev/null @@ -1,7 +0,0 @@ -module NonlinearSolveZygoteExt - -using NonlinearSolve: NonlinearSolve - -NonlinearSolve.is_extension_loaded(::Val{:Zygote}) = true - -end diff --git a/src/NonlinearSolve.jl b/src/NonlinearSolve.jl index 5043ed865..50051fcb0 100644 --- a/src/NonlinearSolve.jl +++ b/src/NonlinearSolve.jl @@ -61,9 +61,6 @@ using SparseMatrixColorings: ConstantColoringAlgorithm, GreedyColoringAlgorithm, const DI = DifferentiationInterface -# Type-Inference Friendly Check for Extension Loading -is_extension_loaded(::Val) = false - const True = Val(true) const False = Val(false) diff --git a/src/internal/helpers.jl b/src/internal/helpers.jl index abf6f1099..afc24ce5b 100644 --- a/src/internal/helpers.jl +++ b/src/internal/helpers.jl @@ -80,7 +80,7 @@ function get_concrete_reverse_ad( else use_sparse_ad = false end - ad = if isinplace(prob) || !is_extension_loaded(Val(:Zygote)) # Use Finite Differencing + ad = if isinplace(prob) || !DI.check_available(AutoZygote()) # Use Finite Differencing use_sparse_ad ? AutoSparse(AutoFiniteDiff()) : AutoFiniteDiff() else use_sparse_ad ? AutoSparse(AutoZygote()) : AutoZygote() diff --git a/test/misc/qa_tests.jl b/test/misc/qa_tests.jl index f6c0d8cb4..6aafd4024 100644 --- a/test/misc/qa_tests.jl +++ b/test/misc/qa_tests.jl @@ -17,8 +17,7 @@ end @testitem "Explicit Imports" tags=[:misc] begin using NonlinearSolve, ADTypes, SimpleNonlinearSolve, SciMLBase import BandedMatrices, FastLevenbergMarquardt, FixedPointAcceleration, - LeastSquaresOptim, MINPACK, NLsolve, NLSolvers, SIAMFANLEquations, SpeedMapping, - Zygote + LeastSquaresOptim, MINPACK, NLsolve, NLSolvers, SIAMFANLEquations, SpeedMapping using ExplicitImports