Skip to content

Commit fb35143

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
Improve LinearSolveAutotune UI/UX (#686)
* Improve LinearSolveAutotune UI/UX - Remove all token authentication code from main autotune flow - Split autotuning and result sharing into separate functions - Add flexible size categories (small/medium/large/big) replacing binary large_matrices flag - Add clear gh CLI setup instructions in README - Make telemetry opt-in via explicit share_results() call 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Enhance UI/UX with progress bars and AutotuneResults object - Add progress bar showing algorithm being benchmarked with percentage - Adjust size ranges: medium now goes to 300, large is 300-1000 - Create AutotuneResults struct with nice display output - Add plot() method for AutotuneResults to create composite plots - Update default to include large matrices (small, medium, large) - Add clear call-to-action in results display for sharing - Add ProgressMeter dependency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Fix ProgressMeter usage and delay plot generation - Fix ProgressMeter.update\! to use 'desc' parameter instead of 'description' - Remove make_plot parameter from autotune_setup - Move plot generation from autotune_setup to plot(results) method - Remove plot uploading from GitHub sharing (plots not shared anymore) - Simplify AutotuneResults struct to only contain results_df and sysinfo - Update documentation to reflect on-demand plot generation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Reorganize size categories and improve preference handling - Add 'tiny' category (5-20), reorganize ranges: small (20-100), medium (100-300), large (300-1000) - Change default to benchmark tiny/small/medium/large (no big) with Float64 only - Implement intelligent type fallback for preferences: - Float32 uses Float64 if not benchmarked - ComplexF32 uses Float64 if not benchmarked - ComplexF64 uses ComplexF32 then Float64 if not benchmarked - Handle RFLU special case for complex numbers (avoids if alternative within 20% performance) - Update preference keys to use eltype_sizecategory format (e.g., Float64_tiny) - Set preferences for all 4 types across all 5 size categories 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Fix sysinfo type handling and add comprehensive benchmark suggestion - Fix AutotuneResults to properly handle sysinfo as Dict (convert from DataFrame) - Add suggestion in display output for running comprehensive benchmarks - Show script for testing all sizes and element types in results display 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Update tests for new API - Update tests to use new size categories (tiny, small, medium, large) - Update tests for AutotuneResults type instead of tuple return - Update preference management tests for new key format - Remove deprecated large_matrices parameter from tests - Add tests for AutotuneResults display method 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Add CPUSummary.jl integration and final UI improvements - Added CPUSummary.jl dependency for better system info - Exported plot function for AutotuneResults - Reordered display output: comprehensive first, community second, share last - Updated system info gathering to use CPUSummary functions - Enhanced OS and thread information display * Fix CPUSummary integration - use correct function names - Fixed CPUSummary.num_cores() instead of num_physical_cores() - Use Sys.CPU_THREADS for logical cores - Use Threads.nthreads() for Julia threads - Fixed BLAS thread count with LinearAlgebra.BLAS.get_num_threads() - Use standard Julia functions where CPUSummary doesn't provide equivalents * Fix CPUSummary type conversion for num_cores - Convert Static.StaticInt to regular Int for compatibility - Ensures tests pass with CPUSummary.num_cores() output * Fix telemetry system info key compatibility - Use get() with fallbacks for all system info fields - Handle both get_system_info() and get_detailed_system_info() key names - Support both old and new key formats for compatibility --------- Co-authored-by: ChrisRackauckas <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent fd44500 commit fb35143

File tree

8 files changed

+757
-324
lines changed

8 files changed

+757
-324
lines changed

lib/LinearSolveAutotune/Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ version = "1.0.0"
77
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
88
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
99
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
10+
CPUSummary = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
1011
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
1112
GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
1213
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
@@ -18,6 +19,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1819
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1920
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
2021
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
22+
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
2123
RecursiveFactorization = "f2c3362d-daeb-58d1-803e-2bc74f2840b4"
2224
blis_jll = "6136c539-28a5-5bf0-87cc-b183200dce32"
2325
LAPACK_jll = "51474c39-65e3-53ba-86ba-03b1b862ec14"
@@ -28,6 +30,7 @@ Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
2830
LinearSolve = "3"
2931
BenchmarkTools = "1"
3032
Base64 = "1"
33+
CPUSummary = "0.2"
3134
DataFrames = "1"
3235
GitHub = "5"
3336
Plots = "1"
@@ -39,6 +42,7 @@ LinearAlgebra = "1"
3942
Printf = "1"
4043
Dates = "1"
4144
Test = "1"
45+
ProgressMeter = "1"
4246
RecursiveFactorization = "0.2"
4347
blis_jll = "0.9.0"
4448
LAPACK_jll = "3"

lib/LinearSolveAutotune/README.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# LinearSolveAutotune.jl
2+
3+
Automatic benchmarking and tuning for LinearSolve.jl algorithms.
4+
5+
## Quick Start
6+
7+
```julia
8+
using LinearSolve, LinearSolveAutotune
9+
10+
# Run benchmarks with default settings (small, medium, and large sizes)
11+
results = autotune_setup()
12+
13+
# View a summary of results
14+
display(results)
15+
16+
# Plot all benchmark results
17+
plot(results)
18+
19+
# Share your results with the community (optional)
20+
share_results(results)
21+
```
22+
23+
## Features
24+
25+
- **Automatic Algorithm Benchmarking**: Tests all available LU factorization methods
26+
- **Multi-size Testing**: Flexible size categories from small to very large matrices
27+
- **Element Type Support**: Tests with Float32, Float64, ComplexF32, ComplexF64
28+
- **GPU Support**: Automatically detects and benchmarks GPU algorithms if available
29+
- **Performance Visualization**: Generate plots on demand with `plot(results)`
30+
- **Community Sharing**: Optional telemetry to help improve algorithm selection
31+
32+
## Size Categories
33+
34+
The package now uses flexible size categories:
35+
36+
- `:tiny` - Matrices from 5×5 to 20×20 (very small problems)
37+
- `:small` - Matrices from 20×20 to 100×100 (small problems)
38+
- `:medium` - Matrices from 100×100 to 300×300 (typical problems)
39+
- `:large` - Matrices from 300×300 to 1000×1000 (larger problems)
40+
- `:big` - Matrices from 10000×10000 to 100000×100000 (GPU/HPC)
41+
42+
## Usage Examples
43+
44+
### Basic Benchmarking
45+
46+
```julia
47+
# Default: small, medium, and large sizes
48+
results = autotune_setup()
49+
50+
# Test all size ranges
51+
results = autotune_setup(sizes = [:small, :medium, :large, :big])
52+
53+
# Large matrices only (for GPU systems)
54+
results = autotune_setup(sizes = [:large, :big])
55+
56+
# Custom configuration
57+
results = autotune_setup(
58+
sizes = [:medium, :large],
59+
samples = 10,
60+
seconds = 1.0,
61+
eltypes = (Float64, ComplexF64)
62+
)
63+
64+
# View results and plot
65+
display(results)
66+
plot(results)
67+
```
68+
69+
### Sharing Results
70+
71+
After running benchmarks, you can optionally share your results with the LinearSolve.jl community to help improve automatic algorithm selection:
72+
73+
```julia
74+
# Share your benchmark results
75+
share_results(results)
76+
```
77+
78+
## Setting Up GitHub Authentication
79+
80+
To share results, you need GitHub authentication. We recommend using the GitHub CLI:
81+
82+
### Method 1: GitHub CLI (Recommended)
83+
84+
1. **Install GitHub CLI**
85+
- macOS: `brew install gh`
86+
- Windows: `winget install --id GitHub.cli`
87+
- Linux: See [cli.github.com](https://cli.github.com/manual/installation)
88+
89+
2. **Authenticate**
90+
```bash
91+
gh auth login
92+
```
93+
Follow the prompts to authenticate with your GitHub account.
94+
95+
3. **Verify authentication**
96+
```bash
97+
gh auth status
98+
```
99+
100+
### Method 2: GitHub Personal Access Token
101+
102+
If you prefer using a token:
103+
104+
1. Go to [GitHub Settings > Tokens](https://github.com/settings/tokens/new)
105+
2. Add description: "LinearSolve.jl Telemetry"
106+
3. Select scope: `public_repo`
107+
4. Click "Generate token" and copy it
108+
5. In Julia:
109+
```julia
110+
ENV["GITHUB_TOKEN"] = "your_token_here"
111+
share_results(results, sysinfo, plots)
112+
```
113+
114+
## How It Works
115+
116+
1. **Benchmarking**: The `autotune_setup()` function runs comprehensive benchmarks of all available LinearSolve.jl algorithms across different matrix sizes and element types.
117+
118+
2. **Analysis**: Results are analyzed to find the best-performing algorithm for each size range and element type combination.
119+
120+
3. **Preferences**: Optionally sets Julia preferences to automatically use the best algorithms for your system.
121+
122+
4. **Sharing**: The `share_results()` function allows you to contribute your benchmark data to the community collection at [LinearSolve.jl Issue #669](https://github.com/SciML/LinearSolve.jl/issues/669).
123+
124+
## Privacy and Telemetry
125+
126+
- Sharing results is **completely optional**
127+
- Only benchmark performance data and system specifications are shared
128+
- No personal information is collected
129+
- All shared data is publicly visible on GitHub
130+
- You can review the exact data before sharing
131+
132+
## API Reference
133+
134+
### `autotune_setup`
135+
136+
```julia
137+
autotune_setup(;
138+
sizes = [:small, :medium, :large],
139+
set_preferences = true,
140+
samples = 5,
141+
seconds = 0.5,
142+
eltypes = (Float32, Float64, ComplexF32, ComplexF64),
143+
skip_missing_algs = false
144+
)
145+
```
146+
147+
**Parameters:**
148+
- `sizes`: Vector of size categories to test
149+
- `set_preferences`: Update LinearSolve preferences
150+
- `samples`: Number of benchmark samples per test
151+
- `seconds`: Maximum time per benchmark
152+
- `eltypes`: Element types to benchmark
153+
- `skip_missing_algs`: Continue if algorithms are missing
154+
155+
**Returns:**
156+
- `results`: AutotuneResults object containing benchmark data and system info
157+
158+
### `share_results`
159+
160+
```julia
161+
share_results(results)
162+
```
163+
164+
**Parameters:**
165+
- `results`: AutotuneResults object from `autotune_setup`
166+
167+
## Contributing
168+
169+
Your benchmark contributions help improve LinearSolve.jl for everyone! By sharing results from diverse hardware configurations, we can build better automatic algorithm selection heuristics.
170+
171+
## License
172+
173+
Part of the SciML ecosystem. See LinearSolve.jl for license information.

0 commit comments

Comments
 (0)