MADNESS  0.10.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
madness::detail::ForEachRootTask< rangeT, opT > Class Template Reference

Apply an operation to a range of iterators. More...

#include <world_task_queue.h>

Inheritance diagram for madness::detail::ForEachRootTask< rangeT, opT >:
Inheritance graph
[legend]
Collaboration diagram for madness::detail::ForEachRootTask< rangeT, opT >:
Collaboration graph
[legend]

Public Member Functions

 ForEachRootTask (World &, const rangeT range, const opT &op)
 Constructor. More...
 
virtual ~ForEachRootTask ()=default
 Virtual destructor. More...
 
const Future< bool > & result () const
 Result accessor. More...
 
virtual void run (World &, const TaskThreadEnv &)
 Task run work. More...
 
- Public Member Functions inherited from madness::TaskInterface
 TaskInterface (const TaskAttributes &attr)
 Create a new task with zero dependencies and given attributes. More...
 
 TaskInterface (int ndepend, const char *caller, const TaskAttributes attr=TaskAttributes())
 
 TaskInterface (int ndepend=0, const TaskAttributes attr=TaskAttributes())
 Create a new task with ndepend dependencies (default 0) and given attributes. More...
 
virtual ~TaskInterface ()
 
Worldget_world () const
 
virtual void run (World &)
 Runs a single-threaded task ... derived classes must implement this. More...
 
- Public Member Functions inherited from madness::PoolTaskInterface
 PoolTaskInterface ()
 Default constructor. More...
 
 PoolTaskInterface (const TaskAttributes &attr)
 
virtual ~PoolTaskInterface ()=default
 Destructor. More...
 
void execute ()
 
void set_nthread (int nthread)
 Call this to reset the number of threads before the task is submitted. More...
 
- Public Member Functions inherited from madness::TaskAttributes
 TaskAttributes (const TaskAttributes &attr)
 Copy constructor. More...
 
 TaskAttributes (unsigned long flags=0)
 Sets the attributes to the desired values. More...
 
virtual ~TaskAttributes ()
 
int get_nthread () const
 Get the number of threads. More...
 
bool is_generator () const
 Test if the generator attribute is true. More...
 
bool is_high_priority () const
 Test if the high priority attribute is true. More...
 
bool is_stealable () const
 Test if the stealable attribute is true. More...
 
template<typename Archive >
void serialize (Archive &ar)
 Serializes the attributes for I/O. More...
 
void set_generator (bool generator_hint)
 Sets the generator attribute. More...
 
void set_highpriority (bool hipri)
 Sets the high priority attribute. More...
 
void set_nthread (int nthread)
 Set the number of threads. More...
 
void set_stealable (bool stealable)
 Sets the stealable attribute. More...
 
- Public Member Functions inherited from madness::DependencyInterface
 DependencyInterface (int ndep, const char *caller)
 
 DependencyInterface (int ndep=0)
 
virtual ~DependencyInterface ()
 Destructor. More...
 
void dec ()
 Decrement the number of dependencies and invoke the callback if ndepend==0. More...
 
void dec_debug (const char *caller)
 
void inc ()
 Increment the number of dependencies. More...
 
void inc_debug (const char *caller)
 Same as inc(), but keeps track of caller; calling dec_debug() will signal error if no matching inc_debug() had been invoked
More...
 
int ndep () const
 Returns the number of unsatisfied dependencies. More...
 
void notify ()
 Invoked by callbacks to notify of dependencies being satisfied. More...
 
void notify_debug (const char *caller)
 Overload of CallbackInterface::notify_debug(), updates dec() More...
 
bool probe () const
 Returns true if ndepend == 0 (no unsatisfied dependencies). More...
 
void register_callback (CallbackInterface *callback)
 Registers a callback that will be executed when ndepend==0; immediately invoked if ndepend==0. More...
 
void register_final_callback (CallbackInterface *callback)
 Registers the final callback to be executed when ndepend==0; immediately invoked if ndepend==0. More...
 
- Public Member Functions inherited from madness::CallbackInterface
virtual ~CallbackInterface ()
 

Private Member Functions

virtual void get_id (std::pair< void *, unsigned short > &id) const
 Get the task ID. More...
 

Private Attributes

Future< bool > completion_status_
 The result of this set of tasks. More...
 
opT op_
 The foreach function. More...
 
rangeT range_
 The range. More...
 

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::TaskInterface
static bool debug = false
 
- Static Public Attributes inherited from madness::TaskAttributes
static const unsigned long GENERATOR = 1ul<<8
 Mask for generator bit. More...
 
static const unsigned long HIGHPRIORITY = GENERATOR<<2
 Mask for priority bit. More...
 
static const unsigned long NTHREAD = 0xff
 Mask for nthread byte. More...
 
static const unsigned long STEALABLE = GENERATOR<<1
 Mask for stealable bit. More...
 
- Protected Member Functions inherited from madness::TaskInterface
virtual void run (const TaskThreadEnv &env)
 Override this method to implement a multi-threaded task. More...
 
- Protected Member Functions inherited from madness::CallbackInterface
virtual void notify_debug_impl (const char *caller)
 
- Static Protected Member Functions inherited from madness::PoolTaskInterface
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)
 

Detailed Description

template<typename rangeT, typename opT>
class madness::detail::ForEachRootTask< rangeT, opT >

Apply an operation to a range of iterators.

Template Parameters
rangeTThe range of iterators type.
opTThe operation type. This task creates for_each tasks and collects information on the results of those tasks. Once all tasks have completed it will set the result future.

Constructor & Destructor Documentation

◆ ForEachRootTask()

template<typename rangeT , typename opT >
madness::detail::ForEachRootTask< rangeT, opT >::ForEachRootTask ( World ,
const rangeT  range,
const opT &  op 
)
inline

Constructor.

Parameters
[in]worldThe world where the tasks will run.
[in]rangeThe range of iterators.
[in]opThe operation that will be applied to the range of iterators.

◆ ~ForEachRootTask()

template<typename rangeT , typename opT >
virtual madness::detail::ForEachRootTask< rangeT, opT >::~ForEachRootTask ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ get_id()

template<typename rangeT , typename opT >
virtual void madness::detail::ForEachRootTask< rangeT, opT >::get_id ( std::pair< void *, unsigned short > &  id) const
inlineprivatevirtual

Get the task ID.

Todo:
Verify that id is an output parameter.
Parameters
[out]idThe ID to set for this task.

Reimplemented from madness::PoolTaskInterface.

References madness::PoolTaskInterface::make_id().

◆ result()

template<typename rangeT , typename opT >
const Future<bool>& madness::detail::ForEachRootTask< rangeT, opT >::result ( ) const
inline

◆ run()

template<typename rangeT , typename opT >
virtual void madness::detail::ForEachRootTask< rangeT, opT >::run ( World ,
const TaskThreadEnv  
)
inlinevirtual

Member Data Documentation

◆ completion_status_

template<typename rangeT , typename opT >
Future<bool> madness::detail::ForEachRootTask< rangeT, opT >::completion_status_
private

◆ op_

template<typename rangeT , typename opT >
opT madness::detail::ForEachRootTask< rangeT, opT >::op_
private

The foreach function.

Referenced by madness::detail::ForEachRootTask< rangeT, opT >::run().

◆ range_

template<typename rangeT , typename opT >
rangeT madness::detail::ForEachRootTask< rangeT, opT >::range_
private

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