@@ -10,15 +10,12 @@ Currently, many BDF solvers are allocating and marked with @test_broken.
1010"""
1111
1212@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
1714 function simple_system! (du, u, p, t)
1815 du[1 ] = - 0.5 * u[1 ]
1916 du[2 ] = - 1.5 * u[2 ]
2017 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 ))
2219
2320 # Split problem for IMEX methods
2421 function f1! (du, u, p, t)
@@ -31,52 +28,25 @@ Currently, many BDF solvers are allocating and marked with @test_broken.
3128 end
3229 split_prob = SplitODEProblem (f1!, f2!, [1.0 , 1.0 ], (0.0 , 1.0 ))
3330
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 ()]
3935
40- # Group 3: IMEX methods (use split problem)
36+ # IMEX methods need special handling with split problem
4137 imex_solvers = [IMEXEuler (), IMEXEulerARK ()]
4238
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
4841 @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 )
5043 step! (integrator) # Setup step may allocate
5144
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
7746 allocs = check_allocs (step!, (typeof (integrator),))
7847
7948 # These solvers should be allocation-free, but mark as broken for now
49+ # to verify with AllocCheck (more accurate than @allocated)
8050 @test length (allocs) == 0 broken= true
8151
8252 if length (allocs) > 0
@@ -97,34 +67,11 @@ Currently, many BDF solvers are allocating and marked with @test_broken.
9767 integrator = init (split_prob, solver, dt= 0.1 , save_everystep= false , abstol= 1e-6 , reltol= 1e-6 )
9868 step! (integrator) # Setup step may allocate
9969
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
12571 allocs = check_allocs (step!, (typeof (integrator),))
12672
12773 # These solvers should be allocation-free, but mark as broken for now
74+ # to verify with AllocCheck (more accurate than @allocated)
12875 @test length (allocs) == 0 broken= true
12976
13077 if length (allocs) > 0
0 commit comments