Skip to content

Commit 0428052

Browse files
Merge pull request #2311 from SciML/cleanup
reconfigure CI testing to actually test the submodules in isolation
2 parents cb95437 + 08f1b42 commit 0428052

File tree

41 files changed

+827
-891
lines changed

Some content is hidden

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

41 files changed

+827
-891
lines changed

.github/workflows/CI.yml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,36 @@ jobs:
2424
- Downstream
2525
- ODEInterfaceRegression
2626
- Multithreading
27-
- FIRK
28-
- Symplectic
29-
- Extrapolation
30-
- Feagin
31-
- StabilizedRK
32-
- StabilizedIRK
33-
- SSPRK
34-
- LowStorageRK
35-
- QPRK
36-
- Linear
27+
28+
- OrdinaryDiffEqAdamsBashforthMoulton
29+
- OrdinaryDiffEqBDF
30+
- OrdinaryDiffEqDefault
31+
- OrdinaryDiffEqDifferentiation
32+
- OrdinaryDiffEqExplicitRK
33+
- OrdinaryDiffEqExponentialRK
34+
- OrdinaryDiffEqExtrapolation
35+
- OrdinaryDiffEqFIRK
36+
- OrdinaryDiffEqFeagin
37+
- OrdinaryDiffEqFunctionMap
38+
- OrdinaryDiffEqHighOrderRK
39+
- OrdinaryDiffEqIMEXMultistep
40+
- OrdinaryDiffEqLinear
41+
- OrdinaryDiffEqLowOrderRK
42+
- OrdinaryDiffEqLowStorageRK
43+
- OrdinaryDiffEqNordsieck
44+
- OrdinaryDiffEqPDIRK
45+
- OrdinaryDiffEqPRK
46+
- OrdinaryDiffEqQPRK
47+
- OrdinaryDiffEqRKN
48+
- OrdinaryDiffEqRosenbrock
49+
- OrdinaryDiffEqSDIRK
50+
- OrdinaryDiffEqSSPRK
51+
- OrdinaryDiffEqStabilizedIRK
52+
- OrdinaryDiffEqStabilizedRK
53+
- OrdinaryDiffEqSymplecticRK
54+
- OrdinaryDiffEqTsit5
55+
- OrdinaryDiffEqVerner
56+
3757
version:
3858
- '1'
3959
steps:

lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ julia = "1.10"
1717

1818
[extras]
1919
DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d"
20+
ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5"
2021
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2122
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
2223
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2324

2425
[targets]
25-
test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test"]
26+
test = ["DiffEqDevTools", "ODEProblemLibrary", "Random", "SafeTestsets", "Test"]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This definitely needs cleaning
2+
using OrdinaryDiffEq, ODEProblemLibrary, DiffEqDevTools
3+
using Test, Random
4+
Random.seed!(100)
5+
6+
## Convergence Testing
7+
dts1 = 1 .// 2 .^ (9:-1:5)
8+
dts = 1 .// 2 .^ (8:-1:4)
9+
testTol = 0.2
10+
11+
@testset "Explicit Solver Convergence Tests ($(["out-of-place", "in-place"][i]))" for i in 1:2
12+
prob = (ODEProblemLibrary.prob_ode_linear,
13+
ODEProblemLibrary.prob_ode_2Dlinear)[i]
14+
15+
sim5 = test_convergence(dts, prob, AB3())
16+
@test sim5.𝒪est[:l2]3 atol=testTol
17+
sim6 = test_convergence(dts, prob, ABM32())
18+
@test sim6.𝒪est[:l2]3 atol=testTol
19+
sim7 = test_convergence(dts, prob, AB4())
20+
@test sim7.𝒪est[:l2]4 atol=testTol
21+
sim8 = test_convergence(dts1, prob, ABM43()) #using dts1 due to floating point error in convergence test
22+
@test sim8.𝒪est[:l2]4 atol=testTol
23+
sim9 = test_convergence(dts, prob, AB5())
24+
@test sim9.𝒪est[:l2]5 atol=testTol
25+
sim10 = test_convergence(dts, prob, ABM54())
26+
@test sim10.𝒪est[:l2]5 atol=testTol
27+
sim101 = test_convergence(dts, prob, VCAB3())
28+
@test sim101.𝒪est[:l2]3 atol=testTol
29+
sim102 = test_convergence(dts, prob, VCAB4())
30+
@test sim102.𝒪est[:l2]4 atol=testTol
31+
sim103 = test_convergence(dts, prob, VCAB5())
32+
@test sim103.𝒪est[:l2]5 atol=testTol
33+
sim104 = test_convergence(dts, prob, VCABM3())
34+
@test sim104.𝒪est[:l2]3 atol=testTol
35+
sim105 = test_convergence(dts, prob, VCABM4())
36+
@test sim105.𝒪est[:l2]4 atol=testTol
37+
sim106 = test_convergence(dts, prob, VCABM5())
38+
@test sim106.𝒪est[:l2]5 atol=testTol
39+
end
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
using SafeTestsets
22

