@@ -61,17 +61,32 @@ using Random
61
61
end
62
62
63
63
@testset " Benchmark Size Generation" begin
64
- # Test small benchmark sizes
65
- small_sizes = LinearSolveAutotune. get_benchmark_sizes (false )
64
+ # Test new size categories
65
+ tiny_sizes = LinearSolveAutotune. get_benchmark_sizes ([:tiny ])
66
+ @test ! isempty (tiny_sizes)
67
+ @test minimum (tiny_sizes) == 5
68
+ @test maximum (tiny_sizes) == 20
69
+
70
+ small_sizes = LinearSolveAutotune. get_benchmark_sizes ([:small ])
66
71
@test ! isempty (small_sizes)
67
- @test minimum (small_sizes) >= 4
68
- @test maximum (small_sizes) <= 500
72
+ @test minimum (small_sizes) == 20
73
+ @test maximum (small_sizes) == 100
74
+
75
+ medium_sizes = LinearSolveAutotune. get_benchmark_sizes ([:medium ])
76
+ @test ! isempty (medium_sizes)
77
+ @test minimum (medium_sizes) == 100
78
+ @test maximum (medium_sizes) == 300
69
79
70
- # Test large benchmark sizes
71
- large_sizes = LinearSolveAutotune. get_benchmark_sizes (true )
80
+ large_sizes = LinearSolveAutotune. get_benchmark_sizes ([:large ])
72
81
@test ! isempty (large_sizes)
73
- @test minimum (large_sizes) >= 4
74
- @test maximum (large_sizes) >= 2000
82
+ @test minimum (large_sizes) == 300
83
+ @test maximum (large_sizes) == 1000
84
+
85
+ # Test combination
86
+ combined_sizes = LinearSolveAutotune. get_benchmark_sizes ([:tiny , :small ])
87
+ @test length (combined_sizes) == length (unique (combined_sizes))
88
+ @test minimum (combined_sizes) == 5
89
+ @test maximum (combined_sizes) == 100
75
90
end
76
91
77
92
@testset " Small Scale Benchmarking" begin
@@ -81,12 +96,12 @@ using Random
81
96
# Use only first 2 algorithms and small sizes for fast testing
82
97
test_algs = cpu_algs[1 : min (2 , end )]
83
98
test_names = cpu_names[1 : min (2 , end )]
84
- test_sizes = [4 , 8 ] # Very small sizes for fast testing
99
+ test_sizes = [5 , 10 ] # Very small sizes for fast testing
85
100
test_eltypes = (Float64,) # Single element type for speed
86
101
87
102
results_df = LinearSolveAutotune. benchmark_algorithms (
88
103
test_sizes, test_algs, test_names, test_eltypes;
89
- samples = 1 , seconds = 0.1 )
104
+ samples = 1 , seconds = 0.1 , sizes = [ :tiny ] )
90
105
91
106
@test isa (results_df, DataFrame)
92
107
@test nrow (results_df) > 0
@@ -188,7 +203,7 @@ using Random
188
203
end
189
204
190
205
@testset " Preference Management" begin
191
- # Test setting and getting preferences
206
+ # Test setting and getting preferences with new format
192
207
test_categories = Dict {String, String} (
193
208
" Float64_0-128" => " TestAlg1" ,
194
209
" Float64_128-256" => " TestAlg2" ,
@@ -206,62 +221,76 @@ using Random
206
221
@test isa (retrieved_prefs, Dict{String, String})
207
222
@test ! isempty (retrieved_prefs)
208
223
209
- # Verify we can retrieve what we set
210
- for (key, value) in test_categories
211
- @test_broken haskey (retrieved_prefs, key)
212
- @test_broken retrieved_prefs[key] == value
213
- end
224
+ # The new preference system uses different keys (eltype_sizecategory)
225
+ # so we just check that preferences were set
226
+ @test length (retrieved_prefs) > 0
214
227
215
228
# Test clearing preferences
216
229
LinearSolveAutotune. clear_algorithm_preferences ()
217
230
cleared_prefs = LinearSolveAutotune. get_algorithm_preferences ()
218
231
@test isempty (cleared_prefs)
219
232
end
220
233
221
- @testset " Integration Test - Mini Autotune" begin
234
+ @testset " AutotuneResults Type" begin
235
+ # Create mock data for AutotuneResults
236
+ mock_data = [
237
+ (size = 50 , algorithm = " TestAlg1" , eltype = " Float64" , gflops = 10.0 , success = true , error = " " ),
238
+ (size = 100 , algorithm = " TestAlg2" , eltype = " Float64" , gflops = 15.0 , success = true , error = " " ),
239
+ ]
240
+
241
+ test_df = DataFrame (mock_data)
242
+ test_sysinfo = Dict (" cpu_name" => " Test CPU" , " os" => " TestOS" ,
243
+ " julia_version" => " 1.0.0" , " num_threads" => 4 )
244
+
245
+ results = AutotuneResults (test_df, test_sysinfo)
246
+
247
+ @test isa (results, AutotuneResults)
248
+ @test results. results_df == test_df
249
+ @test results. sysinfo == test_sysinfo
250
+
251
+ # Test that display works without error
252
+ io = IOBuffer ()
253
+ show (io, results)
254
+ display_output = String (take! (io))
255
+ @test contains (display_output, " LinearSolve.jl Autotune Results" )
256
+ @test contains (display_output, " Test CPU" )
257
+ end
258
+
259
+ @testset " Integration Test - Mini Autotune with New API" begin
222
260
# Test the full autotune_setup function with minimal parameters
223
261
# This is an integration test with very small scale to ensure everything works together
224
262
225
263
# Skip telemetry and use minimal settings for testing
226
- result, sysinfo, _ = LinearSolveAutotune. autotune_setup (
227
- large_matrices = false ,
228
- telemetry = false ,
229
- make_plot = false ,
264
+ result = LinearSolveAutotune. autotune_setup (
265
+ sizes = [:tiny ],
230
266
set_preferences = false ,
231
267
samples = 1 ,
232
268
seconds = 0.1 ,
233
269
eltypes = (Float64,) # Single element type for speed
234
270
)
235
271
236
- @test isa (result, DataFrame)
237
- @test nrow (result) > 0
238
- @test hasproperty (result, :size )
239
- @test hasproperty (result, :algorithm )
240
- @test hasproperty (result, :eltype )
241
- @test hasproperty (result, :gflops )
242
- @test hasproperty (result, :success )
272
+ @test isa (result, AutotuneResults)
273
+ @test isa (result. results_df, DataFrame)
274
+ @test isa (result. sysinfo, Dict)
275
+ @test nrow (result. results_df) > 0
276
+ @test hasproperty (result. results_df, :size )
277
+ @test hasproperty (result. results_df, :algorithm )
278
+ @test hasproperty (result. results_df, :eltype )
279
+ @test hasproperty (result. results_df, :gflops )
280
+ @test hasproperty (result. results_df, :success )
243
281
244
282
# Test with multiple element types
245
283
result_multi = LinearSolveAutotune. autotune_setup (
246
- large_matrices = false ,
247
- telemetry = false ,
248
- make_plot = true , # Test plotting integration
284
+ sizes = [:tiny ],
249
285
set_preferences = false ,
250
286
samples = 1 ,
251
287
seconds = 0.1 ,
252
288
eltypes = (Float64, Float32)
253
289
)
254
290
255
- # Should return tuple of (DataFrame, Dataframe, Dict) when make_plot=true
256
- @test isa (result_multi, Tuple)
257
- @test length (result_multi) == 3
258
- @test isa (result_multi[1 ], DataFrame)
259
- @test isa (result_multi[2 ], DataFrame)
260
- @test isa (result_multi[3 ], Dict) # Plots dictionary
261
-
262
- df, plots = result_multi
291
+ @test isa (result_multi, AutotuneResults)
292
+ df = result_multi. results_df
263
293
@test nrow (df) > 0
264
- @test ! isempty (plots)
265
294
266
295
# Check that we have results for multiple element types
267
296
eltypes_in_results = unique (df. eltype)
0 commit comments