5#pragma GCC diagnostic push
6#pragma GCC diagnostic ignored "-Wshadow"
12#pragma GCC diagnostic pop
114 using BRange_t = tbb::blocked_range<
decltype(objs.begin())>;
116 auto pred = [redfunc](BRange_t
const & range,
T init) {
117 return std::accumulate(range.begin(), range.end(),
init, redfunc);
120 BRange_t objRange(objs.begin(), objs.end());
122 return tbb::this_task_arena::isolate([&]{
123 return tbb::parallel_reduce(objRange,
T{}, pred, redfunc);
149 tbb::this_task_arena::isolate([&]{
150 tbb::parallel_for(start, end, step,
f);
156 return ROOT::Internal::ParallelReduceHelper<double>(objs, redfunc);
161 return ROOT::Internal::ParallelReduceHelper<float>(objs, redfunc);
static UInt_t GetPoolSize()
Returns the number of threads running when the scheduler has been instantiated within ROOT.
This class provides a simple interface to execute the same task multiple times in parallel,...
std::shared_ptr< ROOT::Internal::TPoolManager > fSched
void ParallelFor(unsigned start, unsigned end, unsigned step, const std::function< void(unsigned int i)> &f)
TThreadExecutor()
Class constructor.
double ParallelReduce(const std::vector< double > &objs, const std::function< double(double a, double b)> &redfunc)
std::shared_ptr< TPoolManager > GetPoolManager(UInt_t nThreads=0)
Get a shared pointer to the manager.
static T ParallelReduceHelper(const std::vector< T > &objs, const std::function< T(T a, T b)> &redfunc)
A helper function to implement the TThreadExecutor::ParallelReduce methods.
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Namespace for new ROOT classes and functions.