15#include <lagrange/utils/assert.h>
17#include <tbb/parallel_for.h>
18#include <tbb/parallel_invoke.h>
19#include <tbb/task_arena.h>
21namespace lagrange::poisson::threadpool {
26 static unsigned int NumThreads(
void) {
return tbb::this_task_arena::max_concurrency(); }
29 template <
typename... Functions>
30 static void ParallelSections(Functions&&... funcs)
32 tbb::parallel_invoke(std::forward<Functions>(funcs)...);
36 template <
typename Function>
37 static void ParallelFor(
size_t begin,
size_t end, Function&& func)
42 for (
size_t i = begin; i < end; ++i) {
43 func(thread_index, i);
47 tbb::blocked_range<size_t>(begin, end),
48 [&](
const tbb::blocked_range<size_t>& r) {
49 int thread_index = tbb::this_task_arena::current_thread_index();
51 for (
size_t i = r.begin(); i < r.end(); ++i) {
52 func(thread_index, i);
#define la_debug_assert(...)
Debug assertion check.
Definition: assert.h:189
Definition: ThreadPool.h:24