Skip to content

Commit 9d28be0

Browse files
Add OrdinaryDiffEqSIMDRK as a standalone sublibrary
This PR adds SIMDRungeKutta.jl code as a new sublibrary OrdinaryDiffEqSIMDRK in the lib folder. Key points: - The sublibrary is NOT a dependency of OrdinaryDiffEq.jl - It is NOT imported or re-exported by OrdinaryDiffEq.jl - Users can depend on it directly as a separate package - Contains MER5v2, MER6v2, and RK6v4 SIMD-optimized Runge-Kutta methods This follows the pattern of having sublibraries in the lib folder that can be used independently. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 252f591 commit 9d28be0

File tree

10 files changed

+1820
-0
lines changed

10 files changed

+1820
-0
lines changed

lib/OrdinaryDiffEqSIMDRK/LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Yingbo Ma <mayingbo5@gmail.com> and contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

lib/OrdinaryDiffEqSIMDRK/Project.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name = "OrdinaryDiffEqSIMDRK"
2+
uuid = "dc97f408-7a72-40e4-9b0d-228a53b292f8"
3+
authors = ["Yingbo Ma <mayingbo5@gmail.com>", "Chris Elrod <elrodc@gmail.com>"]
4+
version = "1.0.0"
5+
6+
[deps]
7+
MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
8+
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
9+
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
10+
SLEEFPirates = "476501e8-09a2-5ece-8869-fb82de89a1fa"
11+
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
12+
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
13+
VectorizationBase = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
14+
15+
[compat]
16+
MuladdMacro = "0.2"
17+
OrdinaryDiffEqCore = "1"
18+
Reexport = "1"
19+
SLEEFPirates = "0.6"
20+
Static = "0.7, 0.8, 1"
21+
UnPack = "1"
22+
VectorizationBase = "0.21"
23+
julia = "1.10"
24+
25+
[extras]
26+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
27+
28+
[targets]
29+
test = ["Test"]
30+
31+
[sources.OrdinaryDiffEqCore]
32+
path = "../OrdinaryDiffEqCore"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module OrdinaryDiffEqSIMDRK
2+
3+
using MuladdMacro, UnPack, Static
4+
using OrdinaryDiffEqCore: OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqConstantCache,
5+
trivial_limiter!, calculate_residuals, constvalue
6+
import OrdinaryDiffEqCore: initialize!, perform_step!, alg_cache
7+
8+
using Reexport: @reexport
9+
@reexport using OrdinaryDiffEqCore
10+
11+
include("algorithms.jl")
12+
include("caches.jl")
13+
include("perform_step.jl")
14+
15+
export MER5v2, MER6v2, RK6v4
16+
17+
end
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
struct MER5v2{StageLimiter, StepLimiter, Thread} <: OrdinaryDiffEqAdaptiveAlgorithm
2+
stage_limiter!::StageLimiter
3+
step_limiter!::StepLimiter
4+
thread::Thread
5+
end
6+
7+
function MER5v2(; stage_limiter! = trivial_limiter!, step_limiter! = trivial_limiter!,
8+
thread = False())
9+
MER5v2{typeof(stage_limiter!), typeof(step_limiter!), typeof(thread)}(stage_limiter!,
10+
step_limiter!,
11+
thread)
12+
end
13+
14+
# for backwards compatibility
15+
function MER5v2(stage_limiter!, step_limiter! = trivial_limiter!)
16+
MER5v2{typeof(stage_limiter!), typeof(step_limiter!), False}(stage_limiter!,
17+
step_limiter!, False())
18+
end
19+
20+
struct MER6v2{StageLimiter, StepLimiter, Thread} <: OrdinaryDiffEqAdaptiveAlgorithm
21+
stage_limiter!::StageLimiter
22+
step_limiter!::StepLimiter
23+
thread::Thread
24+
end
25+
26+
function MER6v2(; stage_limiter! = trivial_limiter!, step_limiter! = trivial_limiter!,
27+
thread = False())
28+
MER6v2{typeof(stage_limiter!), typeof(step_limiter!), typeof(thread)}(stage_limiter!,
29+
step_limiter!,
30+
thread)
31+
end
32+
33+
# for backwards compatibility
34+
function MER6v2(stage_limiter!, step_limiter! = trivial_limiter!)
35+
MER6v2{typeof(stage_limiter!), typeof(step_limiter!), False}(stage_limiter!,
36+
step_limiter!, False())
37+
end
38+
39+
struct RK6v4{StageLimiter, StepLimiter, Thread} <: OrdinaryDiffEqAdaptiveAlgorithm
40+
stage_limiter!::StageLimiter
41+
step_limiter!::StepLimiter
42+
thread::Thread
43+
end
44+
45+
function RK6v4(; stage_limiter! = trivial_limiter!, step_limiter! = trivial_limiter!,
46+
thread = False())
47+
RK6v4{typeof(stage_limiter!), typeof(step_limiter!), typeof(thread)}(stage_limiter!,
48+
step_limiter!,
49+
thread)
50+
end
51+
52+
# for backwards compatibility
53+
function RK6v4(stage_limiter!, step_limiter! = trivial_limiter!)
54+
RK6v4{typeof(stage_limiter!), typeof(step_limiter!), False}(stage_limiter!,
55+
step_limiter!, False())
56+
end
57+
58+
function Base.show(io::IO, alg::Union{MER5v2, MER6v2, RK6v4})
59+
print(io, "$(nameof(typeof(alg)))(stage_limiter! = ", alg.stage_limiter!,
60+
", step_limiter! = ", alg.step_limiter!,
61+
", thread = ", alg.thread, ")")
62+
end
63+
64+
OrdinaryDiffEqCore.alg_order(alg::MER5v2) = 5
65+
OrdinaryDiffEqCore.alg_order(alg::MER6v2) = 6
66+
OrdinaryDiffEqCore.alg_order(alg::RK6v4) = 6

0 commit comments

Comments
 (0)