Skip to content

Commit e9022c4

Browse files
committed
cleaning up extraneous logging
1 parent 8092bb1 commit e9022c4

File tree

2 files changed

+5
-105
lines changed

2 files changed

+5
-105
lines changed

.github/workflows/run-bench.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,14 @@ jobs:
6161

6262
- name: Run Bench main
6363
run: |
64-
# Print current directory and list jar files to ensure we're using the right one
65-
echo "Current directory: $(pwd)"
66-
echo "Available jar files:"
67-
find jvector-examples/target -name "*.jar" | sort
68-
6964
# Use the jar-with-dependencies which includes all required dependencies
70-
# Explicitly set the classpath to include SLF4J implementation
7165
java ${{ matrix.jdk >= 20 && '--enable-native-access=ALL-UNNAMED --add-modules=jdk.incubator.vector' || '' }} \
7266
${{ matrix.jdk >= 22 && '-Djvector.experimental.enable_native_vectorization=true' || '' }} \
7367
-cp jvector-examples/target/jvector-examples-*-jar-with-dependencies.jar io.github.jbellis.jvector.example.AutoBenchYAML --output bench-results.json ${{ inputs.benchmark_config != '' && inputs.benchmark_config || 'jvector-examples/yaml-configs/default.yml' }}
7468
7569
# List files in current directory to help with debugging
7670
echo "Files in current directory:"
7771
ls -la
78-
79-
# Check if log file exists and show its contents
80-
if [ -f bench-results.log ]; then
81-
echo "Contents of bench-results.log:"
82-
cat bench-results.log
83-
else
84-
echo "bench-results.log file not found"
85-
fi
8672
8773
- name: Upload Bench Results
8874
uses: actions/upload-artifact@v4

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

Lines changed: 5 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -81,31 +81,17 @@ private static List<String> getAllDatasetNames() {
8181
}
8282

