|
2 | 2 |
|
3 | 3 | A library providing tools for benchmarking ExecutorchBenchmark data. |
4 | 4 |
|
5 | | -## Read Benchmark Data |
6 | | -`get_benchmark_analysis_data.py` fetches benchmark data from HUD Open API and processes it, grouping metrics by private and public devices. |
7 | | - |
8 | | -### Quick Start |
| 5 | +## Installation |
9 | 6 |
|
10 | 7 | Install dependencies: |
11 | 8 | ```bash |
12 | 9 | pip install -r requirements.txt |
13 | 10 | ``` |
14 | 11 |
|
15 | | -Run with default output (CLI): |
| 12 | +## Tools |
| 13 | + |
| 14 | +### get_benchmark_analysis_data.py |
| 15 | + |
| 16 | +This script fetches benchmark data from HUD Open API and processes it, grouping metrics by private and public devices. |
| 17 | +## Quick start |
| 18 | + |
| 19 | +generates the matching_list json: |
| 20 | +``` |
| 21 | +python get_benchmark_analysis_data.py get_matching_list \ |
| 22 | + --startTime 2025-06-11T00:00:00 \ |
| 23 | + --endTime 2025-06-17T00:00:00 \ |
| 24 | + --category private_mv3_iphone15 \ |
| 25 | + --filter "include=private,mv3;"\ |
| 26 | + --outputType json |
| 27 | +``` |
| 28 | + |
| 29 | +if everything looks good, generate the private csv output: |
| 30 | +``` |
| 31 | +python3 get_benchmark_analysis_data.py generate_data \ |
| 32 | +--startTime "2025-06-11T00:00:00" \ |
| 33 | +--endTime "2025-06-17T18:00:00" \ |
| 34 | +--private-matching-json-path "./private_mv3_iphone15.json" --outputType csv \ |
| 35 | +--includePublic false |
| 36 | +``` |
| 37 | + |
| 38 | + |
| 39 | +#### Generate Benchmark Data |
| 40 | + |
16 | 41 | ```bash |
17 | | -python3 .ci/scripts/benchmark_tooling/get_benchmark_analysis_data.py --startTime "2025-06-11T00:00:00" --endTime "2025-06-17T18:00:00" |
| 42 | +python get_benchmark_analysis_data.py generate_data \ |
| 43 | + --startTime 2025-06-11T00:00:00 \ |
| 44 | + --endTime 2025-06-17T18:00:00 |
18 | 45 | ``` |
19 | 46 |
|
20 | | -Additional options: |
| 47 | +##### Options: |
21 | 48 | - `--silent`: Hide processing logs, show only results |
22 | 49 | - `--outputType df`: Display results in DataFrame format |
23 | | -- `--outputType excel --outputDir "{YOUR_LOCAL_DIRECTORY}"`: Generate Excel file with multiple sheets (`res_private.xlsx` and `res_public.xlsx`) |
24 | | -- `--outputType csv --outputDir "{YOUR_LOCAL_DIRECTORY}"`: Generate CSV files in folders (`private` and `public`) |
| 50 | +- `--outputType print`: Display results in dictionary format |
| 51 | +- `--outputType json --outputDir "/path/to/dir"`: Generate JSON file 'benchmark_results.json' |
| 52 | +- `--outputType csv --outputDir "/path/to/dir"`: Generate CSV files in folders (`private` and `public`) |
25 | 53 |
|
| 54 | +#### Get Matching Lists |
26 | 55 |
|
27 | | -### Python API Usage |
| 56 | +The `get_matching_list` command allows you to filter benchmark data based on specific criteria. |
28 | 57 |
|
29 | | -To use the benchmark fetcher in your own scripts: |
| 58 | +##### Get All Matching Lists |
| 59 | +```bash |
| 60 | +python get_benchmark_analysis_data.py get_matching_list \ |
| 61 | + --startTime 2025-06-11T00:00:00 \ |
| 62 | + --endTime 2025-06-17T00:00:00 \ |
| 63 | + --category all \ |
| 64 | + --outputType json |
| 65 | +``` |
30 | 66 |
|
31 | | -```python |
32 | | -import ExecutorchBenchmarkFetcher from benchmark_tooling.get_benchmark_analysis_data |
33 | | -fetcher = ExecutorchBenchmarkFetcher() |
34 | | -# Must call run first |
35 | | -fetcher.run() |
36 | | -private, public = fetcher.to_df() |
| 67 | +##### Get Private Device Matching Lists |
| 68 | +```bash |
| 69 | +python get_benchmark_analysis_data.py get_matching_list \ |
| 70 | + --startTime 2025-06-11T00:00:00 \ |
| 71 | + --endTime 2025-06-17T00:00:00 \ |
| 72 | + --category private \ |
| 73 | + --filter "include=private;" |
37 | 74 | ``` |
38 | 75 |
|
39 | | -## analyze_benchmark_stability.py |
40 | | -`analyze_benchmark_stability.py` analyzes the stability of benchmark data, comparing the results of private and public devices. |
| 76 | +##### Get Public Device Matching Lists |
| 77 | +```bash |
| 78 | +python get_benchmark_analysis_data.py get_matching_list \ |
| 79 | + --startTime 2025-06-11T00:00:00 \ |
| 80 | + --endTime 2025-06-17T00:00:00 \ |
| 81 | + --category public \ |
| 82 | + --filter "exclude=private;" |
| 83 | +``` |
41 | 84 |
|
42 | | -### Quick Start |
43 | | -Install dependencies: |
| 85 | +##### Advanced Filtering Examples |
| 86 | +Filter for specific models and devices: |
44 | 87 | ```bash |
45 | | -pip install -r requirements.txt |
| 88 | +# Get all mv3 models on iPhone 15 except apple_iphone_15_plus |
| 89 | +python get_benchmark_analysis_data.py get_matching_list \ |
| 90 | + --startTime 2025-06-11T00:00:00 \ |
| 91 | + --endTime 2025-06-17T00:00:00 \ |
| 92 | + --category private_mv3_iphone5 \ |
| 93 | + --filter "include=private,mv3,iphone_15;exclude=apple_iphone_15_plus" |
46 | 94 | ``` |
47 | 95 |
|
| 96 | +Multiple filters (using union logic): |
| 97 | +```bash |
| 98 | +# Get both mv3 and resnet50 models on iPhone 15 except apple_iphone_15_plus |
| 99 | +python get_benchmark_analysis_data.py get_matching_list \ |
| 100 | + --startTime 2025-06-11T00:00:00 \ |
| 101 | + --endTime 2025-06-17T00:00:00 \ |
| 102 | + --category private_models_iphone15 \ |
| 103 | + --filter "include=private,mv3,iphone_15;exclude=apple_iphone_15_plus" \ |
| 104 | + --filter "include=private,resnet50,iphone_15;exclude=apple_iphone_15_plus" |
48 | 105 | ``` |
49 | | -python .ci/scripts/benchmark_tooling/analyze_benchmark_stability.py \ |
50 | | - Benchmark\ Dataset\ with\ Private\ AWS\ Devices.xlsx \ |
51 | | - --reference_file Benchmark\ Dataset\ with\ Public\ AWS\ Devices.xlsx |
| 106 | + |
| 107 | +##### Output Options |
| 108 | +- `--outputType json --outputDir "/path/to/dir"`: Generate JSON file '{category}.json' |
| 109 | + |
| 110 | +#### Python API Usage |
| 111 | + |
| 112 | +To use the benchmark fetcher in your own scripts: |
| 113 | + |
| 114 | +```python |
| 115 | +from benchmark_tooling.get_benchmark_analysis_data import ExecutorchBenchmarkFetcher |
| 116 | + |
| 117 | +# Initialize the fetcher |
| 118 | +fetcher = ExecutorchBenchmarkFetcher() |
| 119 | + |
| 120 | +# Fetch data for a specific time range |
| 121 | +fetcher.run( |
| 122 | + "2025-06-11T00:00:00", |
| 123 | + "2025-06-17T00:00:00", |
| 124 | + private_device_matching_list, |
| 125 | + public_device_matching_list |
| 126 | +) |
| 127 | + |
| 128 | +# Get results as DataFrames |
| 129 | +private_dfs, public_dfs = fetcher.toDataFrame() |
| 130 | + |
| 131 | +# Export results to Excel |
| 132 | +fetcher.output_data(OutputType.CSV, (output_dir="./results") |
| 133 | +``` |
| 134 | + |
| 135 | +### analyze_benchmark_stability.py |
| 136 | + |
| 137 | +This script analyzes the stability of benchmark data, comparing the results of private and public devices. |
| 138 | + |
| 139 | +```bash |
| 140 | +python analyze_benchmark_stability.py \ |
| 141 | + "Benchmark Dataset with Private AWS Devices.xlsx" \ |
| 142 | + --reference_file "Benchmark Dataset with Public AWS Devices.xlsx" |
52 | 143 | ``` |
0 commit comments