|
MADNESS 0.10.1
|
Lowest level task interface. More...
#include <thread.h>


Classes | |
| union | FunctionPointerGrabber |
Object that is used to convert function and member function pointers into void*. More... | |
Public Member Functions | |
| PoolTaskInterface () | |
| Default constructor. | |
| PoolTaskInterface (const TaskAttributes &attr) | |
| virtual | ~PoolTaskInterface ()=default |
| Destructor. | |
| void | execute () |
| virtual void | run (const TaskThreadEnv &info)=0 |
| Override this method to implement a multi-threaded task. | |
| void | set_nthread (int nthread) |
| Call this to reset the number of threads before the task is submitted. | |
Public Member Functions inherited from madness::TaskAttributes | |
| TaskAttributes (const TaskAttributes &attr) | |
| Copy constructor. | |
| TaskAttributes (unsigned long flags=0) | |
| Sets the attributes to the desired values. | |
| virtual | ~TaskAttributes () |
| int | get_nthread () const |
| Get the number of threads. | |
| bool | is_generator () const |
| Test if the generator attribute is true. | |
| bool | is_high_priority () const |
| Test if the high priority attribute is true. | |
| bool | is_stealable () const |
| Test if the stealable attribute is true. | |
| template<typename Archive > | |
| void | serialize (Archive &ar) |
| Serializes the attributes for I/O. | |
| TaskAttributes & | set_generator (bool generator_hint) |
| Sets the generator attribute. | |
| TaskAttributes & | set_highpriority (bool hipri) |
| Sets the high priority attribute. | |
| void | set_nthread (int nthread) |
| Set the number of threads. | |
| TaskAttributes & | set_stealable (bool stealable) |
| Sets the stealable attribute. | |
Static Protected Member Functions | |
| template<typename fnobjT > | |
| static std::enable_if<!(detail::function_traits< fnobjT >::value||detail::memfunc_traits< fnobjT >::value)>::type | make_id (std::pair< void *, unsigned short > &id, const fnobjT &) |
| template<typename fnT > | |
| static std::enable_if< detail::function_traits< fnT >::value||detail::memfunc_traits< fnT >::value >::type | make_id (std::pair< void *, unsigned short > &id, fnT fn) |
Private Member Functions | |
| virtual void | get_id (std::pair< void *, unsigned short > &id) const |
| void | set_event (profiling::TaskEvent *task_event) |
| void | submit () |
| Collect info on the task and record the submit time. | |
Private Attributes | |
| std::pair< void *, unsigned short > | id_ |
| double | submit_time_ |
| profiling::TaskEvent * | task_event_ |
Friends | |
| class | ThreadPool |
Additional Inherited Members | |
Static Public Member Functions inherited from madness::TaskAttributes | |
| static TaskAttributes | generator () |
| static TaskAttributes | hipri () |
| static TaskAttributes | multi_threaded (int nthread) |
Static Public Attributes inherited from madness::TaskAttributes | |
| static const unsigned long | GENERATOR = 1ul<<8 |
| Mask for generator bit. | |
| static const unsigned long | HIGHPRIORITY = GENERATOR<<2 |
| Mask for priority bit. | |
| static const unsigned long | NTHREAD = 0xff |
| Mask for nthread byte. | |
| static const unsigned long | STEALABLE = GENERATOR<<1 |
| Mask for stealable bit. | |
Lowest level task interface.
The pool invokes run_multi_threaded(), which does any necessary setup for multiple threads, and then invokes the user's run() method.
|
inline |
Default constructor.
|
inlineexplicit |
|
virtualdefault |
Destructor.
|
inline |
References madness::TaskAttributes::get_nthread(), and run().
|
inlineprivatevirtual |
| [in,out] | id | Description needed. |
Reimplemented in madness::MatrixInnerTask< T, R, NDIM >, madness::SystolicMatrixAlgorithm< T >, madness::SystolicMatrixAlgorithm< double >, madness::TaskFn< fnT, arg1T, arg2T, arg3T, arg4T, arg5T, arg6T, arg7T, arg8T, arg9T >, madness::PoolTaskNull, and madness::detail::ForEachRootTask< rangeT, opT >.
Referenced by submit().
|
inlinestaticprotected |
| fnobjT | Description needed. |
| [in,out] | id | Description needed. |
References madness::name().
|
inlinestaticprotected |
| fnT | Description needed. |
| [in,out] | id | Description needed. |
| [in] | fn | Description needed. |
References madness::PoolTaskInterface::FunctionPointerGrabber< T >::in, and madness::PoolTaskInterface::FunctionPointerGrabber< T >::out.
Referenced by madness::MatrixInnerTask< T, R, NDIM >::get_id(), madness::SystolicMatrixAlgorithm< T >::get_id(), madness::TaskFn< fnT, arg1T, arg2T, arg3T, arg4T, arg5T, arg6T, arg7T, arg8T, arg9T >::get_id(), madness::PoolTaskNull::get_id(), and madness::detail::ForEachRootTask< rangeT, opT >::get_id().
|
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).
| [in] | info | Description needed. |
Implemented in madness::PoolTaskNull, madness::TaskInterface, Greet, and Adder.
Referenced by execute().
|
inlineprivate |
| [in,out] | task_event | Description needed. |
References task_event_.
Referenced by madness::ThreadPool::run_tasks().
|
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().
|
inlineprivate |
Collect info on the task and record the submit time.
References get_id(), submit_time_, and madness::wall_time().
|
friend |
|
private |
|
private |
|
private |
Referenced by set_event().