1
- # Preferences management for storing optimal algorithms
1
+ # Preferences management for storing optimal algorithms in LinearSolve.jl
2
2
3
3
"""
4
4
set_algorithm_preferences(categories::Dict{String, String})
5
5
6
6
Set LinearSolve preferences based on the categorized benchmark results.
7
+ These preferences are stored in the main LinearSolve.jl package.
7
8
"""
8
9
function set_algorithm_preferences (categories:: Dict{String, String} )
9
10
@info " Setting LinearSolve preferences based on benchmark results..."
10
11
11
12
for (range, algorithm) in categories
12
13
pref_key = " best_algorithm_$(replace (range, " +" => " plus" , " -" => " _" )) "
13
- @set_preferences! (pref_key => algorithm)
14
- @info " Set preference $pref_key = $algorithm "
14
+ # Set preferences in LinearSolve.jl, not LinearSolveAutotune
15
+ Preferences. set_preferences! (LinearSolve, pref_key => algorithm)
16
+ @info " Set preference $pref_key = $algorithm in LinearSolve.jl"
15
17
end
16
18
17
19
# Set a timestamp for when these preferences were created
18
- @ set_preferences! (" autotune_timestamp" => string (Dates. now ()))
20
+ Preferences . set_preferences! (LinearSolve, " autotune_timestamp" => string (Dates. now ()))
19
21
20
- @info " Preferences updated. You may need to restart Julia for changes to take effect."
22
+ @info " Preferences updated in LinearSolve.jl . You may need to restart Julia for changes to take effect."
21
23
end
22
24
23
25
"""
24
26
get_algorithm_preferences()
25
27
26
- Get the current algorithm preferences.
28
+ Get the current algorithm preferences from LinearSolve.jl .
27
29
"""
28
30
function get_algorithm_preferences ()
29
31
prefs = Dict {String, String} ()
@@ -32,7 +34,8 @@ function get_algorithm_preferences()
32
34
33
35
for range in ranges
34
36
pref_key = " best_algorithm_$range "
35
- value = @load_preference (pref_key, nothing )
37
+ # Load preferences from LinearSolve.jl
38
+ value = Preferences. load_preference (LinearSolve, pref_key, nothing )
36
39
if value != = nothing
37
40
# Convert back to human-readable range name
38
41
readable_range = replace (range, " _" => " -" , " plus" => " +" )
46
49
"""
47
50
clear_algorithm_preferences()
48
51
49
- Clear all autotune-related preferences.
52
+ Clear all autotune-related preferences from LinearSolve.jl .
50
53
"""
51
54
function clear_algorithm_preferences ()
52
55
@info " Clearing LinearSolve autotune preferences..."
@@ -55,34 +58,35 @@ function clear_algorithm_preferences()
55
58
56
59
for range in ranges
57
60
pref_key = " best_algorithm_$range "
58
- @delete_preferences! (pref_key)
61
+ # Delete preferences from LinearSolve.jl
62
+ Preferences. delete_preferences! (LinearSolve, pref_key)
59
63
end
60
64
61
- @ delete_preferences! (" autotune_timestamp" )
65
+ Preferences . delete_preferences! (LinearSolve, " autotune_timestamp" )
62
66
63
- @info " Preferences cleared."
67
+ @info " Preferences cleared from LinearSolve.jl ."
64
68
end
65
69
66
70
"""
67
71
show_current_preferences()
68
72
69
- Display the current algorithm preferences in a readable format.
73
+ Display the current algorithm preferences from LinearSolve.jl in a readable format.
70
74
"""
71
75
function show_current_preferences ()
72
76
prefs = get_algorithm_preferences ()
73
77
74
78
if isempty (prefs)
75
- println (" No autotune preferences currently set." )
79
+ println (" No autotune preferences currently set in LinearSolve.jl ." )
76
80
return
77
81
end
78
82
79
- println (" Current LinearSolve autotune preferences:" )
83
+ println (" Current LinearSolve.jl autotune preferences:" )
80
84
println (" =" ^ 50 )
81
85
82
86
for (range, algorithm) in sort (prefs)
83
87
println (" Size range $range : $algorithm " )
84
88
end
85
89
86
- timestamp = @ load_preference (" autotune_timestamp" , " unknown" )
90
+ timestamp = Preferences . load_preference (LinearSolve, " autotune_timestamp" , " unknown" )
87
91
println (" Last updated: $timestamp " )
88
92
end
0 commit comments