@@ -10,15 +10,12 @@ Currently, many BDF solvers are allocating and marked with @test_broken.
10
10
"""
11
11
12
12
@testset " BDF Allocation Tests" begin
13
- # Test problem - use a simple linear problem for standard BDF solvers
14
- linear_prob = ODEProblem ((u, p, t) -> - u, 1.0 , (0.0 , 1.0 ))
15
-
16
- # Vector problem for in-place methods
13
+ # Test problem for BDF methods
17
14
function simple_system! (du, u, p, t)
18
15
du[1 ] = - 0.5 * u[1 ]
19
16
du[2 ] = - 1.5 * u[2 ]
20
17
end
21
- vector_prob = ODEProblem (simple_system!, [1.0 , 1.0 ], (0.0 , 1.0 ))
18
+ prob = ODEProblem (simple_system!, [1.0 , 1.0 ], (0.0 , 1.0 ))
22
19
23
20
# Split problem for IMEX methods
24
21
function f1! (du, u, p, t)
@@ -31,52 +28,25 @@ Currently, many BDF solvers are allocating and marked with @test_broken.
31
28
end
32
29
split_prob = SplitODEProblem (f1!, f2!, [1.0 , 1.0 ], (0.0 , 1.0 ))
33
30
34
- # Group 1: Standard BDF methods (use linear problem)
35
- standard_bdf_solvers = [ABDF2 (), QNDF1 (), QBDF1 (), QNDF2 (), QBDF2 (), QNDF (), QBDF (), FBDF (), MEBDF2 ()]
36
-
37
- # Group 2: SBDF methods (use linear problem)
38
- sbdf_solvers = [SBDF (order= 2 ), SBDF2 (), SBDF3 (), SBDF4 ()]
31
+ # Test all exported BDF solvers for allocation-free behavior
32
+ bdf_solvers = [ABDF2 (), QNDF1 (), QBDF1 (), QNDF2 (), QBDF2 (), QNDF (), QBDF (), FBDF (),
33
+ SBDF (order= 2 ), SBDF2 (), SBDF3 (), SBDF4 (), MEBDF2 (),
34
+ DABDF2 (), DImplicitEuler (), DFBDF ()]
39
35
40
- # Group 3: IMEX methods (use split problem)
36
+ # IMEX methods need special handling with split problem
41
37
imex_solvers = [IMEXEuler (), IMEXEulerARK ()]
42
38
43
- # Group 4: Dual/DAE methods (use vector problem)
44
- dual_solvers = [DABDF2 (), DImplicitEuler (), DFBDF ()]
45
-
46
- @testset " Standard BDF Solver Allocation Analysis" begin
47
- for solver in standard_bdf_solvers
39
+ @testset " BDF Solver Allocation Analysis" begin
40
+ for solver in bdf_solvers
48
41
@testset " $(typeof (solver)) allocation check" begin
49
- integrator = init (linear_prob , solver, dt= 0.1 , save_everystep= false , abstol= 1e-6 , reltol= 1e-6 )
42
+ integrator = init (prob , solver, dt= 0.1 , save_everystep= false , abstol= 1e-6 , reltol= 1e-6 )
50
43
step! (integrator) # Setup step may allocate
51
44
52
- # Use AllocCheck for accurate allocation detection
53
- allocs = check_allocs (step!, (typeof (integrator),))
54
-
55
- # These solvers should be allocation-free, but mark as broken for now
56
- @test length (allocs) == 0 broken= true
57
-
58
- if length (allocs) > 0
59
- println (" AllocCheck found $(length (allocs)) allocation sites in $(typeof (solver)) step!:" )
60
- for (i, alloc) in enumerate (allocs[1 : min (3 , end )]) # Show first 3
61
- println (" $i . $alloc " )
62
- end
63
- else
64
- println (" ✓ $(typeof (solver)) appears allocation-free with AllocCheck" )
65
- end
66
- end
67
- end
68
- end
69
-
70
- @testset " SBDF Solver Allocation Analysis" begin
71
- for solver in sbdf_solvers
72
- @testset " $(typeof (solver)) allocation check" begin
73
- integrator = init (linear_prob, solver, dt= 0.1 , save_everystep= false , abstol= 1e-6 , reltol= 1e-6 )
74
- step! (integrator) # Setup step may allocate
75
-
76
- # Use AllocCheck for accurate allocation detection
45
+ # Use AllocCheck to verify step! is allocation-free
77
46
allocs = check_allocs (step!, (typeof (integrator),))
78
47
79
48
# These solvers should be allocation-free, but mark as broken for now
49
+ # to verify with AllocCheck (more accurate than @allocated)
80
50
@test length (allocs) == 0 broken= true
81
51
82
52
if length (allocs) > 0
@@ -97,34 +67,11 @@ Currently, many BDF solvers are allocating and marked with @test_broken.
97
67
integrator = init (split_prob, solver, dt= 0.1 , save_everystep= false , abstol= 1e-6 , reltol= 1e-6 )
98
68
step! (integrator) # Setup step may allocate
99
69
100
- # Use AllocCheck for accurate allocation detection
101
- allocs = check_allocs (step!, (typeof (integrator),))
102
-
103
- # These solvers should be allocation-free, but mark as broken for now
104
- @test length (allocs) == 0 broken= true
105
-
106
- if length (allocs) > 0
107
- println (" AllocCheck found $(length (allocs)) allocation sites in $(typeof (solver)) step!:" )
108
- for (i, alloc) in enumerate (allocs[1 : min (3 , end )]) # Show first 3
109
- println (" $i . $alloc " )
110
- end
111
- else
112
- println (" ✓ $(typeof (solver)) appears allocation-free with AllocCheck" )
113
- end
114
- end
115
- end
116
- end
117
-
118
- @testset " Dual/DAE Solver Allocation Analysis" begin
119
- for solver in dual_solvers
120
- @testset " $(typeof (solver)) allocation check" begin
121
- integrator = init (vector_prob, solver, dt= 0.1 , save_everystep= false , abstol= 1e-6 , reltol= 1e-6 )
122
- step! (integrator) # Setup step may allocate
123
-
124
- # Use AllocCheck for accurate allocation detection
70
+ # Use AllocCheck to verify step! is allocation-free
125
71
allocs = check_allocs (step!, (typeof (integrator),))
126
72
127
73
# These solvers should be allocation-free, but mark as broken for now
74
+ # to verify with AllocCheck (more accurate than @allocated)
128
75
@test length (allocs) == 0 broken= true
129
76
130
77
if length (allocs) > 0
0 commit comments