Skip to content

common: use physical core count for --threads -1 default#23932

Open
Oxygen56 wants to merge 1 commit into
ggml-org:masterfrom
Oxygen56:fix/issue-19110
Open

common: use physical core count for --threads -1 default#23932
Oxygen56 wants to merge 1 commit into
ggml-org:masterfrom
Oxygen56:fix/issue-19110

Conversation

@Oxygen56
Copy link
Copy Markdown

Replace std::thread::hardware_concurrency() with common_cpu_get_num_physical_cores() for the --threads -1 default value calculation.

std::thread::hardware_concurrency() returns logical CPU count, which includes hyper-threads, causing --threads -1 to double-count on HT-enabled systems. common_cpu_get_num_physical_cores() already exists in common/common.cpp and returns the correct physical core count.

Fixes #19110

Replace std::thread::hardware_concurrency() with common_cpu_get_num_physical_cores() for the --threads -1 default value calculation.

std::thread::hardware_concurrency() returns logical CPU count, which
includes hyper-threads, causing --threads -1 to double-count on HT-enabled
systems. common_cpu_get_num_physical_cores() already exists in common.cpp
and returns the correct physical core count.

Fixes ggml-org#19110

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Oxygen56 Oxygen56 requested a review from a team as a code owner May 31, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--threads -1 double counts via std::thread::hardware_concurrency() due to hyper-threading

1 participant