Skip to content

Commit 23b1a2f

Browse files
Remove Static.jl and StaticArrayInterface; use FastBroadcast Serial/Threaded
Replace Static.True()/False() threading dispatch with FastBroadcast's Serial/Threaded types across DiffEqBase, OrdinaryDiffEqCore, and all subpackages. Remove StaticArrayInterface from Core and Differentiation. Require FastBroadcast >= 1.1. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 433e30b commit 23b1a2f

58 files changed

Lines changed: 333 additions & 377 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/DelayDiffEq/Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ OrdinaryDiffEqSSPRK = "1.5.0"
8888
OrdinaryDiffEqTsit5 = "1.4.0"
8989
OrdinaryDiffEqVerner = "1.5.0"
9090
Random = "<0.0.1, 1"
91-
RecursiveArrayTools = "3.52"
91+
RecursiveArrayTools = "3"
9292
Reexport = "1.0"
9393
SafeTestsets = "0.1.0"
9494
SciMLBase = "2.115.0"
@@ -109,10 +109,10 @@ julia = "1.10"
109109
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
110110
DiffEqNoiseProcess = "77a26b50-5914-5dd7-bc55-306e6241c503"
111111
StochasticDiffEqCore = "19c5a474-6cd1-4a5f-be79-46dc34e54d7f"
112-
StochasticDiffEqHighOrder = "0520c28c-50fd-4d16-9c96-902fc80b3bab"
113-
StochasticDiffEqImplicit = "5080b986-4c76-4669-b5dc-373a41579d5b"
112+
StochasticDiffEqHighOrder = "2396deb8-7031-47e3-b5f0-b712c0a6b4cc"
113+
StochasticDiffEqImplicit = "b4b012ad-4b5e-4e99-a72e-7e09e7e0b800"
114114
StochasticDiffEqLowOrder = "d15fe365-ce7f-450a-828a-7985bd5b681b"
115-
StochasticDiffEqROCK = "db241ea8-0e6b-4abc-8f2d-1adff2294fd9"
115+
StochasticDiffEqROCK = "c3d49e4e-9e6b-4ee6-becc-4dd72c61f2cc"
116116
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
117117
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
118118
DDEProblemLibrary = "f42792ee-6ffc-4e2a-ae83-8ee2f22de800"

lib/DiffEqBase/Project.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ SciMLLogging = "a6db7da4-7206-11f0-1eab-35f2a5dbe1d1"
2626
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
2727
SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226"
2828
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
29-
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
3029
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3130
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
3231
TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"
@@ -89,7 +88,7 @@ FastPower = "1.1"
8988
FlexUnits = "0.4"
9089
ForwardDiff = "0.10, 1"
9190
FunctionWrappers = "1.0"
92-
FunctionWrappersWrappers = "1"
91+
FunctionWrappersWrappers = "0.1, 1"
9392
GTPSA = "1.4"
9493
GeneralizedGenerated = "0.3"
9594
InteractiveUtils = "1.9"
@@ -106,7 +105,7 @@ Pkg = "1.9"
106105
PrecompileTools = "1"
107106
Printf = "1.9"
108107
Random = "1.9"
109-
RecursiveArrayTools = "3.52"
108+
RecursiveArrayTools = "3.1"
110109
Reexport = "1.0"
111110
ReverseDiff = "1"
112111
SafeTestsets = "0.1"
@@ -116,7 +115,6 @@ SciMLOperators = "1"
116115
SciMLStructures = "1.5"
117116
Setfield = "1"
118117
SparseArrays = "1.9"
119-
Static = "1"
120118
StaticArrays = "1"
121119
StaticArraysCore = "1.4"
122120
SymbolicIndexingInterface = "0.3.39"

