From ef786f1bfc5176ad4a677210fd1f08bfbb2f420d Mon Sep 17 00:00:00 2001 From: "The gemma.cpp Authors" Date: Mon, 24 Jun 2024 09:15:05 -0700 Subject: [PATCH] Use hwy::ThreadPool::MaxThreads() to determine the number of threads to use. PiperOrigin-RevId: 646117298 --- util/app.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/util/app.h b/util/app.h index 4fd357c..9735d26 100644 --- a/util/app.h +++ b/util/app.h @@ -133,9 +133,8 @@ class AppArgs : public ArgsBase { } static inline size_t GetSupportedThreadCount() { - return static_cast( - std::clamp(static_cast(std::thread::hardware_concurrency()) - 2, 1, - HWY_MIN(static_cast(kMaxThreads), 18))); + return std::clamp(hwy::ThreadPool::MaxThreads(), size_t{1}, + std::min(kMaxThreads, size_t{18})); } Path log; // output