Skip to content

Commit ff208ab

Browse files
reconfigure CI testing to actually test the submodules in isolation
1 parent cb95437 commit ff208ab

File tree

32 files changed

+457
-551
lines changed

32 files changed

+457
-551
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:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
using SafeTestsets
22

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

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")

0 commit comments

Comments
 (0)