MADNESS
version 0.9
|
Lowest level task interface. More...
#include <worldthread.h>
Public Member Functions | |
PoolTaskInterface () | |
PoolTaskInterface (const TaskAttributes &attr) | |
void | set_nthread (int nthread) |
Call this to reset the number of threads before the task is submitted. More... | |
virtual void | run (const TaskThreadEnv &info)=0 |
Override this method to implement a multi-threaded task. More... | |
virtual | ~PoolTaskInterface () |
Public Member Functions inherited from madness::TaskAttributes | |
TaskAttributes (unsigned long flags=0) | |
TaskAttributes (const TaskAttributes &attr) | |
virtual | ~TaskAttributes () |
bool | is_generator () const |
bool | is_stealable () const |
bool | is_high_priority () const |
void | set_generator (bool generator_hint) |
void | set_stealable (bool stealable) |
void | set_highpriority (bool hipri) |
void | set_nthread (int nthread) |
Are you sure this is what you want to call? More... | |
int | get_nthread () const |
template<typename Archive > | |
void | serialize (Archive &ar) |
Static Public Member Functions | |
static void | operator delete (void *p, std::size_t size) throw () |
Destroy task object. More... | |
Static Public Member Functions inherited from madness::TaskAttributes | |
static TaskAttributes | generator () |
static TaskAttributes | hipri () |
static TaskAttributes | multi_threaded (int nthread) |
Static Protected Member Functions | |
template<typename fnT > | |
static enable_if_c < detail::function_traits< fnT > ::value||detail::memfunc_traits < fnT >::value >::type | make_id (std::pair< void *, unsigned short > &id, fnT fn) |
template<typename fnobjT > | |
static disable_if_c < detail::function_traits < fnobjT >::value||detail::memfunc_traits < fnobjT >::value >::type | make_id (std::pair< void *, unsigned short > &id, const fnobjT &) |
Friends | |
class | ThreadPool |
Additional Inherited Members | |
Static Public Attributes inherited from madness::TaskAttributes | |
static const unsigned long | NTHREAD = 0xff |
static const unsigned long | GENERATOR = 1ul<<8 |
static const unsigned long | STEALABLE = GENERATOR<<1 |
static const unsigned long | HIGHPRIORITY = GENERATOR<<2 |
Lowest level task interface.
The pool invokes run_multi_threaded() that does any necessary setup for multiple threads and then invokes the users run
method.
|
inline |
|
inlineexplicit |
|
inlinevirtual |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestatic |
Destroy task object.
|
pure virtual |
Override this method to implement a multi-threaded task.
info.nthread()
will be the number of threads collaborating on this task
info.id()
will be the index of the current thread id=0
,...,nthread-1
info.barrier()
will be a barrier for all of the threads, and returns true
for the last thread to enter the barrier (other threads get false)
Implemented in madness::detail::ForEachRootTask< rangeT, opT >, madness::detail::ForEachTask< rangeT, opT >, madness::PoolTaskNull, madness::TaskFn< fnT, arg1T, arg2T, arg3T, arg4T, arg5T, arg6T, arg7T, arg8T, arg9T >, and madness::TaskInterface.
|
inline |
Call this to reset the number of threads before the task is submitted.
Once a task has been constructed /c TaskAttributes::set_nthread() is insufficient because a multithreaded task includes a barrier that needs to know the number of threads.
References madness::TaskAttributes::get_nthread(), and madness::TaskAttributes::set_nthread().
Referenced by madness::SystolicMatrixAlgorithm< double >::SystolicMatrixAlgorithm().
|
friend |