Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner > Class Template Reference

Task type used to split the work of parallel_deterministic_reduce. More...

#include <parallel_reduce.h>

Inheritance diagram for tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >:
Collaboration diagram for tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >:

Public Member Functions

void offer_work (typename Partitioner::split_type &split_obj)
 
void run_body (Range &r)
 
- Public Member Functions inherited from tbb::task
virtual ~task ()
 Destructor. More...
 
internal::allocate_continuation_proxyallocate_continuation ()
 Returns proxy for overloaded new that allocates a continuation task of *this. More...
 
internal::allocate_child_proxyallocate_child ()
 Returns proxy for overloaded new that allocates a child task of *this. More...
 
void recycle_as_continuation ()
 Change this to be a continuation of its former self. More...
 
void recycle_as_safe_continuation ()
 Recommended to use, safe variant of recycle_as_continuation. More...
 
void recycle_as_child_of (task &new_parent)
 Change this to be a child of new_parent. More...
 
void recycle_to_reexecute ()
 Schedule this for reexecution after current execute() returns. More...
 
void set_ref_count (int count)
 Set reference count. More...
 
void increment_ref_count ()
 Atomically increment reference count. More...
 
int add_ref_count (int count)
 Atomically adds to reference count and returns its new value. More...
 
int decrement_ref_count ()
 Atomically decrement reference count and returns its new value. More...
 
void spawn_and_wait_for_all (task &child)
 Similar to spawn followed by wait_for_all, but more efficient. More...
 
void __TBB_EXPORTED_METHOD spawn_and_wait_for_all (task_list &list)
 Similar to spawn followed by wait_for_all, but more efficient. More...
 
void wait_for_all ()
 Wait for reference count to become one, and set reference count to zero. More...
 
taskparent () const
 task on whose behalf this task is working, or NULL if this is a root. More...
 
void set_parent (task *p)
 sets parent task pointer to specified value More...
 
task_group_contextcontext ()
 This method is deprecated and will be removed in the future. More...
 
task_group_contextgroup ()
 Pointer to the task group descriptor. More...
 
bool is_stolen_task () const
 True if task was stolen from the task pool of another thread. More...
 
bool is_enqueued_task () const
 True if the task was enqueued. More...
 
state_type state () const
 Current execution state. More...
 
int ref_count () const
 The internal reference count. More...
 
bool __TBB_EXPORTED_METHOD is_owned_by_current_thread () const
 Obsolete, and only retained for the sake of backward compatibility. Always returns true. More...
 
void set_affinity (affinity_id id)
 Set affinity for this task. More...
 
affinity_id affinity () const
 Current affinity of this task. More...
 
virtual void __TBB_EXPORTED_METHOD note_affinity (affinity_id id)
 Invoked by scheduler to notify task that it ran on unexpected thread. More...
 
void __TBB_EXPORTED_METHOD change_group (task_group_context &ctx)
 Moves this task from its current group into another one. More...
 
bool cancel_group_execution ()
 Initiates cancellation of all tasks in this cancellation group and its subordinate groups. More...
 
bool is_cancelled () const
 Returns true if the context has received cancellation request. More...
 
__TBB_DEPRECATED void set_group_priority (priority_t p)
 Changes priority of the task group this task belongs to. More...
 
__TBB_DEPRECATED priority_t group_priority () const
 Retrieves current priority of the task group this task belongs to. More...
 

Static Public Member Functions

static void run (const Range &range, Body &body, Partitioner &partitioner)
 
static void run (const Range &range, Body &body, Partitioner &partitioner, task_group_context &context)
 
- Static Public Member Functions inherited from tbb::task
static internal::allocate_root_proxy allocate_root ()
 Returns proxy for overloaded new that allocates a root task. More...
 
static internal::allocate_root_with_context_proxy allocate_root (task_group_context &ctx)
 Returns proxy for overloaded new that allocates a root task associated with user supplied context. More...
 
static void spawn_root_and_wait (task &root)
 Spawn task allocated by allocate_root, wait for it to complete, and deallocate it. More...
 
static void spawn_root_and_wait (task_list &root_list)
 Spawn root tasks on list and wait for all of them to finish. More...
 
static void enqueue (task &t)
 Enqueue task for starvation-resistant execution. More...
 
static void enqueue (task &t, priority_t p)
 Enqueue task for starvation-resistant execution on the specified priority level. More...
 
static void enqueue (task &t, task_arena &arena, priority_t p=priority_t(0))
 Enqueue task in task_arena. More...
 
static task &__TBB_EXPORTED_FUNC self ()
 The innermost task being executed or destroyed by the current thread at the moment. More...
 

Private Types

typedef finish_deterministic_reduce< Body > finish_type
 

Private Member Functions

taskexecute () __TBB_override
 Should be overridden by derived classes. More...
 
 start_deterministic_reduce (const Range &range, Body &body, Partitioner &partitioner)
 Constructor used for root task. More...
 
 start_deterministic_reduce (start_deterministic_reduce &parent_, finish_type &c, typename Partitioner::split_type &split_obj)
 Splitting constructor used to generate children. More...
 

Private Attributes

Body & my_body
 
Range my_range
 
Partitioner::task_partition_type my_partition
 

Additional Inherited Members

- Public Types inherited from tbb::task
enum  state_type {
  executing, reexecute, ready, allocated,
  freed, recycle
}
 Enumeration of task states that the scheduler considers. More...
 
typedef internal::affinity_id affinity_id
 An id as used for specifying affinity. More...
 
- Protected Member Functions inherited from tbb::task
 task ()
 Default constructor. More...
 

Detailed Description

template<typename Range, typename Body, typename Partitioner>
class tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >

Task type used to split the work of parallel_deterministic_reduce.

Definition at line 222 of file parallel_reduce.h.