3-
@time @safetestset "Adams Variable Coefficients Tests" include("adams_tests.jl")
3+
@time @safetestset "ABM Convergence Tests" include("abm_convergence_tests.jl")
4+
@time @safetestset "Adams Variable Coefficients Tests" include("adams_tests.jl")

lib/OrdinaryDiffEqBDF/Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
1616

1717
[extras]
1818
DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d"
19+
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1920
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2021
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
2122
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
@@ -24,4 +25,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2425
julia = "1.10"
2526

2627
[targets]
27-
test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test"]
28+
test = ["DiffEqDevTools", "ForwardDiff", "Random", "SafeTestsets", "Test"]
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This definitely needs cleaning
2+
using OrdinaryDiffEq, ODEProblemLibrary, DiffEqDevTools
3+
using Test, Random
4+
Random.seed!(100)
5+
6+
testTol = 0.2
7+
8+
@testset "Implicit Solver Convergence Tests ($(["out-of-place", "in-place"][i]))" for i in 1:2
9+
prob = (ODEProblemLibrary.prob_ode_linear,
10+
ODEProblemLibrary.prob_ode_2Dlinear)[i]
11+
12+
sim = test_convergence(dts, prob, ABDF2())
13+
@test sim.𝒪est[:final]2 atol=testTol
14+
@test sim.𝒪est[:l2]2 atol=testTol
15+
@test sim.𝒪est[:l∞]2 atol=testTol
16+
17+
sim = test_convergence(dts, prob, ABDF2(nlsolve = NLFunctional()))
18+
@test sim.𝒪est[:final]2 atol=testTol
19+
@test sim.𝒪est[:l2]2 atol=testTol
20+
@test sim.𝒪est[:l∞]2 atol=testTol
21+
22+
# QBDF
23+
sim = test_convergence(dts, prob, QBDF1())
24+
@test sim.𝒪est[:final]1 atol=testTol
25+
@test sim.𝒪est[:l2]1 atol=testTol
26+
@test sim.𝒪est[:l∞]1 atol=testTol
27+
28+
sim = test_convergence(dts, prob, QBDF2())
29+
@test sim.𝒪est[:final]2 atol=testTol
30+
@test sim.𝒪est[:l2]2 atol=testTol
31+
@test sim.𝒪est[:l∞]2 atol=testTol
32+
33+
# QNDF
34+
sim = test_convergence(dts, prob, QNDF1())
35+
@test sim.𝒪est[:final]1 atol=testTol
36+
@test sim.𝒪est[:l2]1 atol=testTol
37+
@test sim.𝒪est[:l∞]1 atol=testTol
38+
39+
sim = test_convergence(dts3, prob, QNDF2())
40+
@test sim.𝒪est[:final]2 atol=testTol
41+
@test sim.𝒪est[:l2]2 atol=testTol
42+
@test sim.𝒪est[:l∞]2 atol=testTol
43+
44+
sim = test_convergence(dts, prob, QNDF2(nlsolve = NLFunctional()))
45+
@test sim.𝒪est[:final]2 atol=testTol
46+
@test sim.𝒪est[:l2]2 atol=testTol
47+
@test sim.𝒪est[:l∞]2 atol=testTol
48+
@test_nowarn solve(prob, QNDF())
49+
50+
# MEBDF2
51+
sim21 = test_convergence(dts, prob, MEBDF2(extrapolant = :linear))
52+
@test sim21.𝒪est[:final]2 atol=testTol
53+
54+
sim22 = test_convergence(dts, prob, MEBDF2(nlsolve = NLFunctional()), reltol = 1e-2)
55+
@test sim22.𝒪est[:final]2 atol=testTol
56+
57+
sim23 = test_convergence(dts, prob, MEBDF2(nlsolve = NLAnderson()), reltol = 1e-2)
58+
@test sim23.𝒪est[:final]2 atol=testTol
59+
60+
sim24 = test_convergence(
61+
dts, prob, MEBDF2(nlsolve = NonlinearSolveAlg()), reltol = 1e-2)
62+
@test sim24.𝒪est[:final]2 atol=testTol
63+
64+
#FBDF
65+
@test_nowarn solve(prob, FBDF())
66+
end

