27#include <initializer_list>
68 template <
class F,
class R,
class Cond = val
idMapReturnCond<F>>
69 auto MapReduce(
F func,
unsigned nTimes,
R redfunc,
unsigned nChunks) -> InvokeResult_t<F>;
70 template <
class F,
class INTEGER,
class R,
class Cond = val
idMapReturnCond<F, INTEGER>>
72 template <
class F,
class T,
class R,
class Cond = val
idMapReturnCond<F, T>>
73 auto MapReduce(
F func, std::initializer_list<T> args,
R redfunc,
unsigned nChunks) -> InvokeResult_t<F, T>;
74 template <
class F,
class T,
class R,
class Cond = val
idMapReturnCond<F, T>>
75 auto MapReduce(
F func, std::vector<T> &args,
R redfunc,
unsigned nChunks) -> InvokeResult_t<F, T>;
76 template <
class F,
class T,
class R,
class Cond = val
idMapReturnCond<F, T>>
77 auto MapReduce(
F func,
const std::vector<T> &args,
R redfunc,
unsigned nChunks) -> InvokeResult_t<F, T>;
88 template <
class F,
class Cond = val
idMapReturnCond<F>>
89 auto MapImpl(
F func,
unsigned nTimes) -> std::vector<InvokeResult_t<F>>;
90 template <
class F,
class INTEGER,
class Cond = val
idMapReturnCond<F, INTEGER>>
92 template <
class F,
class T,
class Cond = val
idMapReturnCond<F, T>>
93 auto MapImpl(
F func, std::vector<T> &args) -> std::vector<InvokeResult_t<F, T>>;
94 template <
class F,
class T,
class Cond = val
idMapReturnCond<F, T>>
95 auto MapImpl(
F func,
const std::vector<T> &args) -> std::vector<InvokeResult_t<F, T>>;
103# define R__EXECUTOR_THREAD ROOT::TThreadExecutor
105# define R__EXECUTOR_THREAD Unused_t
108# define R__EXECUTOR_PROCESS ROOT::TProcessExecutor
110# define R__EXECUTOR_PROCESS Unused_t
117#undef R__EXECUTOR_THREAD
118#undef R__EXECUTOR_PROCESS
122 template<
class F,
class CONTAINER>
135 template<
class F,
class T>
137 std::vector<typename MapRetType<F, typename std::decay<T>::type>
::type> res;
161template <
class F,
class Cond>
164 return ResolveExecutorAndMap(func, nTimes);
172template <
class F,
class INTEGER,
class Cond>
175 return ResolveExecutorAndMap(func, args);
183template <
class F,
class T,
class Cond>
186 return ResolveExecutorAndMap(func, args);
194template <
class F,
class T,
class Cond>
197 return ResolveExecutorAndMap(func, args);
212template <
class F,
class R,
class Cond>
216 static_assert(std::is_invocable_v<R, std::vector<InvokeResult_t<F>>>,
"redfunc does not have the correct signature");
218 return fThreadExecutor->MapReduce(func, nTimes, redfunc, nChunks);
220 return Reduce(Map(func, nTimes), redfunc);
235template <
class F,
class INTEGER,
class R,
class Cond>
238 static_assert(std::is_invocable_v<R, std::vector<InvokeResult_t<F, INTEGER>>>,
239 "redfunc does not have the correct signature");
241 return fThreadExecutor->MapReduce(func, args, redfunc, nChunks);
243 return Reduce(Map(func, args), redfunc);
258template <
class F,
class T,
class R,
class Cond>
261 static_assert(std::is_invocable_v<R, std::vector<InvokeResult_t<F, T>>>,
262 "redfunc does not have the correct signature");
264 return fThreadExecutor->MapReduce(func, args, redfunc, nChunks);
266 return Reduce(Map(func, args), redfunc);
281template <
class F,
class T,
class R,
class Cond>
284 static_assert(std::is_invocable_v<R, std::vector<InvokeResult_t<F, T>>>,
285 "redfunc does not have the correct signature");
287 return fThreadExecutor->MapReduce(func, args, redfunc, nChunks);
289 return Reduce(Map(func, args), redfunc);
304template <
class F,
class T,
class R,
class Cond>
307 static_assert(std::is_invocable_v<R, std::vector<InvokeResult_t<F, T>>>,
308 "redfunc does not have the correct signature");
310 return fThreadExecutor->MapReduce(func, args, redfunc, nChunks);
312 return Reduce(Map(func, args), redfunc);
322 unsigned poolSize{0u};
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
This class implements the interface to execute the same task multiple times, sequentially or in paral...
auto MapReduce(F func, unsigned nTimes, R redfunc, unsigned nChunks) -> InvokeResult_t< F >
Execute a function nTimes (Map) and accumulate the results into a single value (Reduce).
auto ResolveExecutorAndMap(F func, T &&args) -> std::vector< typename MapRetType< F, typename std::decay< T >::type >::type >
Function called from Map to select and execute the correct Executor according to the set Execution Po...
std::unique_ptr< ROOT::TThreadExecutor > fThreadExecutor
std::unique_ptr< ROOT::TSequentialExecutor > fSequentialExecutor
ROOT::EExecutionPolicy Policy() const
Return the execution policy the executor is set to.
auto MapImpl(F func, unsigned nTimes) -> std::vector< InvokeResult_t< F > >
Execute a function without arguments several times.
TExecutor(unsigned nWorkers=0)
Class constructor.
TExecutor & operator=(const TExecutor &)=delete
TExecutor(const TExecutor &)=delete
ROOT::EExecutionPolicy fExecPolicy
unsigned GetPoolSize() const
Return the number of pooled workers.
std::unique_ptr< ROOT::TProcessExecutor > fProcessExecutor
This class defines an interface to execute the same task multiple times, possibly in parallel and wit...
ROOT::TypeTraits::InvokeResult_t< F, Args... > InvokeResult_t
auto Map(F func, unsigned nTimes) -> std::vector< InvokeResult_t< F > >
Execute a function without arguments several times.
T * Reduce(const std::vector< T * > &mergeObjs)
"Reduce" an std::vector into a single object by using the object's Merge method.
A pseudo container class which is a generator of indices.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
Helper class to get the correct return type from the Map function, necessary to infer the ResolveExec...
InvokeResult_t< F, typename CONTAINER::value_type > type