Skip to content

Commit 14d137c

Browse files
authored
CUVS_ANN_BENCH_SINGLE_EXE: find the mg library (#890)
Let the benchmark in CUVS_ANN_BENCH_SINGLE_EXE mode find the library for multi-gpu implementations. Originally, all library names coincided with the generated target (library) names, which was used by the loader to find a proper implementation for an algorithm in the benchmark config. A group of cuVS mg algorithms broke this pattern by using a single target for all cuVS mg algorithms. This PR adds this exception for the library discovery logic. Authors: - Artem M. Chirkin (https://github.com/achirkin) Approvers: - Tamas Bela Feher (https://github.com/tfeher) URL: #890
1 parent 0a84eb0 commit 14d137c

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

cpp/bench/ann/src/common/benchmark.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
2+
* Copyright (c) 2023-2025, NVIDIA CORPORATION.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,11 +49,15 @@ struct lib_handle {
4949
auto load_lib(const std::string& algo) -> void*
5050
{
5151
static std::unordered_map<std::string, lib_handle> libs{};
52-
auto found = libs.find(algo);
52+
auto lib_short_name = algo;
53+
// cuvs_mg library is responsible for all mg algorithms
54+
if (algo.rfind("cuvs_mg_", 0) == 0) { lib_short_name = "cuvs_mg"; }
5355

56+
auto found = libs.find(lib_short_name);
5457
if (found != libs.end()) { return found->second.handle; }
55-
auto lib_name = "lib" + algo + "_ann_bench.so";
56-
return libs.emplace(algo, lib_name).first->second.handle;
58+
59+
auto lib_name = "lib" + lib_short_name + "_ann_bench.so";
60+
return libs.emplace(lib_short_name, lib_name).first->second.handle;
5761
}
5862

5963
/*

0 commit comments

Comments
 (0)