17 #ifndef __TBB_parallel_reduce_H    18 #define __TBB_parallel_reduce_H    20 #define __TBB_parallel_reduce_H_include_area    31 namespace interface9 {
    47     template<
typename Body>
    55             has_right_zombie(false), 
    61             if( has_right_zombie )
    62                 zombie_space.begin()->~Body();
    65             if( has_right_zombie ) {
    67                 Body* 
s = zombie_space.begin();
    75         template<
typename Range,
typename Body_, 
typename Partitioner>
    84     template<
typename Range, 
typename Body, 
typename Partitioner>
    94             my_partition.note_affinity( 
id );
    96         template<
typename Body_>
   101         start_reduce( 
const Range& range, Body* body, Partitioner& partitioner ) :
   104             my_partition(partitioner),
   111             my_body(parent_.my_body),
   112             my_range(parent_.my_range, split_obj),
   113             my_partition(parent_.my_partition, split_obj),
   116             my_partition.set_affinity(*
this);
   122             my_body(parent_.my_body),
   124             my_partition(parent_.my_partition, 
split()),
   127             my_partition.set_affinity(*
this);
   128             my_partition.align_depth( 
d ); 
   131         static void run( 
const Range& range, Body& body, Partitioner& partitioner ) {
   132             if( !range.empty() ) {
   133 #if !__TBB_TASK_GROUP_CONTEXT || TBB_JOIN_OUTER_TASK_GROUP   143 #if __TBB_TASK_GROUP_CONTEXT   149         void run_body( Range &r ) { (*my_body)( r ); }
   154         void offer_work(
typename Partitioner::split_type& split_obj) {
   180     template<
typename Range, 
typename Body, 
typename Partitioner>
   182         my_partition.check_being_stolen( *
this );
   190         my_partition.execute(*
this, my_range);
   201     template<
typename Body>
   207             my_left_body( body ),
   208             my_right_body( body, 
split() )
   212             my_left_body.join( my_right_body );
   215         template<
typename Range,
typename Body_, 
typename Partitioner>
   221     template<
typename Range, 
typename Body, 
typename Partitioner>
   233             my_partition( partitioner )
   239             my_body( c.my_right_body ),
   240             my_range( parent_.my_range, split_obj ),
   241             my_partition( parent_.my_partition, split_obj )
   246         static void run( 
const Range& range, Body& body, Partitioner& partitioner ) {
   247             if( !range.empty() ) {
   248 #if !__TBB_TASK_GROUP_CONTEXT || TBB_JOIN_OUTER_TASK_GROUP   258 #if __TBB_TASK_GROUP_CONTEXT   265         void offer_work( 
typename Partitioner::split_type& split_obj) {
   276     template<
typename Range, 
typename Body, 
typename Partitioner>
   278         my_partition.
execute(*
this, my_range);
   294     template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   361 template<
typename Range, 
typename Body>
   368 template<
typename Range, 
typename Body>
   375 template<
typename Range, 
typename Body>
   382 template<
typename Range, 
typename Body>
   389 template<
typename Range, 
typename Body>
   394 #if __TBB_TASK_GROUP_CONTEXT   397 template<
typename Range, 
typename Body>
   404 template<
typename Range, 
typename Body>
   411 template<
typename Range, 
typename Body>
   418 template<
typename Range, 
typename Body>
   425 template<
typename Range, 
typename Body>
   436 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   437 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction ) {
   446 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   447 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction,
   451                           ::run(range, body, partitioner );
   457 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   458 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction,
   462                           ::run( range, body, partitioner );
   468 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   469 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction,
   473                                         ::run( range, body, partitioner );
   479 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   480 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction,
   484                                         ::run( range, body, partitioner );
   488 #if __TBB_TASK_GROUP_CONTEXT   491 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   492 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction,
   502 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   503 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction,
   507                           ::run( range, body, partitioner, context );
   513 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   514 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction,
   518                           ::run( range, body, partitioner, context );
   524 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   525 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction,
   529                                         ::run( range, body, partitioner, context );
   535 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   536 Value 
parallel_reduce( 
const Range& range, 
const Value& identity, 
const RealBody& real_body, 
const Reduction& reduction,
   540                                         ::run( range, body, partitioner, context );
   547 template<
typename Range, 
typename Body>
   554 template<
typename Range, 
typename Body>
   561 template<
typename Range, 
typename Body>
   566 #if __TBB_TASK_GROUP_CONTEXT   569 template<
typename Range, 
typename Body>
   576 template<
typename Range, 
typename Body>
   583 template<
typename Range, 
typename Body>
   595 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   602 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   606                           ::run(range, body, partitioner);
   612 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   616         ::run(range, body, partitioner);
   619 #if __TBB_TASK_GROUP_CONTEXT   622 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   630 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   635         ::run(range, body, partitioner, context);
   641 template<
typename Range, 
typename Value, 
typename RealBody, 
typename Reduction>
   646         ::run(range, body, partitioner, context);
   655 #undef __TBB_parallel_reduce_H_include_area const RealBody & my_real_body
 
void join(lambda_reduce_body &rhs)
 
Join task node that contains shared flag for stealing feedback.
 
Used to form groups of tasks.
 
task * execute() __TBB_override
Should be overridden by derived classes.
 
lambda_reduce_body(const Value &identity, const RealBody &body, const Reduction &reduction)
 
task * execute() __TBB_override
Should be overridden by derived classes.
 
task * execute() __TBB_override
Should be overridden by derived classes.
 
start_reduce(const Range &range, Body *body, Partitioner &partitioner)
Constructor used for root task.
 
Task type used to split the work of parallel_reduce.
 
finish_reduce< Body > finish_type
 
Base class for user-defined tasks.
 
static void run(const Range &range, Body &body, Partitioner &partitioner, task_group_context &context)
 
void set_parent(task *p)
sets parent task pointer to specified value
 
const reduction_context my_context
 
virtual task * execute()=0
Should be overridden by derived classes.
 
void * allocate_sibling(task *start_for_task, size_t bytes)
allocate right task with new parent
 
Task type used to split the work of parallel_deterministic_reduce.
 
lambda_reduce_body(lambda_reduce_body &other, tbb::split)
 
void itt_store_word_with_release(tbb::atomic< T > &dst, U src)
 
static void run(const Range &range, Body &body, Partitioner &partitioner)
 
const Value & identity_element
 
lambda_reduce_body(const lambda_reduce_body &other)
 
start_deterministic_reduce(start_deterministic_reduce &parent_, finish_type &c, typename Partitioner::split_type &split_obj)
Splitting constructor used to generate children.
 
Partitioner::task_partition_type my_partition
 
#define __TBB_DEFAULT_PARTITIONER
 
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id parent
 
void offer_work(typename Partitioner::split_type &split_obj)
 
static internal::allocate_root_proxy allocate_root()
Returns proxy for overloaded new that allocates a root task.
 
Task type used to combine the partial results of parallel_reduce.
 
reduction_context my_context
 
void parallel_deterministic_reduce(const Range &range, Body &body)
Parallel iteration with deterministic reduction and default simple partitioner.
 
aligned_space< Body > zombie_space
 
static void run(const Range &range, Body &body, Partitioner &partitioner, task_group_context &context)
 
internal::allocate_child_proxy & allocate_child()
Returns proxy for overloaded new that allocates a child task of *this.
 
start_reduce(start_reduce &parent_, typename Partitioner::split_type &split_obj)
Splitting constructor used to generate children.
 
void offer_work(const Range &r, depth_t d=0)
spawn right task, serves as callback for partitioner
 
lambda_reduce_body & operator=(const lambda_reduce_body &other)
 
static void spawn_root_and_wait(task &root)
Spawn task allocated by allocate_root, wait for it to complete, and deallocate it.
 
Task type used to combine the partial results of parallel_deterministic_reduce.
 
internal::allocate_continuation_proxy & allocate_continuation()
Returns proxy for overloaded new that allocates a continuation task of *this.
 
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d
 
static void run(const Range &range, Body &body, Partitioner &partitioner)
 
finish_deterministic_reduce< Body > finish_type
 
finish_deterministic_reduce(Body &body)
 
Dummy type that distinguishes splitting constructor from copy constructor.
 
Auxiliary class for parallel_reduce; for internal use only.
 
void set_ref_count(int count)
Set reference count.
 
const Reduction & my_reduction
 
void const char const char int ITT_FORMAT __itt_group_sync s
 
void parallel_reduce(const Range &range, Body &body)
Parallel iteration with reduction and default partitioner.
 
Partitioner::task_partition_type my_partition
 
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
 
start_reduce(start_reduce &parent_, const Range &r, depth_t d)
Construct right child from the given range as response to the demand.
 
T itt_load_word_with_acquire(const tbb::atomic< T > &src)
 
finish_reduce(reduction_context context_)
 
bool has_right_zombie
Pointer to body, or NULL if the left child has not yet finished.
 
void operator()(Range &range)
 
Identifiers declared inside namespace internal should never be used directly by client code.
 
internal::affinity_id affinity_id
An id as used for specifying affinity.
 
task &__TBB_EXPORTED_METHOD allocate(size_t size) const
 
task * execute() __TBB_override
Should be overridden by derived classes.
 
void offer_work(typename Partitioner::split_type &split_obj)
spawn right task, serves as callback for partitioner
 
task &__TBB_EXPORTED_METHOD allocate(size_t size) const