lib/OrdinaryDiffEqBDF/test/dae_ad_tests.jl

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,5 @@
11
using OrdinaryDiffEq, LinearAlgebra, ForwardDiff, Test
22

3-
function rober(du, u, p, t)
4-
y₁, y₂, y₃ = u
5-
k₁, k₂, k₃ = p
6-
du[1] = -k₁ * y₁ + k₃ * y₂ * y₃
7-
du[2] = k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^2
8-
du[3] = y₁ + y₂ + y₃ - 1
9-
nothing
10-
end
11-
function rober(u, p, t)
12-
y₁, y₂, y₃ = u
13-
k₁, k₂, k₃ = p
14-
[-k₁ * y₁ + k₃ * y₂ * y₃,
15-
k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^2,
16-
y₁ + y₂ + y₃ - 1]
17-
end
18-
M = [1.0 0 0
19-
0 1.0 0
20-
0 0 0]
21-
roberf = ODEFunction(rober, mass_matrix = M)
22-
roberf_oop = ODEFunction{false}(rober, mass_matrix = M)
23-
prob_mm = ODEProblem(roberf, [1.0, 0.0, 0.2], (0.0, 1e5), (0.04, 3e7, 1e4))
24-
prob_mm_oop = ODEProblem(roberf_oop, [1.0, 0.0, 0.2], (0.0, 1e5), (0.04, 3e7, 1e4))
25-
sol = solve(prob_mm, Rodas5P(), reltol = 1e-8, abstol = 1e-8)
26-
sol = solve(prob_mm_oop, Rodas5P(), reltol = 1e-8, abstol = 1e-8)
27-
283
function f(out, du, u, p, t)
294
out[1] = -p[1] * u[1] + p[3] * u[2] * u[3] - du[1]
305
out[2] = +p[1] * u[1] - p[2] * u[2]^2 - p[3] * u[2] * u[3] - du[2]
@@ -47,10 +22,10 @@ sol1 = solve(prob, DFBDF(), dt = 1e-5, abstol = 1e-8, reltol = 1e-8)
4722
# These tests flex differentiation of the solver and through the initialization
4823
# To only test the solver part and isolate potential issues, set the initialization to consistent
4924
@testset "Inplace: $(isinplace(_prob)), DAEProblem: $(_prob isa DAEProblem), BrownBasic: $(initalg isa BrownFullBasicInit), Autodiff: $autodiff" for _prob in [
50-
prob, prob_mm, prob_oop, prob_mm_oop],
25+
prob, prob_oop],
5126
initalg in [BrownFullBasicInit(), ShampineCollocationInit()], autodiff in [true, false]
5227

53-
alg = _prob isa DAEProblem ? DFBDF(; autodiff) : Rodas5P(; autodiff)
28+
alg = DFBDF(; autodiff)
5429
function f(p)
5530
sol = solve(remake(_prob, p = p), alg, abstol = 1e-14,
5631
reltol = 1e-14, initializealg = initalg)

lib/OrdinaryDiffEqBDF/test/dae_initialization_tests.jl

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,5 @@
11
using OrdinaryDiffEq, StaticArrays, LinearAlgebra, Test
22

