Skip to content

Commit

Permalink
Fix Linux /sys cpu path to guess number of cores (#7064)
Browse files Browse the repository at this point in the history
  • Loading branch information
viric authored May 4, 2024
1 parent 03fb8a0 commit fcd84a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int32_t get_num_physical_cores() {
// enumerate the set of thread siblings, num entries is num cores
std::unordered_set<std::string> siblings;
for (uint32_t cpu=0; cpu < UINT32_MAX; ++cpu) {
std::ifstream thread_siblings("/sys/devices/system/cpu"
std::ifstream thread_siblings("/sys/devices/system/cpu/cpu"
+ std::to_string(cpu) + "/topology/thread_siblings");
if (!thread_siblings.is_open()) {
break; // no more cpus
Expand Down

0 comments on commit fcd84a0

Please sign in to comment.