ROOT 6.08/07 Reference Guide |
Definition at line 39 of file TProcessExecutor.hxx.
Public Member Functions | |
TProcessExecutor (unsigned nWorkers=0) | |
Class constructor. More... | |
TProcessExecutor (const TProcessExecutor &)=delete | |
~TProcessExecutor ()=default | |
unsigned | GetNWorkers () const |
template<class F , class Cond = noReferenceCond<F>> | |
auto | Map (F func, unsigned nTimes) -> std::vector< typename std::result_of< F()>::type > |
Execute func (with no arguments) nTimes in parallel. More... | |
TProcessExecutor & | operator= (const TProcessExecutor &)=delete |
template<class F > | |
auto | ProcTree (const std::vector< std::string > &fileNames, F procFunc, const std::string &treeName="", ULong64_t nToProcess=0) -> typename std::result_of< F(std::reference_wrapper< TTreeReader >)>::type |
template<class F > | |
auto | ProcTree (const std::string &fileName, F procFunc, const std::string &treeName="", ULong64_t nToProcess=0) -> typename std::result_of< F(std::reference_wrapper< TTreeReader >)>::type |
template<class F > | |
auto | ProcTree (TFileCollection &files, F procFunc, const std::string &treeName="", ULong64_t nToProcess=0) -> typename std::result_of< F(std::reference_wrapper< TTreeReader >)>::type |
template<class F > | |
auto | ProcTree (TChain &files, F procFunc, const std::string &treeName="", ULong64_t nToProcess=0) -> typename std::result_of< F(std::reference_wrapper< TTreeReader >)>::type |
template<class F > | |
auto | ProcTree (TTree &tree, F procFunc, ULong64_t nToProcess=0) -> typename std::result_of< F(std::reference_wrapper< TTreeReader >)>::type |
TList * | ProcTree (const std::vector< std::string > &fileNames, TSelector &selector, const std::string &treeName="", ULong64_t nToProcess=0) |
TSelector-based tree processing: dataset as a vector of files. More... | |
TList * | ProcTree (const std::string &fileName, TSelector &selector, const std::string &treeName="", ULong64_t nToProcess=0) |
TSelector-based tree processing: dataset as a single file. More... | |
TList * | ProcTree (TFileCollection &files, TSelector &selector, const std::string &treeName="", ULong64_t nToProcess=0) |
TSelector-based tree processing: dataset as a TFileCollection. More... | |
TList * | ProcTree (TChain &files, TSelector &selector, const std::string &treeName="", ULong64_t nToProcess=0) |
TSelector-based tree processing: dataset as a TChain. More... | |
TList * | ProcTree (TTree &tree, TSelector &selector, ULong64_t nToProcess=0) |
TSelector-based tree processing: memory resident tree. More... | |
template<class T , class R > | |
T | Reduce (const std::vector< T > &objs, R redfunc) |
void | SetNWorkers (unsigned n) |
Private Types | |
enum | ETask : unsigned char { ETask::kNoTask, ETask::kMap, ETask::kMapWithArg, ETask::kProcByRange, ETask::kProcByFile } |
A collection of the types of tasks that TProcessExecutor can execute. More... | |
Private Member Functions | |
template<class T > | |
void | Collect (std::vector< T > &reslist) |
Listen for messages sent by the workers and call the appropriate handler function. More... | |
void | FixLists (std::vector< TObject *> &lists) |
Fix list of lists before merging (to avoid errors about duplicated objects) More... | |
template<class T > | |
void | HandlePoolCode (MPCodeBufPair &msg, TSocket *sender, std::vector< T > &reslist) |
Handle message and reply to the worker. More... | |
void | ReplyToFuncResult (TSocket *s) |
Reply to a worker who just sent a result. More... | |
void | ReplyToIdle (TSocket *s) |
Reply to a worker who is idle. More... | |
void | Reset () |
Reset TProcessExecutor's state. More... | |
Private Member Functions inherited from TMPClient | |
TMPClient (unsigned nWorkers=0) | |
Class constructor. More... | |
TMPClient (const TMPClient &)=delete | |
~TMPClient () | |
Class destructor. More... | |
unsigned | Broadcast (unsigned code, unsigned nMessages=0) |
Send a message with the specified code to at most nMessages workers. More... | |
template<class T > | |
unsigned | Broadcast (unsigned code, const std::vector< T > &objs) |
Send a message with a different object to each server. More... | |
template<class T > | |
unsigned | Broadcast (unsigned code, std::initializer_list< T > &objs) |
Send a message with a different object to each server. More... | |
template<class T > | |
unsigned | Broadcast (unsigned code, T obj, unsigned nMessages=0) |
Send a message containing code and obj to each worker, up to a maximum number of nMessages workers. More... | |
void | DeActivate (TSocket *s) |
DeActivate a certain socket. More... | |
bool | Fork (TMPWorker &server) |
This method forks the ROOT session into fNWorkers children processes. More... | |
bool | GetIsParent () const |
TMonitor & | GetMonitor () |
unsigned | GetNWorkers () const |
void | HandleMPCode (MPCodeBufPair &msg, TSocket *sender) |
Handle messages containing an EMPCode. More... | |
TMPClient & | operator= (const TMPClient &)=delete |
void | ReapWorkers () |
Wait on worker processes and remove their pids from fWorkerPids. More... | |
void | Remove (TSocket *s) |
Remove a certain socket from the monitor. More... | |
void | SetNWorkers (unsigned n) |
Set the number of workers that will be spawned by the next call to Fork() More... | |
Private Attributes | |
unsigned | fNProcessed |
number of arguments already passed to the workers More... | |
unsigned | fNToProcess |
total number of arguments to pass to the workers More... | |
ETask | fTaskType = ETask::kNoTask |
the kind of task that is being executed, if any More... | |
#include <ROOT/TProcessExecutor.hxx>
|
strongprivate |
A collection of the types of tasks that TProcessExecutor can execute.
It is used to interpret in the right way and properly reply to the messages received (see, for example, TProcessExecutor::HandleInput)
Definition at line 92 of file TProcessExecutor.hxx.
|
explicit |
Class constructor.
nWorkers is the number of times this ROOT session will be forked, i.e. the number of workers that will be spawned.
Definition at line 92 of file TProcessExecutor.cxx.
|
default |
|
delete |
|
private |
Listen for messages sent by the workers and call the appropriate handler function.
TProcessExecutor::HandlePoolCode is called on messages with a code < 1000 and TMPClient::HandleMPCode is called on messages with a code >= 1000.
Definition at line 373 of file TProcessExecutor.hxx.
Fix list of lists before merging (to avoid errors about duplicated objects)
Definition at line 268 of file TProcessExecutor.cxx.
|
inline |
Definition at line 73 of file TProcessExecutor.hxx.
|
private |
Handle message and reply to the worker.
Definition at line 344 of file TProcessExecutor.hxx.
auto TProcessExecutor::Map | ( | F | func, |
unsigned | nTimes | ||
) | -> std::vector<typename std::result_of<F()>::type> |
Execute func (with no arguments) nTimes in parallel.
A vector containg executions' results is returned. Functions that take more than zero arguments can be executed (with fixed arguments) by wrapping them in a lambda or with std::bind.
Definition at line 112 of file TProcessExecutor.hxx.
|
delete |
auto TProcessExecutor::ProcTree | ( | const std::vector< std::string > & | fileNames, |
F | procFunc, | ||
const std::string & | treeName = "" , |
||
ULong64_t | nToProcess = 0 |
||
) | -> typename std::result_of<F(std::reference_wrapper<TTreeReader>)>::type |
Definition at line 212 of file TProcessExecutor.hxx.
auto TProcessExecutor::ProcTree | ( | const std::string & | fileName, |
F | procFunc, | ||
const std::string & | treeName = "" , |
||
ULong64_t | nToProcess = 0 |
||
) | -> typename std::result_of<F(std::reference_wrapper<TTreeReader>)>::type |
Definition at line 266 of file TProcessExecutor.hxx.
auto TProcessExecutor::ProcTree | ( | TFileCollection & | files, |
F | procFunc, | ||
const std::string & | treeName = "" , |
||
ULong64_t | nToProcess = 0 |
||
) | -> typename std::result_of<F(std::reference_wrapper<TTreeReader>)>::type |
Definition at line 274 of file TProcessExecutor.hxx.
auto TProcessExecutor::ProcTree | ( | TChain & | files, |
F | procFunc, | ||
const std::string & | treeName = "" , |
||
ULong64_t | nToProcess = 0 |
||
) | -> typename std::result_of<F(std::reference_wrapper<TTreeReader>)>::type |
Definition at line 286 of file TProcessExecutor.hxx.
auto TProcessExecutor::ProcTree | ( | TTree & | tree, |
F | procFunc, | ||
ULong64_t | nToProcess = 0 |
||
) | -> typename std::result_of<F(std::reference_wrapper<TTreeReader>)>::type |
Definition at line 299 of file TProcessExecutor.hxx.
TList * TProcessExecutor::ProcTree | ( | const std::vector< std::string > & | fileNames, |
TSelector & | selector, | ||
const std::string & | treeName = "" , |
||
ULong64_t | nToProcess = 0 |
||
) |
TSelector-based tree processing: dataset as a vector of files.
Definition at line 153 of file TProcessExecutor.cxx.
TList * TProcessExecutor::ProcTree | ( | const std::string & | fileName, |
TSelector & | selector, | ||
const std::string & | treeName = "" , |
||
ULong64_t | nToProcess = 0 |
||
) |
TSelector-based tree processing: dataset as a single file.
Definition at line 261 of file TProcessExecutor.cxx.
TList * TProcessExecutor::ProcTree | ( | TFileCollection & | files, |
TSelector & | selector, | ||
const std::string & | treeName = "" , |
||
ULong64_t | nToProcess = 0 |
||
) |
TSelector-based tree processing: dataset as a TFileCollection.
Definition at line 235 of file TProcessExecutor.cxx.
TList * TProcessExecutor::ProcTree | ( | TChain & | files, |
TSelector & | selector, | ||
const std::string & | treeName = "" , |
||
ULong64_t | nToProcess = 0 |
||
) |
TSelector-based tree processing: dataset as a TChain.
Definition at line 248 of file TProcessExecutor.cxx.
TSelector-based tree processing: memory resident tree.
Definition at line 99 of file TProcessExecutor.cxx.
T TProcessExecutor::Reduce | ( | const std::vector< T > & | objs, |
R | redfunc | ||
) |
Definition at line 204 of file TProcessExecutor.hxx.
Reply to a worker who just sent a result.
If another argument to process exists, tell the worker. Otherwise send a shutdown order.
Definition at line 296 of file TProcessExecutor.cxx.
Reply to a worker who is idle.
If another argument to process exists, tell the worker. Otherwise ask for a result
Definition at line 314 of file TProcessExecutor.cxx.
Reset TProcessExecutor's state.
Definition at line 284 of file TProcessExecutor.cxx.
|
inline |
Definition at line 72 of file TProcessExecutor.hxx.
|
private |
number of arguments already passed to the workers
Definition at line 86 of file TProcessExecutor.hxx.
|
private |
total number of arguments to pass to the workers
Definition at line 87 of file TProcessExecutor.hxx.
|
private |
the kind of task that is being executed, if any
Definition at line 100 of file TProcessExecutor.hxx.