Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,28 @@ public static void main(String[] args) throws IOException {
}
logger.info("Using configuration: {}", config);

List<BenchResult> datasetResults = Grid.runAllAndCollectResults(ds,
config.construction.useSavedIndexIfExists,
config.construction.outDegree,
config.construction.efConstruction,
config.construction.neighborOverflow,
config.construction.addHierarchy,
config.construction.refineFinalGraph,
config.construction.getFeatureSets(),
config.construction.getCompressorParameters(),
config.search.getCompressorParameters(),
config.search.topKOverquery,
config.search.useSearchPruning);
List<BenchResult> datasetResults = new ArrayList<>();
int repetitions = config.repetitionsOrOne();
for (int rep = 0; rep < repetitions; rep++) {
if (repetitions > 1) {
logger.info("{}: repetition {} of {}", datasetName, rep + 1, repetitions);
}
datasetResults.addAll(Grid.runAllAndCollectResults(ds,
config.construction.useSavedIndexIfExists,
config.construction.outDegree,
config.construction.efConstruction,
config.construction.neighborOverflow,
config.construction.alpha,
config.construction.addHierarchy,
config.construction.refineFinalGraph,
config.construction.getFeatureSets(),
config.construction.getCompressorParameters(),
config.search.getCompressorParameters(),
config.search.topKOverquery,
config.search.useSearchPruning,
config.search.queryRunsOrDefault(),
rep));
}
results.addAll(datasetResults);

logger.info("Benchmark completed for dataset: {}", datasetName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static void main(String[] args) throws IOException {
List.of(1.0, 2.0) // oq
); // rerankK = oq * topK
var neighborOverflowGrid = List.of(1.2f); // List.of(1.2f, 2.0f);
var alphaGrid = List.of(1.2f); // List.of(1.0f, 1.2f, 1.4f);
var addHierarchyGrid = List.of(true); // List.of(false, true);
var refineFinalGraphGrid = List.of(true); // List.of(false, true);
var usePruningGrid = List.of(true); // List.of(false, true);
Expand Down Expand Up @@ -82,10 +83,10 @@ public static void main(String[] args) throws IOException {
// compile regex and do substring matching using find
var pattern = Pattern.compile(regex);

execute(pattern, enableIndexCache, buildCompression, featureSets, searchCompression, mGrid, efConstructionGrid, neighborOverflowGrid, addHierarchyGrid, refineFinalGraphGrid, topKGrid, usePruningGrid);
execute(pattern, enableIndexCache, buildCompression, featureSets, searchCompression, mGrid, efConstructionGrid, neighborOverflowGrid, alphaGrid, addHierarchyGrid, refineFinalGraphGrid, topKGrid, usePruningGrid);
}

private static void execute(Pattern pattern, boolean enableIndexCache, List<Function<DataSet, CompressorParameters>> buildCompression, List<EnumSet<FeatureId>> featureSets, List<Function<DataSet, CompressorParameters>> compressionGrid, List<Integer> mGrid, List<Integer> efConstructionGrid, List<Float> neighborOverflowGrid, List<Boolean> addHierarchyGrid, List<Boolean> refineFinalGraphGrid, Map<Integer, List<Double>> topKGrid, List<Boolean> usePruningGrid) throws IOException {
private static void execute(Pattern pattern, boolean enableIndexCache, List<Function<DataSet, CompressorParameters>> buildCompression, List<EnumSet<FeatureId>> featureSets, List<Function<DataSet, CompressorParameters>> compressionGrid, List<Integer> mGrid, List<Integer> efConstructionGrid, List<Float> neighborOverflowGrid, List<Float> alphaGrid, List<Boolean> addHierarchyGrid, List<Boolean> refineFinalGraphGrid, Map<Integer, List<Double>> topKGrid, List<Boolean> usePruningGrid) throws IOException {
var datasetCollection = DatasetCollection.load();
var datasetNames = datasetCollection.getAll().stream().filter(dn -> pattern.matcher(dn).find()).collect(Collectors.toList());
System.out.println("Executing the following datasets: " + datasetNames);
Expand All @@ -94,7 +95,7 @@ private static void execute(Pattern pattern, boolean enableIndexCache, List<Func
DataSet ds = DataSets.loadDataSet(datasetName).orElseThrow(
() -> new RuntimeException("Dataset " + datasetName + " not found")
).getDataSet();
Grid.runAll(ds, enableIndexCache, mGrid, efConstructionGrid, neighborOverflowGrid, addHierarchyGrid, refineFinalGraphGrid, featureSets, buildCompression, compressionGrid, topKGrid, usePruningGrid);
Grid.runAll(ds, enableIndexCache, mGrid, efConstructionGrid, neighborOverflowGrid, alphaGrid, addHierarchyGrid, refineFinalGraphGrid, featureSets, buildCompression, compressionGrid, topKGrid, usePruningGrid);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.github.jbellis.jvector.example.benchmarks.datasets.DataSets;
import io.github.jbellis.jvector.example.reporting.RunArtifacts;
import io.github.jbellis.jvector.example.reporting.SearchReportingCatalog;
import io.github.jbellis.jvector.example.util.BenchArgExpander;
import io.github.jbellis.jvector.example.yaml.DatasetCollection;
import io.github.jbellis.jvector.example.yaml.MultiConfig;
import io.github.jbellis.jvector.example.yaml.RunConfig;
Expand All @@ -43,9 +44,10 @@ public static void main(String[] args) throws IOException {
if (args == null) {
throw new InvalidParameterException("argv[] is null, check your maven exec config");
}
// Expand range shorthand like sift1m:label_[00..11] into 12 separate tokens
args = BenchArgExpander.expandAll(args);
String regex = Arrays.stream(args)
.filter(Objects::nonNull)
.flatMap(s -> Arrays.stream(s.split("\\s")))
.filter(s -> !s.isEmpty())
.collect(Collectors.joining("|"));
var pattern = Pattern.compile(regex.isEmpty() ? ".*" : regex);
Expand Down Expand Up @@ -124,20 +126,31 @@ public static void main(String[] args) throws IOException {
// Register dataset info the first time we actually load the dataset for benchmarking
artifacts.registerDataset(datasetName, ds);

Grid.runAll(ds,
config.construction.useSavedIndexIfExists,
config.construction.outDegree,
config.construction.efConstruction,
config.construction.neighborOverflow,
config.construction.addHierarchy,
config.construction.refineFinalGraph,
config.construction.getFeatureSets(),
config.construction.getCompressorParameters(),
config.search.getCompressorParameters(),
config.search.topKOverquery,
config.search.useSearchPruning,
artifacts);
int repetitions = config.repetitionsOrOne();
for (int rep = 0; rep < repetitions; rep++) {
if (repetitions > 1) {
System.out.printf("%s: repetition %d of %d%n", datasetName, rep + 1, repetitions);
}
Grid.runAll(ds,
config.construction.useSavedIndexIfExists,
config.construction.outDegree,
config.construction.efConstruction,
config.construction.neighborOverflow,
config.construction.alpha,
config.construction.addHierarchy,
config.construction.refineFinalGraph,
config.construction.getFeatureSets(),
config.construction.getCompressorParameters(),
config.search.getCompressorParameters(),
config.search.topKOverquery,
config.search.useSearchPruning,
config.search.queryRunsOrDefault(),
rep,
artifacts);
}
}

artifacts.printSummary();
}

private static String wrapList(java.util.List<String> items, int perLine, String indent) {
Expand Down
Loading
Loading