Reputation: 11
How to find optimal number of threads to calculate a really large vector's sum using modern c++? I know similar questions/answers are available. But say I don't know what configuration of prod machine will be . Still the approach should take least time
Upvotes: 1
Views: 109
Reputation: 179907
You don't, that's the implementations job. You call std::reduce
with std::execution::parallel_unsequenced_policy
.
(C++11 std::accumulate
is specified too tightly to be executed in parallel.)
Upvotes: 5