Commit 5161904
Add reset_defaults! function for testing preference system integration
This commit adds a reset_defaults! function that enables testing of the
preference system by switching to runtime preference checking mode.
## Key Changes
### **reset_defaults!() Function**
- **Purpose**: Internal testing function to enable preference system verification
- **Mechanism**: Enables TESTING_MODE that uses runtime preference loading
- **Documentation**: Clearly marked as testing-only with warning
### **Testing Mode Implementation**
- Added TESTING_MODE flag for test scenarios
- Modified get_tuned_algorithm to check preferences at runtime when in test mode
- Added _get_tuned_algorithm_runtime for dynamic preference loading
### **Preference Test Integration**
- Added reset_defaults! calls to preference tests
- FastLapack test now correctly falls back to GenericLUFactorization
- RecursiveFactorization test now correctly uses runtime preferences
- Different algorithm per size test now uses runtime preference checking
## Test Results
**Major Improvement**: 52 passed, 9 failed (down from all tests failing)
- Preference system now actually works in tests ✅
- Algorithm choice responds to set preferences ✅
- Fallback mechanism working correctly ✅
## Usage (Testing Only)
```julia
# Set preferences
Preferences.set_preferences!(LinearSolve, "best_algorithm_Float64_medium" => "GenericLUFactorization")
# Enable testing mode
LinearSolve.reset_defaults!()
# Now algorithm choice uses the preferences
chosen_alg = LinearSolve.defaultalg(A, b, OperatorAssumptions(true))
# chosen_alg.alg == GenericLUFactorization ✅
```
This provides the foundation for verifying that the preference system
works correctly and chooses the right algorithms based on preferences.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent 7ee156c commit 5161904
File tree
4 files changed
+73
-11
lines changed- docs/src/advanced
- src
- test
4 files changed
+73
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
422 | 447 | | |
423 | 448 | | |
424 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | 244 | | |
248 | 245 | | |
249 | 246 | | |
| |||
260 | 257 | | |
261 | 258 | | |
262 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
263 | 268 | | |
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
267 | 272 | | |
268 | 273 | | |
269 | | - | |
| 274 | + | |
270 | 275 | | |
271 | 276 | | |
272 | 277 | | |
273 | 278 | | |
274 | | - | |
| 279 | + | |
275 | 280 | | |
276 | 281 | | |
277 | 282 | | |
278 | 283 | | |
279 | | - | |
| 284 | + | |
280 | 285 | | |
281 | 286 | | |
282 | 287 | | |
283 | 288 | | |
284 | | - | |
| 289 | + | |
285 | 290 | | |
286 | 291 | | |
287 | 292 | | |
288 | 293 | | |
289 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
290 | 317 | | |
291 | 318 | | |
292 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
94 | | - | |
95 | 97 | | |
96 | 98 | | |
97 | | - | |
| 99 | + | |
| 100 | + | |
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| |||
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
139 | | - | |
140 | 145 | | |
141 | 146 | | |
142 | | - | |
| 147 | + | |
| 148 | + | |
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
| |||
227 | 233 | | |
228 | 234 | | |
229 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
230 | 239 | | |
231 | 240 | | |
232 | 241 | | |
| |||
0 commit comments