Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::Executor Class Reference

Base Executor class.

Definition at line 36 of file Executor.h.

Public Types

template<class F , class... T>
using noReferenceCond = typename std::enable_if_t<"Function can't return a reference" &&!(std::is_reference< InvokeResult_t< F, T... > >::value)>
 

Public Member Functions

 Executor ()
 Default constructor of TMVA Executor class if ROOT::EnableImplicitMT has not been called then by default a serial executor will be created A user can create a thread pool and enable multi-thread excution by calling.
 
 Executor (int nthreads)
 Constructor of TMVA Executor class Explicit specify the number of threads.
 
template<class Function , class INTEGER >
void Foreach (Function func, ROOT::TSeq< INTEGER > args, unsigned nChunks=0)
 
template<class Function , class T >
void Foreach (Function func, std::vector< T > &args, unsigned nChunks=0)
 
template<class Function >
void Foreach (Function func, unsigned int nTimes, unsigned nChunks=0)
 wrap TExecutor::Foreach
 
ROOT::TThreadExecutorGetMultiThreadExecutor ()
 
unsigned int GetPoolSize () const
 
template<class F , class INTEGER , class Cond = noReferenceCond<F, INTEGER>>
auto Map (F func, ROOT::TSeq< INTEGER > args) -> std::vector< InvokeResult_t< F, INTEGER > >
 
template<class F , class Cond = noReferenceCond<F>>
auto Map (F func, unsigned nTimes) -> std::vector< InvokeResult_t< F > >
 Wrap TExecutor::Map functions.
 
template<class F , class INTEGER , class R , class Cond = noReferenceCond<F, INTEGER>>
auto MapReduce (F func, ROOT::TSeq< INTEGER > args, R redfunc) -> InvokeResult_t< F, INTEGER >
 Wrap TExecutor::MapReduce functions.
 
template<class F , class INTEGER , class R , class Cond = noReferenceCond<F, INTEGER>>
auto MapReduce (F func, ROOT::TSeq< INTEGER > args, R redfunc, unsigned nChunks) -> InvokeResult_t< F, INTEGER >
 
template<class T , class R >
auto Reduce (const std::vector< T > &objs, R redfunc) -> decltype(redfunc(objs))
 Wrap Reduce function.
 

Public Attributes

std::unique_ptr< ROOT::TThreadExecutorfMTExecImpl
 
std::unique_ptr< ROOT::TSequentialExecutorfSeqExecImpl
 

Private Types

template<typename F , typename... Args>
using InvokeResult_t = ROOT::TypeTraits::InvokeResult_t< F, Args... >
 

#include <TMVA/Executor.h>

Member Typedef Documentation

◆ InvokeResult_t

template<typename F , typename... Args>
using TMVA::Executor::InvokeResult_t = ROOT::TypeTraits::InvokeResult_t<F, Args...>
private

Definition at line 39 of file Executor.h.

◆ noReferenceCond

template<class F , class... T>
using TMVA::Executor::noReferenceCond = typename std::enable_if_t<"Function can't return a reference" && !(std::is_reference<InvokeResult_t<F, T...> >::value)>

Definition at line 43 of file Executor.h.

Constructor & Destructor Documentation

◆ Executor() [1/2]

TMVA::Executor::Executor ( )
inline

Default constructor of TMVA Executor class if ROOT::EnableImplicitMT has not been called then by default a serial executor will be created A user can create a thread pool and enable multi-thread excution by calling.

TMVA::Config::Instance()::%EnableMT(int nthreads);
static Config & Instance()
static function: returns TMVA instance
Definition Config.cxx:98

For releasing the thread pool used by TMVA one can do it by calling

TMVA::Config::Instance()::%DisableMT();

Definition at line 59 of file Executor.h.

◆ Executor() [2/2]

TMVA::Executor::Executor ( int  nthreads)
inlineexplicit

Constructor of TMVA Executor class Explicit specify the number of threads.

In this case if nthreads is > 1 a multi-threaded executor will be created and TMVA will run in MT. If nthreads = 1 instead TMVA will run in sequential mode If nthreads = 0 TMVA will use the default thread pool size

Definition at line 80 of file Executor.h.

Member Function Documentation

◆ Foreach() [1/3]

template<class Function , class INTEGER >
void TMVA::Executor::Foreach ( Function  func,
ROOT::TSeq< INTEGER >  args,
unsigned  nChunks = 0 
)
inline

Definition at line 128 of file Executor.h.

◆ Foreach() [2/3]

template<class Function , class T >
void TMVA::Executor::Foreach ( Function  func,
std::vector< T > &  args,
unsigned  nChunks = 0 
)
inline

Definition at line 122 of file Executor.h.

◆ Foreach() [3/3]

template<class Function >
void TMVA::Executor::Foreach ( Function  func,
unsigned int  nTimes,
unsigned  nChunks = 0 
)
inline

wrap TExecutor::Foreach

Definition at line 117 of file Executor.h.

◆ GetMultiThreadExecutor()

ROOT::TThreadExecutor * TMVA::Executor::GetMultiThreadExecutor ( )
inline

Definition at line 96 of file Executor.h.

◆ GetPoolSize()

unsigned int TMVA::Executor::GetPoolSize ( ) const
inline

Definition at line 106 of file Executor.h.

◆ Map() [1/2]

template<class F , class INTEGER , class Cond = noReferenceCond<F, INTEGER>>
auto TMVA::Executor::Map ( F  func,
ROOT::TSeq< INTEGER >  args 
) -> std::vector<InvokeResult_t<F, INTEGER>>
inline

Definition at line 146 of file Executor.h.

◆ Map() [2/2]

template<class F , class Cond = noReferenceCond<F>>
auto TMVA::Executor::Map ( F  func,
unsigned  nTimes 
) -> std::vector<InvokeResult_t<F>>
inline

Wrap TExecutor::Map functions.

Definition at line 140 of file Executor.h.

◆ MapReduce() [1/2]

template<class F , class INTEGER , class R , class Cond = noReferenceCond<F, INTEGER>>
auto TMVA::Executor::MapReduce ( F  func,
ROOT::TSeq< INTEGER >  args,
R  redfunc 
) -> InvokeResult_t<F, INTEGER>
inline

Wrap TExecutor::MapReduce functions.

Definition at line 154 of file Executor.h.

◆ MapReduce() [2/2]

template<class F , class INTEGER , class R , class Cond = noReferenceCond<F, INTEGER>>
auto TMVA::Executor::MapReduce ( F  func,
ROOT::TSeq< INTEGER >  args,
R  redfunc,
unsigned  nChunks 
) -> InvokeResult_t<F, INTEGER>
inline

Definition at line 160 of file Executor.h.

◆ Reduce()

template<class T , class R >
auto TMVA::Executor::Reduce ( const std::vector< T > &  objs,
R  redfunc 
) -> decltype(redfunc(objs))
inline

Wrap Reduce function.

Definition at line 168 of file Executor.h.

Member Data Documentation

◆ fMTExecImpl

std::unique_ptr<ROOT::TThreadExecutor> TMVA::Executor::fMTExecImpl

Definition at line 175 of file Executor.h.

◆ fSeqExecImpl

std::unique_ptr<ROOT::TSequentialExecutor> TMVA::Executor::fSeqExecImpl

Definition at line 179 of file Executor.h.

Libraries for TMVA::Executor:

The documentation for this class was generated from the following file: