Skip to content

Commit 8c354d0

Browse files
Fix preferences to be stored in LinearSolve.jl instead of LinearSolveAutotune
- Updated preferences.jl to use Preferences.set_preferences\!(LinearSolve, ...) - Preferences are now correctly stored in the main LinearSolve.jl package - This allows the future default.jl integration to read the autotune preferences - Updated all preference functions to target LinearSolve module - Added clearer messaging about where preferences are stored 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 76eac8a commit 8c354d0

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
# Preferences management for storing optimal algorithms
1+
# Preferences management for storing optimal algorithms in LinearSolve.jl
22

33
"""
44
set_algorithm_preferences(categories::Dict{String, String})
55
66
Set LinearSolve preferences based on the categorized benchmark results.
7+
These preferences are stored in the main LinearSolve.jl package.
78
"""
89
function set_algorithm_preferences(categories::Dict{String, String})
910
@info "Setting LinearSolve preferences based on benchmark results..."
1011

1112
for (range, algorithm) in categories
1213
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"
1517
end
1618

1719
# 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()))
1921

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."
2123
end
2224

2325
"""
2426
get_algorithm_preferences()
2527
26-
Get the current algorithm preferences.
28+
Get the current algorithm preferences from LinearSolve.jl.
2729
"""
2830
function get_algorithm_preferences()
2931
prefs = Dict{String, String}()
@@ -32,7 +34,8 @@ function get_algorithm_preferences()
3234

3335
for range in ranges
3436
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)
3639
if value !== nothing
3740
# Convert back to human-readable range name
3841
readable_range = replace(range, "_" => "-", "plus" => "+")
@@ -46,7 +49,7 @@ end
4649
"""
4750
clear_algorithm_preferences()
4851
49-
Clear all autotune-related preferences.
52+
Clear all autotune-related preferences from LinearSolve.jl.
5053
"""
5154
function clear_algorithm_preferences()
5255
@info "Clearing LinearSolve autotune preferences..."
@@ -55,34 +58,35 @@ function clear_algorithm_preferences()
5558

5659
for range in ranges
5760
pref_key = "best_algorithm_$range"
58-
@delete_preferences!(pref_key)
61+
# Delete preferences from LinearSolve.jl
62+
Preferences.delete_preferences!(LinearSolve, pref_key)
5963
end
6064

61-
@delete_preferences!("autotune_timestamp")
65+
Preferences.delete_preferences!(LinearSolve, "autotune_timestamp")
6266

63-
@info "Preferences cleared."
67+
@info "Preferences cleared from LinearSolve.jl."
6468
end
6569

6670
"""
6771
show_current_preferences()
6872
69-
Display the current algorithm preferences in a readable format.
73+
Display the current algorithm preferences from LinearSolve.jl in a readable format.
7074
"""
7175
function show_current_preferences()
7276
prefs = get_algorithm_preferences()
7377

7478
if isempty(prefs)
75-
println("No autotune preferences currently set.")
79+
println("No autotune preferences currently set in LinearSolve.jl.")
7680
return
7781
end
7882

79-
println("Current LinearSolve autotune preferences:")
83+
println("Current LinearSolve.jl autotune preferences:")
8084
println("="^50)
8185

8286
for (range, algorithm) in sort(prefs)
8387
println(" Size range $range: $algorithm")
8488
end
8589

86-
timestamp = @load_preference("autotune_timestamp", "unknown")
90+
timestamp = Preferences.load_preference(LinearSolve, "autotune_timestamp", "unknown")
8791
println(" Last updated: $timestamp")
8892
end

0 commit comments

Comments
 (0)