3-
## Mass Matrix
4-
5-
function rober_oop(u, p, t)
6-
y₁, y₂, y₃ = u
7-
k₁, k₂, k₃ = p
8-
du1 = -k₁ * y₁ + k₃ * y₂ * y₃
9-
du2 = k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^2
10-
du3 = y₁ + y₂ + y₃ - 1
11-
[du1, du2, du3]
12-
end
13-
M = [1.0 0 0
14-
0 1.0 0
15-
0 0 0]
16-
f_oop = ODEFunction(rober_oop, mass_matrix = M)
17-
prob_mm = ODEProblem(f_oop, [1.0, 0.0, 0.0], (0.0, 1e5), (0.04, 3e7, 1e4))
18-
sol = solve(prob_mm, Rosenbrock23(autodiff = false), reltol = 1e-8, abstol = 1e-8)
19-
@test sol[1] == [1.0, 0.0, 0.0] # Ensure initialization is unchanged if it works at the start!
20-
sol = solve(prob_mm, Rosenbrock23(), reltol = 1e-8, abstol = 1e-8,
21-
initializealg = ShampineCollocationInit())
22-
@test sol[1] == [1.0, 0.0, 0.0] # Ensure initialization is unchanged if it works at the start!
23-
24-
prob_mm = ODEProblem(f_oop, [1.0, 0.0, 0.2], (0.0, 1e5), (0.04, 3e7, 1e4))
25-
sol = solve(prob_mm, Rosenbrock23(), reltol = 1e-8, abstol = 1e-8)
26-
@test sum(sol[1]) 1
27-
@test sol[1] [1.0, 0.0, 0.0]
28-
for alg in [Rosenbrock23(autodiff = false), Trapezoid()]
29-
local sol
30-
sol = solve(prob_mm, alg, reltol = 1e-8, abstol = 1e-8,
31-
initializealg = ShampineCollocationInit())
32-
@test sum(sol[1]) 1
33-
end
34-
35-
function rober(du, u, p, t)
36-
y₁, y₂, y₃ = u
37-
k₁, k₂, k₃ = p
38-
du[1] = -k₁ * y₁ + k₃ * y₂ * y₃
39-
du[2] = k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^2
40-
du[3] = y₁ + y₂ + y₃ - 1
41-
nothing
42-
end
43-
M = [1.0 0 0
44-
0 1.0 0
45-
0 0 0]
46-
f = ODEFunction(rober, mass_matrix = M)
47-
prob_mm = ODEProblem(f, [1.0, 0.0, 0.0], (0.0, 1e5), (0.04, 3e7, 1e4))
48-
sol = solve(prob_mm, Rodas5(autodiff = false), reltol = 1e-8, abstol = 1e-8)
49-
@test sol[1] == [1.0, 0.0, 0.0] # Ensure initialization is unchanged if it works at the start!
50-
sol = solve(prob_mm, Rodas5(), reltol = 1e-8, abstol = 1e-8,
51-
initializealg = ShampineCollocationInit())
52-
@test sol[1] == [1.0, 0.0, 0.0] # Ensure initialization is unchanged if it works at the start!
53-
54-
prob_mm = ODEProblem(f, [1.0, 0.0, 1.0], (0.0, 1e5), (0.04, 3e7, 1e4))
55-
sol = solve(prob_mm, Rodas5(), reltol = 1e-8, abstol = 1e-8)
56-
@test sum(sol[1]) 1
57-
@test sol[1] [1.0, 0.0, 0.0]
58-
59-
for alg in [Rodas5(autodiff = false), Trapezoid()]
60-
local sol
61-
sol = solve(prob_mm, alg, reltol = 1e-8, abstol = 1e-8,
62-
initializealg = ShampineCollocationInit())
63-
@test sum(sol[1]) 1
64-
end
65-
66-
function rober_no_p(du, u, p, t)
67-
y₁, y₂, y₃ = u
68-
(k₁, k₂, k₃) = (0.04, 3e7, 1e4)
69-
du[1] = -k₁ * y₁ + k₃ * y₂ * y₃
70-
du[2] = k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^2
71-
du[3] = y₁ + y₂ + y₃ - 1
72-
nothing
73-
end
74-
75-
function rober_oop_no_p(du, u, p, t)
76-
y₁, y₂, y₃ = u
77-
(k₁, k₂, k₃) = (0.04, 3e7, 1e4)
78-
du1 = -k₁ * y₁ + k₃ * y₂ * y₃
79-
du2 = k₁ * y₁ - k₃ * y₂ * y₃ - k₂ * y₂^2
80-
du3 = y₁ + y₂ + y₃ - 1
81-
[du1, du2, du3]
82-
end
83-
84-
# test oop and iip ODE initialization with parameters without eltype/length
85-
struct UnusedParam
86-
end
87-
for f in (
88-
ODEFunction(rober_no_p, mass_matrix = M), ODEFunction(rober_oop_no_p, mass_matrix = M))
89-
local prob, probp
90-
prob = ODEProblem(f, [1.0, 0.0, 1.0], (0.0, 1e5))
91-
probp = ODEProblem(f, [1.0, 0.0, 1.0], (0.0, 1e5), UnusedParam)
92-
for initializealg in (ShampineCollocationInit(), BrownFullBasicInit())
93-
isapprox(init(prob, Rodas5(), abstol = 1e-10; initializealg).u,
94-
init(prob, Rodas5(), abstol = 1e-10; initializealg).u)
95-
end
96-
end
97-
98-
## DAEProblem
99-
1003
f = function (du, u, p, t)
1014
out1 = -0.04u[1] + 1e4 * u[2] * u[3] - du[1]
1025
out2 = +0.04u[1] - 3e7 * u[2]^2 - 1e4 * u[2] * u[3] - du[2]
@@ -246,23 +149,3 @@ for initializealg in (ShampineCollocationInit(), BrownFullBasicInit())
246149
@test isapprox(
247150
init(probp, DABDF2(); initializealg).u, init(prob, DABDF2(); initializealg).u)
248151
end
249-
250-
# to test that we get the right NL solve we need a broken solver.
251-
struct BrokenNLSolve <: SciMLBase.AbstractNonlinearAlgorithm
252-
BrokenNLSolve(; kwargs...) = new()
253-
end
254-
function SciMLBase.__solve(prob::NonlinearProblem,
255-
alg::BrokenNLSolve, args...;
256-
kwargs...)
257-
u = fill(reinterpret(Float64, 0xDEADBEEFDEADBEEF), 3)
258-
SciMLBase.build_solution(prob, alg, u, copy(u);
259-
retcode = ReturnCode.Success)
260-
end
261-
function f2(u, p, t)
262-
u
263-
end
264-
f = ODEFunction(f2, mass_matrix = Diagonal([1.0, 1.0, 0.0]))
265-
prob = ODEProblem(f, ones(3), (0.0, 1.0))
266-
integrator = init(prob, Rodas5P(),
267-
initializealg = ShampineCollocationInit(1.0, BrokenNLSolve()))
268-
@test all(isequal(reinterpret(Float64, 0xDEADBEEFDEADBEEF)), integrator.u)