lib/DiffEqBase/ext/DiffEqBaseForwardDiffExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using DiffEqBase, ForwardDiff
44
using DiffEqBase.ArrayInterface
55
using DiffEqBase: Void, FunctionWrappersWrappers, OrdinaryDiffEqTag,
66
AbstractTimeseriesSolution,
7-
RecursiveArrayTools, reduce_tup, _promote_tspan, has_continuous_callback
7+
RecursiveArrayTools, _promote_tspan, has_continuous_callback
88
import DiffEqBase: hasdualpromote, wrapfun_oop, wrapfun_iip, prob2dtmin,
99
promote_tspan, ODE_DEFAULT_NORM
1010
import SciMLBase: isdualtype, DualEltypeChecker, sse, __sum

lib/DiffEqBase/src/DiffEqBase.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ using FunctionWrappers: FunctionWrapper
2121
using MuladdMacro
2222

2323

24-
using FastBroadcast: @..
25-
using Static: True, False
26-
27-
using Static: reduce_tup
24+
using FastBroadcast: @.., Serial, Threaded
2825

2926
import RecursiveArrayTools
3027
import TruncatedStacktraces

lib/DiffEqBase/src/calculate_residuals.jl

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ end
9090
# Inplace Versions
9191

9292
"""
93-
DiffEqBase.calculate_residuals!(out, ũ, u₀, u₁, α, ρ, thread=False())
93+
DiffEqBase.calculate_residuals!(out, ũ, u₀, u₁, α, ρ, thread=Serial())
9494
9595
Save element-wise residuals
9696
```math
@@ -99,13 +99,13 @@ Save element-wise residuals
9999
in `out`.
100100
101101
The argument `thread` determines whether internal broadcasting on
102-
appropriate CPU arrays should be serial (`thread = False()`, default)
103-
or use multiple threads (`thread = True()`) when Julia is started
102+
appropriate CPU arrays should be serial (`thread = Serial()`, default)
103+
or use multiple threads (`thread = Threaded()`) when Julia is started
104104
with multiple threads.
105105
"""
106106
@inline function calculate_residuals!(
107107
out, ũ, u₀, u₁, α, ρ, internalnorm, t,
108-
thread::Union{False, True} = False()
108+
thread = Serial()
109109
)
110110
@.. broadcast = false thread = thread out = calculate_residuals(
111111
ũ, u₀, u₁, α, ρ, internalnorm,
@@ -114,18 +114,8 @@ with multiple threads.
114114
return nothing
115115
end
116116

117-
@inline function calculate_residuals!(
118-
out::Array, ũ::Array, u₀::Array, u₁::Array, α::Number,
119-
ρ::Number, internalnorm::F, t, ::False
120-
) where {F}
121-
@inbounds @simd ivdep for i in eachindex(out, ũ, u₀, u₁)
122-
out[i] = calculate_residuals(ũ[i], u₀[i], u₁[i], α, ρ, internalnorm, t)
123-
end
124-
return nothing
125-
end
126-
127117
"""
128-
calculate_residuals!(out, u₀, u₁, α, ρ, thread=False())
118+
calculate_residuals!(out, u₀, u₁, α, ρ, thread=Serial())
129119
130120
Save element-wise residuals
131121
```math
@@ -134,34 +124,34 @@ Save element-wise residuals
134124
in `out`.
135125
136126
The argument `thread` determines whether internal broadcasting on
137-
appropriate CPU arrays should be serial (`thread = False()`, default)
138-
or use multiple threads (`thread = True()`) when Julia is started
127+
appropriate CPU arrays should be serial (`thread = Serial()`, default)
128+
or use multiple threads (`thread = Threaded()`) when Julia is started
139129
with multiple threads.
140130
"""
141131
@inline function calculate_residuals!(
142132
out, u₀, u₁, α, ρ, internalnorm, t,
143-
thread::Union{False, True} = False()
133+
thread = Serial()
144134
)
145135
@.. broadcast = false thread = thread out = calculate_residuals(u₀, u₁, α, ρ, internalnorm, t)
146136
return nothing
147137
end
148138

149139
"""
150-
calculate_residuals!(out, E₁, E₂, u₀, u₁, α, ρ, δ, scalarnorm, thread=False())
140+
calculate_residuals!(out, E₁, E₂, u₀, u₁, α, ρ, δ, scalarnorm, thread=Serial())
151141
152142
Calculate element-wise residuals
153143
```math
154144
\\frac{δ E₁ + E₂}{α+\\max{scalarnorm(u₀),scalarnorm(u₁)}*ρ}.
155145
```
156146
157147
The argument `thread` determines whether internal broadcasting on
158-
appropriate CPU arrays should be serial (`thread = False()`, default)
159-
or use multiple threads (`thread = True()`) when Julia is started
148+
appropriate CPU arrays should be serial (`thread = Serial()`, default)
149+
or use multiple threads (`thread = Threaded()`) when Julia is started
160150
with multiple threads.
161151
"""
162152
@inline function calculate_residuals!(
163153
out, E₁, E₂, u₀, u₁, α, ρ, δ, scalarnorm, t,
164-
thread::Union{False, True} = False()
154+
thread = Serial()
165155
)
166156
@.. broadcast = false thread = thread out = calculate_residuals(
167157
E₁, E₂, u₀, u₁, α, ρ, δ,

lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ version = "1.11.0"
66
[deps]
77
MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
88
Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588"
9-
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
109
FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
1110
OrdinaryDiffEqLowOrderRK = "1344f307-1e59-4825-a18e-ace9aa3fa4c6"
1211
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
@@ -36,7 +35,6 @@ MuladdMacro = "0.2"
3635
Polyester = "0.7"
3736
SciMLBase = "2.116"
3837
OrdinaryDiffEqCore = "3"
39-
Static = "1.2"
4038
OrdinaryDiffEqLowOrderRK = "1.5.0"
4139
julia = "1.10"
4240
RecursiveArrayTools = "3.52"

lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import OrdinaryDiffEqCore: OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCac
1414
import OrdinaryDiffEqLowOrderRK: BS3ConstantCache, BS3Cache, RK4ConstantCache, RK4Cache
1515
import RecursiveArrayTools: recursivefill!
1616
using MuladdMacro, FastBroadcast
17-
import Static: False
17+
using FastBroadcast: Serial
1818
import OrdinaryDiffEqCore
1919

2020
using Reexport

lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_caches.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ function alg_cache(
420420
btmp = zero(u)
421421
bs3cache = BS3Cache(
422422
u, uprev, bk1, bk2, bk3, bk4, butilde, btmp, batmp, tab,
423-
trivial_limiter!, trivial_limiter!, False()
423+
trivial_limiter!, trivial_limiter!, Serial()
424424
)
425425
fsalfirst = zero(rate_prototype)
426426
k4 = zero(rate_prototype)
@@ -527,7 +527,7 @@ function alg_cache(
527527
recursivefill!(ratmp, false)
528528
rk4cache = RK4Cache(
529529
u, uprev, rk1, rk2, rk3, rk4, rk, rtmp, ratmp, trivial_limiter!,
530-
trivial_limiter!, False()
530+
trivial_limiter!, Serial()
531531
)
532532
fsalfirst = zero(rate_prototype)
533533
k4 = zero(rate_prototype)
@@ -636,7 +636,7 @@ function alg_cache(
636636
recursivefill!(ratmp, false)
637637
rk4cache = RK4Cache(
638638
u, uprev, rk1, rk2, rk3, rk4, rk, rtmp, ratmp, trivial_limiter!,
639-
trivial_limiter!, False()
639+
trivial_limiter!, Serial()
640640
)
641641
fsalfirst = zero(rate_prototype)
642642
k4 = zero(rate_prototype)
@@ -750,7 +750,7 @@ function alg_cache(
750750
btmp = zero(u)
751751
bs3cache = BS3Cache(
752752
u, uprev, bk1, bk2, bk3, bk4, butilde, btmp, batmp, tab,
753-
trivial_limiter!, trivial_limiter!, False()
753+
trivial_limiter!, trivial_limiter!, Serial()
754754
)
755755
fsalfirst = zero(rate_prototype)
756756
k4 = zero(rate_prototype)
@@ -869,7 +869,7 @@ function alg_cache(
869869
recursivefill!(ratmp, false)
870870
rk4cache = RK4Cache(
871871
u, uprev, rk1, rk2, rk3, rk4, rk, rtmp, ratmp, trivial_limiter!,
872-
trivial_limiter!, False()
872+
trivial_limiter!, Serial()
873873
)
874874
fsalfirst = zero(rate_prototype)
875875
k4 = zero(rate_prototype)
@@ -988,7 +988,7 @@ function alg_cache(
988988
recursivefill!(ratmp, false)
989989
rk4cache = RK4Cache(
990990
u, uprev, rk1, rk2, rk3, rk4, rk, rtmp, ratmp, trivial_limiter!,
991-
trivial_limiter!, False()
991+
trivial_limiter!, Serial()
992992
)
993993
fsalfirst = zero(rate_prototype)
994994
k4 = zero(rate_prototype)

lib/OrdinaryDiffEqAdamsBashforthMoulton/src/algorithms.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Problems. Computational Mathematics (2nd revised ed.), Springer (1996) doi:
44
https://doi.org/10.1007/978-3-540-78862-1"""
55

66
keyword_default_description = """
7-
- `thread`: determines whether internal broadcasting on appropriate CPU arrays should be serial (`thread = OrdinaryDiffEq.False()`) or use multiple threads (`thread = OrdinaryDiffEq.True()`) when Julia is started with multiple threads.
7+
- `thread`: determines whether internal broadcasting on appropriate CPU arrays should be serial (`thread = Serial()`) or use multiple threads (`thread = Threaded()`) when Julia is started with multiple threads.
88
"""
99

1010
keyword_default = """
11-
thread = OrdinaryDiffEq.False(),
11+
thread = Serial(),
1212
"""
1313

1414
@doc generic_solver_docstring(
@@ -21,7 +21,7 @@ thread = OrdinaryDiffEq.False(),
2121
keyword_default
2222
)
2323
Base.@kwdef struct AB3{Thread} <: OrdinaryDiffEqAlgorithm
24-
thread::Thread = False()
24+
thread::Thread = Serial()
2525
end
2626

2727
@doc generic_solver_docstring(
@@ -34,7 +34,7 @@ end
3434
keyword_default
3535
)
3636
Base.@kwdef struct AB4{Thread} <: OrdinaryDiffEqAlgorithm
37-
thread::Thread = False()
37+
thread::Thread = Serial()
3838
end
3939

4040
@doc generic_solver_docstring(
@@ -47,7 +47,7 @@ end
4747
keyword_default
4848
)
4949
Base.@kwdef struct AB5{Thread} <: OrdinaryDiffEqAlgorithm
50-
thread::Thread = False()
50+
thread::Thread = Serial()
5151
end
5252

5353
@doc generic_solver_docstring(
@@ -61,7 +61,7 @@ end
6161
keyword_default
6262
)
6363
Base.@kwdef struct ABM32{Thread} <: OrdinaryDiffEqAlgorithm
64-
thread::Thread = False()
64+
thread::Thread = Serial()
6565
end
6666

6767
@doc generic_solver_docstring(
@@ -75,7 +75,7 @@ end
7575
keyword_default
7676
)
7777
Base.@kwdef struct ABM43{Thread} <: OrdinaryDiffEqAlgorithm
78-
thread::Thread = False()
78+
thread::Thread = Serial()
7979
end
8080

8181
@doc generic_solver_docstring(
@@ -89,7 +89,7 @@ end
8989
keyword_default
9090
)
9191
Base.@kwdef struct ABM54{Thread} <: OrdinaryDiffEqAlgorithm
92-
thread::Thread = False()
92+
thread::Thread = Serial()
9393
end
9494

9595
# Variable Step Size Adams methods
@@ -104,7 +104,7 @@ end
104104
keyword_default
105105
)
106106
Base.@kwdef struct VCAB3{Thread} <: OrdinaryDiffEqAdaptiveAlgorithm
107-
thread::Thread = False()
107+
thread::Thread = Serial()
108108
end
109109

110110
@doc generic_solver_docstring(
@@ -117,7 +117,7 @@ end
117117
keyword_default
118118
)
119119
Base.@kwdef struct VCAB4{Thread} <: OrdinaryDiffEqAdaptiveAlgorithm
120-
thread::Thread = False()
120+
thread::Thread = Serial()
121121
end
122122

123123
@doc generic_solver_docstring(
@@ -130,7 +130,7 @@ end
130130
keyword_default
131131
)
132132
Base.@kwdef struct VCAB5{Thread} <: OrdinaryDiffEqAdaptiveAlgorithm
133-
thread::Thread = False()
133+
thread::Thread = Serial()
134134
end
135135

136136
@doc generic_solver_docstring(
@@ -143,7 +143,7 @@ end
143143
keyword_default
144144
)
145145
Base.@kwdef struct VCABM3{Thread} <: OrdinaryDiffEqAdaptiveAlgorithm
146-
thread::Thread = False()
146+
thread::Thread = Serial()
147147
end
148148

149149
@doc generic_solver_docstring(
@@ -156,7 +156,7 @@ end
156156
keyword_default
157157
)
158158
Base.@kwdef struct VCABM4{Thread} <: OrdinaryDiffEqAdaptiveAlgorithm
159-
thread::Thread = False()
159+
thread::Thread = Serial()
160160
end
161161

162162
@doc generic_solver_docstring(
@@ -169,7 +169,7 @@ end
169169
keyword_default
170170
)
171171
Base.@kwdef struct VCABM5{Thread} <: OrdinaryDiffEqAdaptiveAlgorithm
172-
thread::Thread = False()
172+
thread::Thread = Serial()
173173
end
174174

175175
# Variable Order and Variable Step Size Adams methods
@@ -184,5 +184,5 @@ end
184184
keyword_default
185185
)
186186
Base.@kwdef struct VCABM{Thread} <: OrdinaryDiffEqAdamsVarOrderVarStepAlgorithm
187-
thread::Thread = False()
187+
thread::Thread = Serial()
188188
end

lib/OrdinaryDiffEqAdamsBashforthMoulton/test/regression_test_threading.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using OrdinaryDiffEqAdamsBashforthMoulton, ODEProblemLibrary
22
import OrdinaryDiffEqCore: OrdinaryDiffEqAdaptiveAlgorithm
33
using Test
4-
using Static
4+
using FastBroadcast: Serial, Threaded
55

66
algorithms = [
77
AB3, AB4, AB5, ABM32, ABM43, ABM54, VCAB3, VCAB4, VCAB5, VCABM3, VCABM4, VCABM5, VCABM,
@@ -12,11 +12,11 @@ problem = ODEProblemLibrary.prob_ode_linear
1212
@testset "Regression test for threading versions vs non threading versions" begin
1313
@testset "$ALG" for ALG in algorithms
1414
if ALG isa OrdinaryDiffEqAdaptiveAlgorithm
15-
sol_thread = solve(problem, ALG(Static.True()))
16-
sol_nothread = solve(problem, ALG(Static.False()))
15+
sol_thread = solve(problem, ALG(Threaded()))
16+
sol_nothread = solve(problem, ALG(Serial()))
1717
else
18-
sol_thread = solve(problem, ALG(Static.True()), dt = 1 // 2^9)
19-
sol_nothread = solve(problem, ALG(Static.False()), dt = 1 // 2^9)
18+
sol_thread = solve(problem, ALG(Threaded()), dt = 1 // 2^9)
19+
sol_nothread = solve(problem, ALG(Serial()), dt = 1 // 2^9)
2020
end
2121
@test all(sol_nothread .== sol_thread)
2222
end

0 commit comments

Comments
 (0)