|
2 | 2 |
|
3 | 3 | A library providing tools for benchmarking ExecutorchBenchmark data. |
4 | 4 |
|
5 | | -## Installation |
| 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 |
6 | 9 |
|
7 | 10 | Install dependencies: |
8 | 11 | ```bash |
9 | 12 | pip install -r requirements.txt |
10 | 13 | ``` |
11 | 14 |
|
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 | | - |
| 15 | +Run with default output (CLI): |
41 | 16 | ```bash |
42 | | -python get_benchmark_analysis_data.py generate_data \ |
43 | | - --startTime 2025-06-11T00:00:00 \ |
44 | | - --endTime 2025-06-17T18:00:00 |
| 17 | +python3 .ci/scripts/benchmark_tooling/get_benchmark_analysis_data.py --startTime "2025-06-11T00:00:00" --endTime "2025-06-17T18:00:00" |
45 | 18 | ``` |
46 | 19 |
|
47 | | -##### Options: |
| 20 | +Additional options: |
48 | 21 | - `--silent`: Hide processing logs, show only results |
49 | 22 | - `--outputType df`: Display results in DataFrame format |
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`) |
53 | | - |
54 | | -#### Get Matching Lists |
| 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`) |
55 | 25 |
|
56 | | -The `get_matching_list` command allows you to filter benchmark data based on specific criteria. |
57 | | - |
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 | | -``` |
66 | 26 |
|
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;" |
74 | | -``` |
75 | | - |
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 | | -``` |
84 | | - |
85 | | -##### Advanced Filtering Examples |
86 | | -Filter for specific models and devices: |
87 | | -```bash |
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" |
94 | | -``` |
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" |
105 | | -``` |
106 | | - |
107 | | -##### Output Options |
108 | | -- `--outputType json --outputDir "/path/to/dir"`: Generate JSON file '{category}.json' |
109 | | - |
110 | | -#### Python API Usage |
| 27 | +### Python API Usage |
111 | 28 |
|
112 | 29 | To use the benchmark fetcher in your own scripts: |
113 | 30 |
|
114 | 31 | ```python |
115 | | -from benchmark_tooling.get_benchmark_analysis_data import ExecutorchBenchmarkFetcher |
116 | | - |
117 | | -# Initialize the fetcher |
| 32 | +import ExecutorchBenchmarkFetcher from benchmark_tooling.get_benchmark_analysis_data |
118 | 33 | 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") |
| 34 | +# Must call run first |
| 35 | +fetcher.run() |
| 36 | +private, public = fetcher.to_df() |
133 | 37 | ``` |
134 | 38 |
|
135 | | -### analyze_benchmark_stability.py |
136 | | - |
137 | | -This script analyzes the stability of benchmark data, comparing the results of private and public devices. |
| 39 | +## analyze_benchmark_stability.py |
| 40 | +`analyze_benchmark_stability.py` analyzes the stability of benchmark data, comparing the results of private and public devices. |
138 | 41 |
|
| 42 | +### Quick Start |
| 43 | +Install dependencies: |
139 | 44 | ```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" |
| 45 | +pip install -r requirements.txt |
| 46 | +``` |
| 47 | + |
| 48 | +``` |
| 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 |
143 | 52 | ``` |
0 commit comments