Skip to content

Commit

Permalink
Maybe really fix benchmark issues?
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr committed Dec 18, 2024
1 parent b347d92 commit c316ca3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
11 changes: 6 additions & 5 deletions cpp/bench/ann/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function(ConfigureAnnBench)
PRIVATE ${ConfigureAnnBench_LINKS}
nlohmann_json::nlohmann_json
Threads::Threads
raft::raft_logger
$<TARGET_NAME_IF_EXISTS:raft::raft_logger>
$<$<BOOL:${GPU_BUILD}>:CUDA::cudart_static>
$<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_CXX>
$<TARGET_NAME_IF_EXISTS:conda_env>
Expand Down Expand Up @@ -176,9 +176,11 @@ function(ConfigureAnnBench)
add_dependencies(CUVS_ANN_BENCH_ALL ${BENCH_NAME})
endfunction()

if(CUVS_FAISS_ENABLE_GPU)
if(CUVS_FAISS_ENABLE_GPU OR CUVS_ANN_BENCH_SINGLE_EXE)
add_library(cuvs_bench_logger OBJECT)
target_link_libraries(cuvs_bench_logger PRIVATE rmm::rmm_logger_impl raft::raft_logger_impl)
target_link_libraries(
cuvs_bench_logger PRIVATE rmm::rmm_logger_impl $<TARGET_NAME_IF_EXISTS:raft::raft_logger>
)
endif()

# ##################################################################################################
Expand Down Expand Up @@ -311,8 +313,7 @@ if(CUVS_ANN_BENCH_SINGLE_EXE)
fmt::fmt-header-only
spdlog::spdlog_header_only
$<$<TARGET_EXISTS:CUDA::nvtx3>:CUDA::nvtx3>
rmm::rmm_logger_impl
raft::raft_logger_impl
cuvs_bench_logger
)
set_target_properties(
ANN_BENCH
Expand Down
33 changes: 11 additions & 22 deletions cpp/bench/ann/src/common/benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "dataset.hpp"
#include "util.hpp"

#include <raft/core/logger.hpp>

#include <benchmark/benchmark.h>
#include <unistd.h>

Expand Down Expand Up @@ -599,18 +597,16 @@ inline auto parse_string_flag(const char* arg, const char* pat, std::string& res

inline auto run_main(int argc, char** argv) -> int
{
bool force_overwrite = false;
bool build_mode = false;
bool search_mode = false;
bool no_lap_sync = false;
std::string data_prefix = "data";
std::string index_prefix = "index";
std::string new_override_kv = "";
std::string mode = "latency";
std::string threads_arg_txt = "";
std::vector<int> threads = {1, -1}; // min_thread, max_thread
std::string log_level_str = "";
[[maybe_unused]] raft::level_enum raft_log_level = raft::level_enum::off;
bool force_overwrite = false;
bool build_mode = false;
bool search_mode = false;
bool no_lap_sync = false;
std::string data_prefix = "data";
std::string index_prefix = "index";
std::string new_override_kv = "";
std::string mode = "latency";
std::string threads_arg_txt = "";
std::vector<int> threads = {1, -1}; // min_thread, max_thread
kv_series override_kv{};

char arg0_default[] = "benchmark"; // NOLINT
Expand Down Expand Up @@ -641,12 +637,7 @@ inline auto run_main(int argc, char** argv) -> int
parse_string_flag(argv[i], "--index_prefix", index_prefix) ||
parse_string_flag(argv[i], "--mode", mode) ||
parse_string_flag(argv[i], "--override_kv", new_override_kv) ||
parse_string_flag(argv[i], "--threads", threads_arg_txt) ||
parse_string_flag(argv[i], "--raft_log_level", log_level_str)) {
if (!log_level_str.empty()) {
raft_log_level = static_cast<raft::level_enum>(std::stoi(log_level_str));
log_level_str = "";
}
parse_string_flag(argv[i], "--threads", threads_arg_txt)) {
if (!threads_arg_txt.empty()) {
auto threads_arg = split(threads_arg_txt, ':');
threads[0] = std::stoi(threads_arg[0]);
Expand Down Expand Up @@ -675,8 +666,6 @@ inline auto run_main(int argc, char** argv) -> int
}
}

// raft::logger::get(RAFT_NAME).set_level(raft_log_level);

Mode metric_objective = Mode::kLatency;
if (mode == "throughput") { metric_objective = Mode::kThroughput; }

Expand Down

0 comments on commit c316ca3

Please sign in to comment.