8000 ANN_BENCH: fix the reported core count by achirkin · Pull Request #896 · rapidsai/cuvs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ANN_BENCH: fix the reported core count #896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
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
8 changes: 5 additions & 3 deletions cpp/bench/ann/src/common/util.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
* Copyright (c) 2023-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -388,20 +388,22 @@ inline auto host_info()
uint64_t cpu_freq_max = 0;
int host_processors_used = 0;
int host_cores_used = 0;
std::set<int> host_cores_selected{};
std::set<std::pair<int, int>> host_cores_selected{}; // pairs of (socket_id, core_id)
for (int cpu_id = 0; cpu_id < host_processors_configured; cpu_id++) {
if (CPU_ISSET_S(cpu_id, affinity_mask_buf.size(), affinity_mask) == 0) { continue; }
host_processors_used++;
std::string cpu_fpath = "/sys/devices/system/cpu/cpu" + std::to_string(cpu_id);
if (!std::filesystem::exists(cpu_fpath)) { continue; }

int this_cpu_core = 0;
int this_cpu_package = 0;
uint64_t this_cpu_freq_min = 0;
uint64_t this_cpu_freq_max = 0;
std::ifstream(cpu_fpath + "/topology/core_id") >> this_cpu_core;
std::ifstream(cpu_fpath + "/topology/physical_package_id") >> this_cpu_package;
std::ifstream(cpu_fpath + "/cpufreq/scaling_min_freq") >> this_cpu_freq_min;
std::ifstream(cpu_fpath + "/cpufreq/scaling_max_freq") >> this_cpu_freq_max;
host_cores_selected.insert(this_cpu_core);
host_cores_selected.insert(std::make_pair(this_cpu_package, this_cpu_core));
cpu_freq_min = cpu_freq_min == 0
? (this_cpu_freq_min * 1000ull)
: std::min<uint64_t>(this_cpu_freq_min * 1000ull, cpu_freq_min);
Expand Down
0