From a7c15e86fc2a467f5973b3e97430839ff10f00dd Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 25 Apr 2023 12:18:15 -0700 Subject: [PATCH] Update num_threads to use the concurrent hint from the stdlib --- test/cfoa/helpers.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/cfoa/helpers.hpp b/test/cfoa/helpers.hpp index 7ff48334..a9c27121 100644 --- a/test/cfoa/helpers.hpp +++ b/test/cfoa/helpers.hpp @@ -21,8 +21,10 @@ #include #include #include +#include -constexpr std::size_t const num_threads = 16; +static std::size_t const num_threads = + std::max(2u, std::thread::hardware_concurrency()); struct transp_hash { @@ -326,7 +328,7 @@ std::vector > split( template void thread_runner(std::vector& values, F f) { - boost::latch latch(num_threads); + boost::latch latch(static_cast(num_threads)); std::vector threads; auto subslices = split(values, num_threads);