Skip to content

Commit

Permalink
Merge branch 'master' into qqy/dual_nlprob
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikQQY authored Dec 4, 2024
2 parents dececf8 + 2284348 commit f0f3167
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 32 deletions.
4 changes: 1 addition & 3 deletions lib/NonlinearSolveBase/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NonlinearSolveBase"
uuid = "be0214bd-f91f-a760-ac4e-3421ce2b2da0"
authors = ["Avik Pal <avikpal@mit.edu> and contributors"]
version = "1.3.3"
version = "1.4.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand All @@ -13,7 +13,6 @@ ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
FunctionProperties = "f62d2435-5019-4c03-9749-2d4c77af0cbc"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
MaybeInplace = "bb5d69b7-63fc-4a16-80bd-7e42200c7bdb"
Expand Down Expand Up @@ -60,7 +59,6 @@ EnzymeCore = "0.8"
ExplicitImports = "1.10.1"
FastClosures = "0.3"
ForwardDiff = "0.10.36"
FunctionProperties = "0.1.2"
InteractiveUtils = "<0.0.1, 1"
LineSearch = "0.1.4"
LinearAlgebra = "1.10"
Expand Down
1 change: 0 additions & 1 deletion lib/NonlinearSolveBase/src/NonlinearSolveBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ using StaticArraysCore: StaticArray, SMatrix, SArray, MArray

using CommonSolve: CommonSolve, init
using EnzymeCore: EnzymeCore
using FunctionProperties: hasbranching
using MaybeInplace: @bb
using RecursiveArrayTools: AbstractVectorOfArray, ArrayPartition
using SciMLBase: SciMLBase, ReturnCode, AbstractODEIntegrator, AbstractNonlinearProblem,
Expand Down
35 changes: 7 additions & 28 deletions lib/NonlinearSolveBase/src/autodiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,13 @@

# Ordering is important here. We want to select the first one that is compatible with the
# problem.
# XXX: Remove this once Enzyme is properly supported on Julia 1.11+
@static if VERSION v"1.11-"
const ReverseADs = (
ADTypes.AutoZygote(),
ADTypes.AutoTracker(),
ADTypes.AutoReverseDiff(; compile = true),
ADTypes.AutoReverseDiff(),
ADTypes.AutoEnzyme(; mode = EnzymeCore.Reverse),
ADTypes.AutoFiniteDiff()
)
else
const ReverseADs = (
ADTypes.AutoEnzyme(; mode = EnzymeCore.Reverse),
ADTypes.AutoZygote(),
ADTypes.AutoTracker(),
ADTypes.AutoReverseDiff(; compile = true),
ADTypes.AutoReverseDiff(),
ADTypes.AutoFiniteDiff()
)
end
const ReverseADs = (
ADTypes.AutoEnzyme(; mode = EnzymeCore.Reverse),
ADTypes.AutoZygote(),
ADTypes.AutoTracker(),
ADTypes.AutoReverseDiff(),
ADTypes.AutoFiniteDiff()
)

const ForwardADs = (
ADTypes.AutoPolyesterForwardDiff(),
Expand Down Expand Up @@ -116,14 +103,6 @@ function incompatible_backend_and_problem(
end

additional_incompatible_backend_check(::AbstractNonlinearProblem, ::AbstractADType) = false
function additional_incompatible_backend_check(prob::AbstractNonlinearProblem,
::ADTypes.AutoReverseDiff{true})
if SciMLBase.isinplace(prob)
fu = prob.f.resid_prototype === nothing ? zero(prob.u0) : prob.f.resid_prototype
return hasbranching(prob.f, fu, prob.u0, prob.p)
end
return hasbranching(prob.f, prob.u0, prob.p)
end
function additional_incompatible_backend_check(
prob::AbstractNonlinearProblem, ::ADTypes.AutoPolyesterForwardDiff)
prob.u0 isa SArray && return true # promotes to a mutable array
Expand Down

0 comments on commit f0f3167

Please sign in to comment.