Use hwy::ThreadPool::MaxThreads() to determine the number of threads to use.

PiperOrigin-RevId: 646117298
This commit is contained in:
The gemma.cpp Authors 2024-06-24 09:15:05 -07:00 committed by Copybara-Service
parent 12089417b5
commit ef786f1bfc
1 changed files with 2 additions and 3 deletions

View File

@ -133,9 +133,8 @@ class AppArgs : public ArgsBase<AppArgs> {
} }
static inline size_t GetSupportedThreadCount() { static inline size_t GetSupportedThreadCount() {
return static_cast<size_t>( return std::clamp(hwy::ThreadPool::MaxThreads(), size_t{1},
std::clamp(static_cast<int>(std::thread::hardware_concurrency()) - 2, 1, std::min(kMaxThreads, size_t{18}));
HWY_MIN(static_cast<int>(kMaxThreads), 18)));
} }
Path log; // output Path log; // output