Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何找到最佳线程数以使用现代 C++ 计算一个非常大的向量的总和?我知道有类似的问题/答案。但是说我不知道 prod 机器的配置是什么。该方法仍然需要最少的时间
你不知道,那是实施工作。你打电话std::reduce给std::execution::parallel_unsequenced_policy。
std::reduce
std::execution::parallel_unsequenced_policy
(C++11std::accumulate被指定得太紧而无法并行执行。)
std::accumulate