Member Typedef Documentation

◆ finish_type

template<typename Range, typename Body, typename Partitioner>
typedef finish_deterministic_reduce<Body> tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::finish_type
private

Definition at line 223 of file parallel_reduce.h.

Constructor & Destructor Documentation

◆ start_deterministic_reduce() [1/2]

template<typename Range, typename Body, typename Partitioner>
tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::start_deterministic_reduce ( const Range &  range,
Body &  body,
Partitioner &  partitioner 
)
inlineprivate

Constructor used for root task.

Definition at line 230 of file parallel_reduce.h.

230  :
231  my_body( body ),
232  my_range( range ),
233  my_partition( partitioner )
234  {
235  }

◆ start_deterministic_reduce() [2/2]

template<typename Range, typename Body, typename Partitioner>
tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::start_deterministic_reduce ( start_deterministic_reduce< Range, Body, Partitioner > &  parent_,
finish_type c,
typename Partitioner::split_type &  split_obj 
)
inlineprivate

Splitting constructor used to generate children.

parent_ becomes left child. Newly constructed object is right child.

Definition at line 238 of file parallel_reduce.h.

238  :
239  my_body( c.my_right_body ),
240  my_range( parent_.my_range, split_obj ),
241  my_partition( parent_.my_partition, split_obj )
242  {
243  }

Member Function Documentation

◆ execute()

template<typename Range , typename Body , typename Partitioner >
task * tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::execute ( )
privatevirtual

Should be overridden by derived classes.

Implements tbb::task.

Definition at line 277 of file parallel_reduce.h.

277  {
278  my_partition.execute(*this, my_range);
279  return NULL;
280  }

References tbb::task::execute().

Here is the call graph for this function:

◆ offer_work()

template<typename Range, typename Body, typename Partitioner>
void tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::offer_work ( typename Partitioner::split_type &  split_obj)
inline

Definition at line 265 of file parallel_reduce.h.

265  {
266  task* tasks[2];
267  allocate_sibling(static_cast<task*>(this), tasks, sizeof(start_deterministic_reduce), sizeof(finish_type));
268  new((void*)tasks[0]) finish_type(my_body);
269  new((void*)tasks[1]) start_deterministic_reduce(*this, *static_cast<finish_type*>(tasks[0]), split_obj);
270  spawn(*tasks[1]);
271  }
void * allocate_sibling(task *start_for_task, size_t bytes)
allocate right task with new parent
start_deterministic_reduce(const Range &range, Body &body, Partitioner &partitioner)
Constructor used for root task.
task()
Default constructor.
Definition: task.h:625
finish_deterministic_reduce< Body > finish_type

References tbb::interface9::internal::allocate_sibling().

Here is the call graph for this function:

◆ run() [1/2]

template<typename Range, typename Body, typename Partitioner>
static void tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::run ( const Range &  range,
Body &  body,
Partitioner &  partitioner 
)
inlinestatic

Definition at line 246 of file parallel_reduce.h.

246  {
247  if( !range.empty() ) {
248 #if !__TBB_TASK_GROUP_CONTEXT || TBB_JOIN_OUTER_TASK_GROUP
250 #else
251  // Bound context prevents exceptions from body to affect nesting or sibling algorithms,
252  // and allows users to handle exceptions safely by wrapping parallel_for in the try-block.
253  task_group_context context(PARALLEL_REDUCE);
255 #endif /* __TBB_TASK_GROUP_CONTEXT && !TBB_JOIN_OUTER_TASK_GROUP */
256  }
257  }
start_deterministic_reduce(const Range &range, Body &body, Partitioner &partitioner)
Constructor used for root task.
static internal::allocate_root_proxy allocate_root()
Returns proxy for overloaded new that allocates a root task.
Definition: task.h:663
task_group_context * context()
This method is deprecated and will be removed in the future.
Definition: task.h:878
static void spawn_root_and_wait(task &root)
Spawn task allocated by allocate_root, wait for it to complete, and deallocate it.
Definition: task.h:808

References tbb::task::allocate_root(), and tbb::task::spawn_root_and_wait().

Referenced by tbb::parallel_deterministic_reduce().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run() [2/2]

template<typename Range, typename Body, typename Partitioner>
static void tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::run ( const Range &  range,
Body &  body,
Partitioner &  partitioner,
task_group_context context 
)
inlinestatic

Definition at line 259 of file parallel_reduce.h.

259  {
260  if( !range.empty() )
262  }
start_deterministic_reduce(const Range &range, Body &body, Partitioner &partitioner)
Constructor used for root task.
static internal::allocate_root_proxy allocate_root()
Returns proxy for overloaded new that allocates a root task.
Definition: task.h:663
task_group_context * context()
This method is deprecated and will be removed in the future.
Definition: task.h:878
static void spawn_root_and_wait(task &root)
Spawn task allocated by allocate_root, wait for it to complete, and deallocate it.
Definition: task.h:808

References tbb::task::allocate_root(), and tbb::task::spawn_root_and_wait().

Here is the call graph for this function:

◆ run_body()

template<typename Range, typename Body, typename Partitioner>
void tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::run_body ( Range &  r)
inline

Member Data Documentation

◆ my_body

template<typename Range, typename Body, typename Partitioner>
Body& tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::my_body
private

Definition at line 224 of file parallel_reduce.h.

◆ my_partition

template<typename Range, typename Body, typename Partitioner>
Partitioner::task_partition_type tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::my_partition
private

Definition at line 226 of file parallel_reduce.h.

◆ my_range

template<typename Range, typename Body, typename Partitioner>
Range tbb::interface9::internal::start_deterministic_reduce< Range, Body, Partitioner >::my_range
private

Definition at line 225 of file parallel_reduce.h.


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

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.