8383
public static void main(String[] args) throws IOException {
84-
// Add debug info at the very start
85-
System.out.println("DEBUG: AutoBenchYAML starting execution");
86-
8784
// Check for --output argument (required for this class)
8885
String outputPath = null;
8986
for (int i = 0; i < args.length - 1; i++) {
9087
if (args[i].equals("--output")) outputPath = args[i+1];
9188
}
9289

93-
// Print all arguments for debugging
94-
System.out.println("DEBUG: Command line arguments:");
95-
for (int i = 0; i < args.length; i++) {
96-
System.out.println(" Arg[" + i + "]: " + args[i]);
97-
}
98-
9990
if (outputPath == null) {
10091
logger.error("Error: --output argument is required for AutoBenchYAML");
101-
System.err.println("Error: --output argument is required for AutoBenchYAML");
10292
System.exit(1);
10393
}
10494

105-
// Force System.out flush to ensure logs are written
106-
System.out.println("DEBUG: Output path: " + outputPath);
107-
System.out.flush();
108-
10995
logger.info("Heap space available is {}", Runtime.getRuntime().maxMemory());
11096

11197
// Filter out --output and its argument from the args
@@ -114,56 +100,29 @@ public static void main(String[] args) throws IOException {
114100
.filter(arg -> !arg.equals("--output") && !arg.equals(finalOutputPath))
115101
.toArray(String[]::new);
116102

117-
System.out.println("DEBUG: Filtered arguments: " + Arrays.toString(filteredArgs));
118-
System.out.flush();
119-
120103
// generate a regex that matches any regex in filteredArgs, or if filteredArgs is empty/null, match everything
121104
var regex = filteredArgs.length == 0 ? ".*" : Arrays.stream(filteredArgs).flatMap(s -> Arrays.stream(s.split("\\s"))).map(s -> "(?:" + s + ")").collect(Collectors.joining("|"));
122105
// compile regex and do substring matching using find
123106
var pattern = Pattern.compile(regex);
124107

125-
System.out.println("DEBUG: Using regex pattern: " + regex);
126-
System.out.flush();
127-
128108
var datasetNames = getAllDatasetNames().stream().filter(dn -> pattern.matcher(dn).find()).collect(Collectors.toList());
129109

130-
System.out.println("DEBUG: Dataset names after filtering: " + datasetNames);
131-
System.out.println("DEBUG: Dataset names size: " + datasetNames.size());
132-
System.out.flush();
133-
134110
logger.info("Executing the following datasets: {}", datasetNames);
135111
List<BenchResult> results = new ArrayList<>();
136112

137113
// Process datasets from regex patterns
138114
if (!datasetNames.isEmpty()) {
139-
System.out.println("DEBUG: Processing datasets from regex patterns");
140-
System.out.flush();
141115
for (var datasetName : datasetNames) {
142116
logger.info("Loading dataset: {}", datasetName);
143-
System.out.println("DEBUG: Attempting to load dataset: " + datasetName);
144-
System.out.flush();
145-
146117
try {
147118
DataSet ds = DataSetLoader.loadDataSet(datasetName);
148-
System.out.println("DEBUG: Dataset loaded successfully: " + datasetName);
149-
System.out.flush();
150-
151119
logger.info("Dataset loaded: {} with {} vectors", datasetName, ds.baseVectors.size());
152-
System.out.println("DEBUG: Dataset has " + ds.baseVectors.size() + " vectors");
153-
System.out.flush();
154120

155121
if (datasetName.endsWith(".hdf5")) {
156122
datasetName = datasetName.substring(0, datasetName.length() - ".hdf5".length());
157123
}
158124

159-
System.out.println("DEBUG: Getting default config for: " + datasetName);
160-
System.out.flush();
161-
162125
MultiConfig config = MultiConfig.getDefaultConfig(datasetName);
163-
164-
System.out.println("DEBUG: Got config, running benchmark");
165-
System.out.flush();
166-
167126
logger.info("Using configuration: {}", config);
168127

169128
results.addAll(Grid.runAllAndCollectResults(ds,
@@ -177,46 +136,28 @@ public static void main(String[] args) throws IOException {
177136
config.search.topKOverquery,
178137
config.search.useSearchPruning));
179138

180-
System.out.println("DEBUG: Benchmark completed for dataset: " + datasetName);
181-
System.out.flush();
139+
logger.info("Benchmark completed for dataset: {}", datasetName);
182140
} catch (Exception e) {
183-
System.err.println("ERROR: Exception while processing dataset " + datasetName);
184-
e.printStackTrace();
185-
System.err.flush();
141+
logger.error("Exception while processing dataset {}", datasetName, e);
186142
}
187143
}
188144
}
189145

190146
// Process YAML configuration files
191147
List<String> configNames = Arrays.stream(filteredArgs).filter(s -> s.endsWith(".yml")).collect(Collectors.toList());
192148
if (!configNames.isEmpty()) {
193-
System.out.println("DEBUG: Processing YAML configuration files: " + configNames);
194-
System.out.flush();
195-
196149
for (var configName : configNames) {
197150
logger.info("Processing configuration file: {}", configName);
198-
System.out.println("DEBUG: Processing configuration file: " + configName);
199-
System.out.flush();
200151

201152
try {
202153
MultiConfig config = MultiConfig.getConfig(configName);
203154
String datasetName = config.dataset;
204155
logger.info("Configuration specifies dataset: {}", datasetName);
205-
System.out.println("DEBUG: Configuration specifies dataset: " + datasetName);
206-
System.out.flush();
207156

208157
logger.info("Loading dataset: {}", datasetName);
209-
System.out.println("DEBUG: Loading dataset from YAML config: " + datasetName);
210-
System.out.flush();
211-
212158
DataSet ds = DataSetLoader.loadDataSet(datasetName);
213159
logger.info("Dataset loaded: {} with {} vectors", datasetName, ds.baseVectors.size());
214-
System.out.println("DEBUG: Dataset loaded from YAML config: " + datasetName + " with " + ds.baseVectors.size() + " vectors");
215-
System.out.flush();
216160

217-
System.out.println("DEBUG: Running benchmark with YAML config");
218-
System.out.flush();
219-
220161
results.addAll(Grid.runAllAndCollectResults(ds,
221162
config.construction.outDegree,
222163
config.construction.efConstruction,
@@ -228,59 +169,32 @@ public static void main(String[] args) throws IOException {
228169
config.search.topKOverquery,
229170
config.search.useSearchPruning));
230171

231-
System.out.println("DEBUG: Benchmark completed for YAML config: " + configName);
232-
System.out.flush();
172+
logger.info("Benchmark completed for YAML config: {}", configName);
233173
} catch (Exception e) {
234-
System.err.println("ERROR: Exception while processing YAML config " + configName);
235-
e.printStackTrace();
236-
System.err.flush();
174+
logger.error("Exception while processing YAML config {}", configName, e);
237175
}
238176
}
239-
} else {
240-
System.out.println("DEBUG: No YAML configuration files to process");
241-
System.out.flush();
242177
}
243178

244-
System.out.println("DEBUG: Benchmark processing completed. Results size: " + results.size());
245-
System.out.flush();
246-
247179
// Calculate summary statistics
248180
try {
249-
System.out.println("DEBUG: Calculating summary statistics");
250-
System.out.flush();
251-
252181
SummaryStats stats = BenchmarkSummarizer.summarize(results);
253182
logger.info("Benchmark summary: {}", stats.toString());
254-
System.out.println("DEBUG: Benchmark summary: " + stats.toString());
255-
System.out.flush();
256183

257184
// Write results to JSON file
258-
System.out.println("DEBUG: Writing results to JSON file: " + outputPath);
259-
System.out.flush();
260-
261185
ObjectMapper mapper = new ObjectMapper();
262186
File outputFile = new File(outputPath);
263187
mapper.writerWithDefaultPrettyPrinter().writeValue(outputFile, results);
264188
logger.info("Benchmark results written to {} (file exists: {})", outputPath, outputFile.exists());
265-
System.out.println("DEBUG: Benchmark results written to " + outputPath + " (file exists: " + outputFile.exists() + ")");
266-
System.out.flush();
267189

268190
// Double check that the file was created and log its size
269191
if (outputFile.exists()) {
270192
logger.info("Output file size: {} bytes", outputFile.length());
271-
System.out.println("DEBUG: Output file size: " + outputFile.length() + " bytes");
272193
} else {
273194
logger.error("Failed to create output file at {}", outputPath);
274-
System.err.println("ERROR: Failed to create output file at " + outputPath);
275195
}
276-
System.out.flush();
277196
} catch (Exception e) {
278-
System.err.println("ERROR: Exception during final processing");
279-
e.printStackTrace();
280-
System.err.flush();
197+
logger.error("Exception during final processing", e);
281198
}
282-
283-
System.out.println("DEBUG: AutoBenchYAML execution completed");
284-
System.out.flush();
285199
}
286200
}

0 commit comments

Comments
 (0)