Skip to content

Commit 75ebb50

Browse files
Merge branch 'master' into compathelper/new_version/2024-08-10-09-35-54-330-00466993800
2 parents e1f542e + f1d3704 commit 75ebb50

File tree

19 files changed

+443
-122
lines changed

19 files changed

+443
-122
lines changed

Project.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,33 @@ DataStructures = "0.18"
8181
DiffEqBase = "6.147"
8282
DocStringExtensions = "0.9"
8383
EnumX = "1"
84+
ExponentialUtilities = "1"
8485
FastBroadcast = "0.2, 0.3"
8586
FastClosures = "0.3"
8687
FillArrays = "1.9"
8788
FiniteDiff = "2"
89+
ForwardDiff = "0.10"
8890
FunctionWrappersWrappers = "0.1"
8991
InteractiveUtils = "1.9"
92+
LineSearches = "7"
9093
LinearAlgebra = "1.9"
94+
LinearSolve = "2"
9195
Logging = "1.9"
9296
MacroTools = "0.5"
9397
MuladdMacro = "0.2.1"
98+
NonlinearSolve = "3"
9499
Polyester = "0.7"
100+
PreallocationTools = "0.4"
95101
PrecompileTools = "1"
96102
Preferences = "1.3"
97103
RecursiveArrayTools = "2.36, 3"
98104
Reexport = "1.0"
99105
SciMLBase = "2.27.1"
100106
SciMLOperators = "0.3"
101107
SciMLStructures = "1"
108+
SimpleNonlinearSolve = "1"
102109
SimpleUnPack = "1"
110+
SparseDiffTools = "2"
103111
Static = "0.8, 1"
104112
StaticArrayInterface = "1.2"
105113
StaticArrays = "1.0"

lib/OrdinaryDiffEqBDF/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
1818
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
1919
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
2020
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
21+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
22+
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
2123

2224
[extras]
2325
DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d"

lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ using TruncatedStacktraces, MuladdMacro, MacroTools, FastBroadcast, RecursiveArr
2626
import StaticArrays: SArray, MVector, SVector, @SVector, StaticArray, MMatrix, SA
2727
using LinearAlgebra: mul!, I
2828
using ArrayInterface
29+
import OrdinaryDiffEqCore
2930
using OrdinaryDiffEqDifferentiation: UJacobianWrapper
3031
using OrdinaryDiffEqNonlinearSolve: NLNewton, du_alias_or_new, build_nlsolver,
3132
nlsolve!, nlsolvefail, isnewton, markfirststage!,
@@ -43,6 +44,53 @@ include("controllers.jl")
4344
include("dae_perform_step.jl")
4445
include("bdf_perform_step.jl")
4546

47+
import PrecompileTools
48+
import Preferences
49+
PrecompileTools.@compile_workload begin
50+
lorenz = OrdinaryDiffEqCore.lorenz
51+
lorenz_oop = OrdinaryDiffEqCore.lorenz_oop
52+
solver_list = [FBDF()]
53+
prob_list = []
54+
55+
if Preferences.@load_preference("PrecompileDefaultSpecialize", true)
56+
push!(prob_list, ODEProblem(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0)))
57+
push!(prob_list, ODEProblem(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0), Float64[]))
58+
end
59+
60+
if Preferences.@load_preference("PrecompileAutoSpecialize", false)
61+
push!(prob_list,
62+
ODEProblem{true, SciMLBase.AutoSpecialize}(lorenz, [1.0; 0.0; 0.0],
63+
(0.0, 1.0)))
64+
push!(prob_list,
65+
ODEProblem{true, SciMLBase.AutoSpecialize}(lorenz, [1.0; 0.0; 0.0],
66+
(0.0, 1.0), Float64[]))
67+
end
68+
69+
if Preferences.@load_preference("PrecompileFunctionWrapperSpecialize", false)
70+
push!(prob_list,
71+
ODEProblem{true, SciMLBase.FunctionWrapperSpecialize}(lorenz, [1.0; 0.0; 0.0],
72+
(0.0, 1.0)))
73+
push!(prob_list,
74+
ODEProblem{true, SciMLBase.FunctionWrapperSpecialize}(lorenz, [1.0; 0.0; 0.0],
75+
(0.0, 1.0), Float64[]))
76+
end
77+
78+
if Preferences.@load_preference("PrecompileNoSpecialize", false)
79+
push!(prob_list,
80+
ODEProblem{true, SciMLBase.NoSpecialize}(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0)))
81+
push!(prob_list,
82+
ODEProblem{true, SciMLBase.NoSpecialize}(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0),
83+
Float64[]))
84+
end
85+
86+
for prob in prob_list, solver in solver_list
87+
solve(prob, solver)(5.0)
88+
end
89+
90+
prob_list = nothing
91+
solver_list = nothing
92+
end
93+
4694
export ABDF2, QNDF1, QBDF1, QNDF2, QBDF2, QNDF, QBDF, FBDF,
4795
SBDF2, SBDF3, SBDF4, MEBDF2, IMEXEuler, IMEXEulerARK,
4896
DABDF2, DImplicitEuler, DFBDF

lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,6 @@ include("solve.jl")
136136
include("initdt.jl")
137137
include("interp_func.jl")
138138

139+
include("precompilation_setup.jl")
140+
139141
end
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function lorenz(du, u, p, t)
2+
du[1] = 10.0(u[2] - u[1])
3+
du[2] = u[1] * (28.0 - u[3]) - u[2]
4+
du[3] = u[1] * u[2] - (8 / 3) * u[3]
5+
end
6+
7+
function lorenz_oop(u, p, t)
8+
[10.0(u[2] - u[1]), u[1] * (28.0 - u[3]) - u[2], u[1] * u[2] - (8 / 3) * u[3]]
9+
end
10+
11+
PrecompileTools.@compile_workload begin
12+
ODEProblem(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0))
13+
ODEProblem(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0), Float64[])
14+
ODEProblem{true, SciMLBase.AutoSpecialize}(lorenz, [1.0; 0.0; 0.0],
15+
(0.0, 1.0))
16+
ODEProblem{true, SciMLBase.AutoSpecialize}(lorenz, [1.0; 0.0; 0.0],
17+
(0.0, 1.0), Float64[])
18+
ODEProblem{true, SciMLBase.FunctionWrapperSpecialize}(lorenz, [1.0; 0.0; 0.0],
19+
(0.0, 1.0))
20+
ODEProblem{true, SciMLBase.FunctionWrapperSpecialize}(lorenz, [1.0; 0.0; 0.0],
21+
(0.0, 1.0), Float64[])
22+
ODEProblem{true, SciMLBase.NoSpecialize}(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0))
23+
ODEProblem{true, SciMLBase.NoSpecialize}(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0),
24+
Float64[])
25+
26+
lorenz([1.0; 0.0; 0.0], [1.0; 0.0; 0.0], DiffEqBase.NullParameters(), 0.0)
27+
lorenz([1.0; 0.0; 0.0], [1.0; 0.0; 0.0], Float64[], 0.0)
28+
lorenz_oop([1.0; 0.0; 0.0], DiffEqBase.NullParameters(), 0.0)
29+
lorenz_oop([1.0; 0.0; 0.0], Float64[], 0.0)
30+
end

lib/OrdinaryDiffEqDefault/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2"
1414
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
1515
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1616
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
17+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
18+
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
1719

1820
[extras]
1921
DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d"

lib/OrdinaryDiffEqDefault/src/OrdinaryDiffEqDefault.jl

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ using OrdinaryDiffEqVerner: Vern7, Vern8, Vern9, Vern6
88
using OrdinaryDiffEqTsit5: Tsit5
99
using OrdinaryDiffEqRosenbrock: Rosenbrock23, Rodas5P
1010
using OrdinaryDiffEqBDF: FBDF
11+
import OrdinaryDiffEqCore
1112

1213
import OrdinaryDiffEqCore: is_mass_matrix_alg, default_autoswitch, isdefaultalg
1314
import LinearSolve
@@ -19,6 +20,69 @@ using Reexport
1920

2021
include("default_alg.jl")
2122

23+
import PrecompileTools
24+
import Preferences
25+
PrecompileTools.@compile_workload begin
26+
lorenz = OrdinaryDiffEqCore.lorenz
27+
lorenz_oop = OrdinaryDiffEqCore.lorenz_oop
28+
solver_list = []
29+
prob_list = []
30+
31+
default_ode = [
32+
DefaultODEAlgorithm(autodiff = false)
33+
]
34+
35+
default_autodiff_ode = [
36+
DefaultODEAlgorithm()
37+
]
38+
39+
if Preferences.@load_preference("PrecompileDefault", true)
40+
append!(solver_list, default_ode)
41+
end
42+
43+
if Preferences.@load_preference("PrecompileAutodiffDefault", true)
44+
append!(solver_list, default_autodiff_ode)
45+
end
46+
47+
if Preferences.@load_preference("PrecompileDefaultSpecialize", true)
48+
push!(prob_list, ODEProblem(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0)))
49+
push!(prob_list, ODEProblem(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0), Float64[]))
50+
end
51+
52+
if Preferences.@load_preference("PrecompileAutoSpecialize", false)
53+
push!(prob_list,
54+
ODEProblem{true, SciMLBase.AutoSpecialize}(lorenz, [1.0; 0.0; 0.0],
55+
(0.0, 1.0)))
56+
push!(prob_list,
57+
ODEProblem{true, SciMLBase.AutoSpecialize}(lorenz, [1.0; 0.0; 0.0],
58+
(0.0, 1.0), Float64[]))
59+
end
60+
61+
if Preferences.@load_preference("PrecompileFunctionWrapperSpecialize", false)
62+
push!(prob_list,
63+
ODEProblem{true, SciMLBase.FunctionWrapperSpecialize}(lorenz, [1.0; 0.0; 0.0],
64+
(0.0, 1.0)))
65+
push!(prob_list,
66+
ODEProblem{true, SciMLBase.FunctionWrapperSpecialize}(lorenz, [1.0; 0.0; 0.0],
67+
(0.0, 1.0), Float64[]))
68+
end
69+
70+
if Preferences.@load_preference("PrecompileNoSpecialize", false)
71+
push!(prob_list,
72+
ODEProblem{true, SciMLBase.NoSpecialize}(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0)))
73+
push!(prob_list,
74+
ODEProblem{true, SciMLBase.NoSpecialize}(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0),
75+
Float64[]))
76+
end
77+
78+
for prob in prob_list, solver in solver_list
79+
solve(prob, solver)(5.0)
80+
end
81+
82+
prob_list = nothing
83+
solver_list = nothing
84+
end
85+
2286
export DefaultODEAlgorithm
2387