lib/OrdinaryDiffEqBDF/test/runtest.jl

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
using SafeTestsets
2+
3+
@time @safetestset "DAE Convergence Tests" include("dae_convergence_tests.jl")
4+
@time @safetestset "DAE AD Tests" include("dae_ad_tests.jl")
5+
@time @safetestset "DAE Event Tests" include("dae_event.jl")
6+
@time @safetestset "DAE Initialization Tests" include("dae_initialization_tests.jl")

lib/OrdinaryDiffEqExplicitRK/test/runtests.jl

Whitespace-only changes.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
using SafeTestsets
22

3-
@time @safetestset "Linear-Nonlinear Krylov Methods Tests" include("linear_nonlinear_krylov_tests.jl")
3+
@time @safetestset "Linear-Nonlinear Krylov Methods Tests" include("linear_nonlinear_krylov_tests.jl")
4+
@time @safetestset "Linear-Nonlinear Convergence Tests" include("linear_nonlinear_convergence_tests.jl")

lib/OrdinaryDiffEqFunctionMap/test/runtests.jl

Whitespace-only changes.

lib/OrdinaryDiffEqHighOrderRK/test/runtests.jl

Whitespace-only changes.

lib/OrdinaryDiffEqIMEXMultistep/test/runtests.jl

Whitespace-only changes.

0 commit comments

Comments
 (0)