21 #ifndef mia_core_parallel_hh
22 #define mia_core_parallel_hh
25 #include <miaconfig.h>
31 #include <tbb/task_scheduler_init.h>
32 #include <tbb/recursive_mutex.h>
33 #include <tbb/mutex.h>
34 #include <tbb/parallel_for.h>
35 #include <tbb/parallel_reduce.h>
36 #include <tbb/blocked_range.h>
37 #include <tbb/recursive_mutex.h>
38 #include <tbb/spin_mutex.h>
49 #define ATOMIC tbb::atomic
51 template <
typename Range,
typename Func>
52 void pfor(
const Range& range, Func body)
54 tbb::parallel_for(range, body);
57 template<
typename Range,
typename Value,
58 typename Func,
typename Reduction>
59 Value
preduce(
const Range& range,
const Value& identity,
60 const Func& func,
const Reduction& reduction)
62 return tbb::parallel_reduce(range, identity, func, reduction);
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
#define NS_MIA_END
conveniance define to end the mia namespace
std::recursive_mutex CRecursiveMutex
void pfor(Range range, const Func &f)
TScopedLock< CRecursiveMutex > CRecursiveScopedLock
Value preduce(Range range, Value identity, const Func &f, Reduce r)
TScopedLock< CMutex > CScopedLock