2488
end # module OrdinaryDiffEqDefault

lib/OrdinaryDiffEqLowStorageRK/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
1414
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
1515
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1616
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
17+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
18+
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
1719

1820
[compat]
1921
julia = "1.10"

lib/OrdinaryDiffEqLowStorageRK/src/OrdinaryDiffEqLowStorageRK.jl

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools, Adapt
1616
import StaticArrays: SArray, MVector, SVector, @SVector, StaticArray, MMatrix, SA
1717
import Static: False
1818
import RecursiveArrayTools: recursive_unitless_bottom_eltype
19+
import OrdinaryDiffEqCore
1920

2021
using Reexport
2122
@reexport using DiffEqBase
@@ -26,6 +27,71 @@ include("alg_utils.jl")
2627
include("low_storage_rk_caches.jl")
2728
include("low_storage_rk_perform_step.jl")
2829

30+
import PrecompileTools
31+
import Preferences
32+
PrecompileTools.@compile_workload begin
33+
lorenz = OrdinaryDiffEqCore.lorenz
34+
lorenz_oop = OrdinaryDiffEqCore.lorenz_oop
35+
solver_list = []
36+
solver_list_nonadaptive = []
37+
prob_list = []
38+
39+
low_storage = [
40+
RDPK3SpFSAL35(), RDPK3SpFSAL49()
41+
]
42+
43+
low_storage_nonadaptive = [
44+
CarpenterKennedy2N54(williamson_condition = false)
45+
]
46+
47+
if Preferences.@load_preference("PrecompileLowStorage", false)
48+
append!(solver_list, low_storage)
49+
append!(solver_list_nonadaptive, low_storage_nonadaptive)
50+
end
51+
52+
if Preferences.@load_preference("PrecompileDefaultSpecialize", true)
53+
push!(prob_list, ODEProblem(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0)))
54+
push!(prob_list, ODEProblem(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0), Float64[]))
55+
end
56+
57+
if Preferences.@load_preference("PrecompileAutoSpecialize", false)
58+
push!(prob_list,
59+
ODEProblem{true, SciMLBase.AutoSpecialize}(lorenz, [1.0; 0.0; 0.0],
60+
(0.0, 1.0)))
61+
push!(prob_list,
62+
ODEProblem{true, SciMLBase.AutoSpecialize}(lorenz, [1.0; 0.0; 0.0],
63+
(0.0, 1.0), Float64[]))
64+
end
65+
66+
if Preferences.@load_preference("PrecompileFunctionWrapperSpecialize", false)
67+
push!(prob_list,
68+
ODEProblem{true, SciMLBase.FunctionWrapperSpecialize}(lorenz, [1.0; 0.0; 0.0],
69+
(0.0, 1.0)))
70+
push!(prob_list,
71+
ODEProblem{true, SciMLBase.FunctionWrapperSpecialize}(lorenz, [1.0; 0.0; 0.0],
72+
(0.0, 1.0), Float64[]))
73+
end
74+
75+
if Preferences.@load_preference("PrecompileNoSpecialize", false)
76+
push!(prob_list,
77+
ODEProblem{true, SciMLBase.NoSpecialize}(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0)))
78+
push!(prob_list,
79+
ODEProblem{true, SciMLBase.NoSpecialize}(lorenz, [1.0; 0.0; 0.0], (0.0, 1.0),
80+
Float64[]))
81+
end
82+
83+
for prob in prob_list, solver in solver_list
84+
solve(prob, solver)(5.0)
85+
end
86+
87+
for prob in prob_list, solver in solver_list_nonadaptive
88+
solve(prob, solver; dt = 0.5)(5.0)
89+
end
90+
91+
prob_list = nothing
92+
solver_list = nothing
93+
end
94+
2995
export ORK256, CarpenterKennedy2N54, SHLDDRK64, HSLDDRK64, DGLDDRK73_C, DGLDDRK84_C,
3096
DGLDDRK84_F, NDBLSRK124, NDBLSRK134, NDBLSRK144,
3197
CFRLDDRK64, TSLDDRK74, CKLLSRK43_2, CKLLSRK54_3C,

lib/OrdinaryDiffEqNonlinearSolve/Project.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
99
OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b"
1010
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
1111
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
12-
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
13-
DiffEqFlux = "aae7a2af-3d4f-5e19-a356-7da93b79d9d0"
14-
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
1512
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
16-
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
17-
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
1813
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
1914
FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
2015
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"

0 commit comments

Comments
 (0)