28#include <initializer_list>
41 template <
typename F,
typename... Args>
72 template <
class F,
class R,
class Cond = noReferenceCond<F>>
73 auto MapReduce(
F func,
unsigned nTimes,
R redfunc,
unsigned nChunks) -> InvokeResult_t<F>;
74 template <
class F,
class INTEGER,
class R,
class Cond = noReferenceCond<F, INTEGER>>
76 template <
class F,
class T,
class R,
class Cond = noReferenceCond<F, T>>
77 auto MapReduce(
F func, std::initializer_list<T> args,
R redfunc,
unsigned nChunks) -> InvokeResult_t<F, T>;
78 template <
class F,
class T,
class R,
class Cond = noReferenceCond<F, T>>
79 auto MapReduce(
F func, std::vector<T> &args,
R redfunc,
unsigned nChunks) -> InvokeResult_t<F, T>;
80 template <
class F,
class T,
class R,
class Cond = noReferenceCond<F, T>>
81 auto MapReduce(
F func,
const std::vector<T> &args,
R redfunc,
unsigned nChunks) -> InvokeResult_t<F, T>;
92 template <
class F,
class Cond = noReferenceCond<F>>
93 auto MapImpl(
F func,
unsigned nTimes) -> std::vector<InvokeResult_t<F>>;
94 template <
class F,
class INTEGER,
class Cond = noReferenceCond<F, INTEGER>>
96 template <
class F,
class T,
class Cond = noReferenceCond<F, T>>
97 auto MapImpl(
F func, std::vector<T> &args) -> std::vector<InvokeResult_t<F, T>>;
98 template <
class F,
class T,
class Cond = noReferenceCond<F, T>>
99 auto MapImpl(
F func,
const std::vector<T> &args) -> std::vector<InvokeResult_t<F, T>>;
107# define R__EXECUTOR_THREAD ROOT::TThreadExecutor
109# define R__EXECUTOR_THREAD Unused_t
112# define R__EXECUTOR_PROCESS ROOT::TProcessExecutor
114# define R__EXECUTOR_PROCESS Unused_t
121#undef R__EXECUTOR_THREAD
122#undef R__EXECUTOR_PROCESS
126 template<
class F,
class CONTAINER>
139 template<
class F,
class T>
141 std::vector<typename MapRetType<F, typename std::decay<T>::type>
::type> res;
165template <
class F,
class Cond>
168 return ResolveExecutorAndMap(func, nTimes);
176template <
class F,
class INTEGER,
class Cond>
179 return ResolveExecutorAndMap(func, args);
187template <
class F,
class T,
class Cond>
190 return ResolveExecutorAndMap(func, args);
198template <
class F,
class T,
class Cond>
201 return ResolveExecutorAndMap(func, args);
215template <
class F,
class R,
class Cond>
219 return fThreadExecutor->MapReduce(func, nTimes, redfunc, nChunks);
221 return Reduce(Map(func, nTimes), redfunc);
235template <
class F,
class INTEGER,
class R,
class Cond>
239 return fThreadExecutor->MapReduce(func, args, redfunc, nChunks);
241 return Reduce(Map(func, args), redfunc);
255template <
class F,
class T,
class R,
class Cond>
259 return fThreadExecutor->MapReduce(func, args, redfunc, nChunks);
261 return Reduce(Map(func, args), redfunc);
275template <
class F,
class T,
class R,
class Cond>
279 return fThreadExecutor->MapReduce(func, args, redfunc, nChunks);
281 return Reduce(Map(func, args), redfunc);
295template <
class F,
class T,
class R,
class Cond>
299 return fThreadExecutor->MapReduce(func, args, redfunc, nChunks);
301 return Reduce(Map(func, args), redfunc);
311 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.
ROOT::TypeTraits::InvokeResult_t< F, Args... > InvokeResult_t
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...
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.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
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