Skip to content

Commit

Permalink
Merge pull request #1089 from SciML/fastpow
Browse files Browse the repository at this point in the history
Deprecate DiffEqBase.fastpow for FastPower.fastpower
  • Loading branch information
ChrisRackauckas authored Oct 21, 2024
2 parents df8ad4e + f867b2a commit 00cd317
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 126 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
FastPower = "a4df4552-cc26-4903-aec0-212e50a0e84b"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
Expand Down Expand Up @@ -75,6 +76,7 @@ Enzyme = "0.13"
EnzymeCore = "0.7, 0.8"
FastBroadcast = "0.3"
FastClosures = "0.3.2"
FastPower = "1.1"
ForwardDiff = "0.10"
FunctionWrappers = "1.0"
FunctionWrappersWrappers = "0.1"
Expand Down
4 changes: 1 addition & 3 deletions ext/DiffEqBaseEnzymeExt.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module DiffEqBaseEnzymeExt

using DiffEqBase
import DiffEqBase: value, fastpow
import DiffEqBase: value
using Enzyme
import Enzyme: Const
using ChainRulesCore
Expand Down Expand Up @@ -53,6 +53,4 @@ function Enzyme.EnzymeRules.reverse(config::Enzyme.EnzymeRules.RevConfigWidth{1}
return ntuple(_ -> nothing, Val(length(args) + 4))
end

Enzyme.Compiler.known_ops[typeof(DiffEqBase.fastpow)] = (:pow, 2, nothing)

end
2 changes: 0 additions & 2 deletions ext/DiffEqBaseMeasurementsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ DiffEqBase.promote_u0(u0, p::AbstractArray{<:Measurements.Measurement}, t0) = el
value(x::Type{Measurements.Measurement{T}}) where {T} = T
value(x::Measurements.Measurement) = Measurements.value(x)

@inline DiffEqBase.fastpow(x::Measurements.Measurement, y::Measurements.Measurement) = x^y

# Support adaptive steps should be errorless
@inline function DiffEqBase.ODE_DEFAULT_NORM(
u::AbstractArray{
Expand Down
5 changes: 0 additions & 5 deletions ext/DiffEqBaseMonteCarloMeasurementsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ end
DiffEqBase.value(x::Type{MonteCarloMeasurements.AbstractParticles{T, N}}) where {T, N} = T
DiffEqBase.value(x::MonteCarloMeasurements.AbstractParticles) = mean(x.particles)

@inline function DiffEqBase.fastpow(x::MonteCarloMeasurements.AbstractParticles,
y::MonteCarloMeasurements.AbstractParticles)
x^y
end

# Support adaptive steps should be errorless
@inline function DiffEqBase.ODE_DEFAULT_NORM(
u::AbstractArray{
Expand Down
1 change: 0 additions & 1 deletion ext/DiffEqBaseTrackerExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ end
DiffEqBase.promote_u0(u0, p::Tracker.TrackedArray, t0) = Tracker.track(u0)
DiffEqBase.promote_u0(u0, p::AbstractArray{<:Tracker.TrackedReal}, t0) = eltype(p).(u0)

@inline DiffEqBase.fastpow(x::Tracker.TrackedReal, y::Tracker.TrackedReal) = x^y
@inline Base.any(f::Function, x::Tracker.TrackedArray) = any(f, Tracker.data(x))

# Support adaptive with non-tracked time
Expand Down
4 changes: 3 additions & 1 deletion src/DiffEqBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ end

import PrecompileTools

import FastPower
@deprecate fastpow(x,y) FastPower.fastpower(x,y)

using ArrayInterface

using StaticArraysCore # data arrays
Expand Down Expand Up @@ -126,7 +129,6 @@ abstract type DECostFunction end
import SciMLBase: Void, unwrapped_f

include("utils.jl")
include("fastpow.jl")
include("stats.jl")
include("calculate_residuals.jl")
include("tableaus.jl")
Expand Down
71 changes: 0 additions & 71 deletions src/fastpow.jl

This file was deleted.

2 changes: 0 additions & 2 deletions src/forwarddiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,6 @@ end
value(x::Type{ForwardDiff.Dual{T, V, N}}) where {T, V, N} = V
value(x::ForwardDiff.Dual) = value(ForwardDiff.value(x))

@inline fastpow(x::ForwardDiff.Dual, y::ForwardDiff.Dual) = x^y

sse(x::Number) = abs2(x)
sse(x::ForwardDiff.Dual) = sse(ForwardDiff.value(x)) + sum(sse, ForwardDiff.partials(x))
totallength(x::Number) = 1
Expand Down
25 changes: 0 additions & 25 deletions test/downstream/enzyme.jl

This file was deleted.

15 changes: 0 additions & 15 deletions test/fastpow.jl

This file was deleted.

1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ end

@time begin
if GROUP == "All" || GROUP == "Core"
@time @safetestset "Fast Power" include("fastpow.jl")
@time @safetestset "Callbacks" include("callbacks.jl")
@time @safetestset "Internal Rootfinders" include("internal_rootfinder.jl")
@time @safetestset "Plot Vars" include("plot_vars.jl")
Expand Down

0 comments on commit 00cd317

Please sign in to comment.