Skip to content

Commit be91159

Browse files
committed
separate viz job
1 parent b818c35 commit be91159

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

.github/workflows/run-bench.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,8 @@ jobs:
145145
# Run the benchmark
146146
echo "Running benchmark for branch ${{ matrix.branch }}"
147147
java ${{ matrix.jdk >= 20 && '--enable-native-access=ALL-UNNAMED --add-modules=jdk.incubator.vector' || '' }} \
148-
-jar jvector-examples/target/jvector-examples-*-jar-with-dependencies.jar \
149-
--config jvector-examples/yaml-configs/autoDefault.yml \
150-
--output ${{ matrix.branch }}-bench-results || {
151-
echo "Warning: Benchmark failed for branch ${{ matrix.branch }}. This may be expected if the branch doesn't have the required code."
152-
exit 0
153-
}
148+
${{ matrix.jdk >= 22 && '-Djvector.experimental.enable_native_vectorization=true' || '' }} \
149+
-cp jvector-examples/target/jvector-examples-*-jar-with-dependencies.jar io.github.jbellis.jvector.example.AutoBenchYAML --output ${{ matrix.branch }}-bench-results
154150
155151
# Move the results to the benchmark_results directory
156152
mv ${{ matrix.branch }}-bench-results.csv benchmark_results/ || true
@@ -161,12 +157,24 @@ jobs:
161157
- name: Upload Individual Benchmark Results
162158
uses: actions/upload-artifact@v4
163159
with:
164-
name: benchmark-results-${{ matrix.isa }}-jdk${{ matrix.jdk }}
160+
name: benchmark-results-${{ matrix.isa }}-jdk${{ matrix.jdk }}-${{ matrix.branch }}
165161
path: |
166162
benchmark_results/*.csv
167163
benchmark_results/*.json
168164
if-no-files-found: warn
169165

166+
# Job to combine results and create visualizations
167+
combine-results:
168+
needs: test-avx512
169+
runs-on: ubuntu-latest
170+
steps:
171+
- name: Download all benchmark results
172+
uses: actions/download-artifact@v4
173+
with:
174+
pattern: benchmark-results-*
175+
path: all-benchmark-results
176+
merge-multiple: true
177+
170178
- name: Set up Python
171179
uses: actions/setup-python@v4
172180
with:
@@ -186,8 +194,8 @@ jobs:
186194
import pandas as pd
187195
import matplotlib.pyplot as plt
188196
189-
# Find all CSV files in the benchmark_results directory
190-
csv_files = glob.glob('benchmark_results/*-bench-results.csv')
197+
# Find all CSV files in the all-benchmark-results directory
198+
csv_files = glob.glob('all-benchmark-results/**/*-bench-results.csv', recursive=True)
191199
192200
if not csv_files:
193201
print("No benchmark results found! Checking other possible locations...")
@@ -279,8 +287,6 @@ jobs:
279287
with:
280288
name: benchmark-comparison-results
281289
path: |
282-
benchmark_results/*.csv
283-
benchmark_results/*.json
284290
all_benchmark_results.csv
285291
*.png
286292
benchmark_report.md

jvector-examples/src/main/java/io/github/jbellis/jvector/example/AutoBenchYAML.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,25 @@ public static void main(String[] args) throws IOException {
9898

9999
logger.info("Heap space available is {}", Runtime.getRuntime().maxMemory());
100100

101-
// Filter out --output and its argument from the args
101+
// Filter out --output, --config and their arguments from the args
102102
String finalOutputPath = outputPath;
103+
String configPath = null;
104+
for (int i = 0; i < args.length - 1; i++) {
105+
if (args[i].equals("--config")) configPath = args[i+1];
106+
}
107+
String finalConfigPath = configPath;
103108
String[] filteredArgs = Arrays.stream(args)
104-
.filter(arg -> !arg.equals("--output") && !arg.equals(finalOutputPath))
109+
.filter(arg -> !arg.equals("--output") && !arg.equals(finalOutputPath) &&
110+
!arg.equals("--config") && !arg.equals(finalConfigPath))
105111
.toArray(String[]::new);
106112

113+
// Log the filtered arguments for debugging
114+
logger.info("Filtered arguments: {}", Arrays.toString(filteredArgs));
115+
107116
// generate a regex that matches any regex in filteredArgs, or if filteredArgs is empty/null, match everything
108117
var regex = filteredArgs.length == 0 ? ".*" : Arrays.stream(filteredArgs).flatMap(s -> Arrays.stream(s.split("\\s"))).map(s -> "(?:" + s + ")").collect(Collectors.joining("|"));
118+
logger.info("Generated regex pattern: {}", regex);
119+
109120
// compile regex and do substring matching using find
110121
var pattern = Pattern.compile(regex);
111122

@@ -125,7 +136,7 @@ public static void main(String[] args) throws IOException {
125136
if (datasetName.endsWith(".hdf5")) {
126137
datasetName = datasetName.substring(0, datasetName.length() - ".hdf5".length());
127138
}
128-
139+
129140
MultiConfig config = MultiConfig.getDefaultConfig("autoDefault");
130141
config.dataset = datasetName;
131142
logger.info("Using configuration: {}", config);
@@ -140,7 +151,7 @@ public static void main(String[] args) throws IOException {
140151
config.search.getCompressorParameters(),
141152
config.search.topKOverquery,
142153
config.search.useSearchPruning));
143-
154+
144155
logger.info("Benchmark completed for dataset: {}", datasetName);
145156
} catch (Exception e) {
146157
logger.error("Exception while processing dataset {}", datasetName, e);
@@ -159,20 +170,20 @@ public static void main(String[] args) throws IOException {
159170
mapper.writerWithDefaultPrettyPrinter().writeValue(detailsFile, results);
160171

161172
File outputFile = new File(outputPath + ".csv");
162-
173+
163174
// Get summary statistics by dataset
164175
Map<String, SummaryStats> statsByDataset = BenchmarkSummarizer.summarizeByDataset(results);
165-
176+
166177
// Write CSV data
167178
try (FileWriter writer = new FileWriter(outputFile)) {
168179
// Write CSV header
169180
writer.write("dataset,QPS,Mean Latency,Recall@10\n");
170-
181+
171182
// Write one row per dataset with average metrics
172183
for (Map.Entry<String, SummaryStats> entry : statsByDataset.entrySet()) {
173184
String dataset = entry.getKey();
174185
SummaryStats datasetStats = entry.getValue();
175-
186+
176187
writer.write(dataset + ",");
177188
writer.write(datasetStats.getAvgQps() + ",");
178189
writer.write(datasetStats.getAvgLatency() + ",");

0 commit comments

Comments
 (0)