17 #ifndef __TBB_parallel_for_H 18 #define __TBB_parallel_for_H 20 #define __TBB_parallel_for_H_include_area 32 namespace interface9 {
41 template<
typename Range,
typename Body,
typename Partitioner>
55 start_for(
const Range& range,
const Body& body, Partitioner& partitioner ) :
83 static void run(
const Range& range,
const Body& body, Partitioner& partitioner ) {
84 if( !range.empty() ) {
85 #if !__TBB_TASK_GROUP_CONTEXT || TBB_JOIN_OUTER_TASK_GROUP 100 #if __TBB_TASK_GROUP_CONTEXT 102 if( !range.empty() ) {
114 fgt_alg_begin_body( tbb::internal::PARALLEL_FOR_TASK, (
void *)const_cast<Body*>(&(this->my_body)), (
void*)
this );
120 void offer_work(
typename Partitioner::split_type& split_obj) {
139 template<
typename Range,
typename Body,
typename Partitioner>
141 my_partition.check_being_stolen( *
this );
142 my_partition.
execute(*
this, my_range);
154 template<
typename Function,
typename Index>
172 #if __TBB_ASSERT_ON_VECTORIZATION_FAILURE 173 #pragma vector always assert 176 for ( Index i = b; i < e; ++i, k += ms ) {
199 template<
typename Range,
typename Body>
206 template<
typename Range,
typename Body>
213 template<
typename Range,
typename Body>
220 template<
typename Range,
typename Body>
227 template<
typename Range,
typename Body>
232 #if __TBB_TASK_GROUP_CONTEXT 235 template<
typename Range,
typename Body>
242 template<
typename Range,
typename Body>
249 template<
typename Range,
typename Body>
256 template<
typename Range,
typename Body>
263 template<
typename Range,
typename Body>
270 namespace strict_ppl {
273 template <
typename Index,
typename Function,
typename Partitioner>
280 Index
end = (
last -
first - Index(1)) / step + Index(1);
288 template <
typename Index,
typename Function>
293 template <
typename Index,
typename Function>
295 parallel_for_impl<Index,Function,const simple_partitioner>(
first,
last, step, f, partitioner);
298 template <
typename Index,
typename Function>
300 parallel_for_impl<Index,Function,const auto_partitioner>(
first,
last, step, f, partitioner);
303 template <
typename Index,
typename Function>
305 parallel_for_impl<Index,Function,const static_partitioner>(
first,
last, step, f, partitioner);
308 template <
typename Index,
typename Function>
314 template <
typename Index,
typename Function>
319 template <
typename Index,
typename Function>
321 parallel_for_impl<Index,Function,const simple_partitioner>(
first,
last, static_cast<Index>(1), f, partitioner);
324 template <
typename Index,
typename Function>
326 parallel_for_impl<Index,Function,const auto_partitioner>(
first,
last, static_cast<Index>(1), f, partitioner);
329 template <
typename Index,
typename Function>
331 parallel_for_impl<Index,Function,const static_partitioner>(
first,
last, static_cast<Index>(1), f, partitioner);
334 template <
typename Index,
typename Function>
339 #if __TBB_TASK_GROUP_CONTEXT 340 template <
typename Index,
typename Function,
typename Partitioner>
347 Index
end = (
last -
first - Index(1)) / step + Index(1);
355 template <
typename Index,
typename Function>
360 template <
typename Index,
typename Function>
362 parallel_for_impl<Index,Function,const simple_partitioner>(
first,
last, step, f, partitioner, context);
365 template <
typename Index,
typename Function>
367 parallel_for_impl<Index,Function,const auto_partitioner>(
first,
last, step, f, partitioner, context);
370 template <
typename Index,
typename Function>
372 parallel_for_impl<Index,Function,const static_partitioner>(
first,
last, step, f, partitioner, context);
375 template <
typename Index,
typename Function>
382 template <
typename Index,
typename Function>
384 parallel_for_impl<Index,Function,const auto_partitioner>(
first,
last, static_cast<Index>(1), f,
auto_partitioner(), context);
387 template <
typename Index,
typename Function>
389 parallel_for_impl<Index,Function,const simple_partitioner>(
first,
last, static_cast<Index>(1), f, partitioner, context);
392 template <
typename Index,
typename Function>
394 parallel_for_impl<Index,Function,const auto_partitioner>(
first,
last, static_cast<Index>(1), f, partitioner, context);
397 template <
typename Index,
typename Function>
399 parallel_for_impl<Index,Function,const static_partitioner>(
first,
last, static_cast<Index>(1), f, partitioner, context);
402 template <
typename Index,
typename Function>
416 #if TBB_PREVIEW_SERIAL_SUBSET 417 #define __TBB_NORMAL_EXECUTION 418 #include "../serial/tbb/parallel_for.h" 419 #undef __TBB_NORMAL_EXECUTION 423 #undef __TBB_parallel_for_H_include_area 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 __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp end
Join task node that contains shared flag for stealing feedback.
Used to form groups of tasks.
start_for(start_for &parent_, typename Partitioner::split_type &split_obj)
Splitting constructor used to generate children.
Base class for user-defined tasks.
task * execute() __TBB_override
execute task for parallel_for
static void run(const Range &range, const Body &body, Partitioner &partitioner)
void set_parent(task *p)
sets parent task pointer to specified value
Partitioner::task_partition_type my_partition
parallel_for_body(const Function &_func, Index &_begin, Index &_step)
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
void parallel_for(const Range &range, const Body &body)
Parallel iteration over range with default partitioner.
Base class for types that should not be assigned.
start_for(start_for &parent_, const Range &r, depth_t d)
Construct right child from the given range as response to the demand.
void run_body(Range &r)
Run body for range, serves as callback for partitioner.
#define __TBB_DEFAULT_PARTITIONER
auto last(Container &c) -> decltype(begin(c))
static void fgt_algorithm(string_index, void *, void *)
void operator()(const tbb::blocked_range< Index > &r) const
void parallel_for(Index first, Index last, Index step, const Function &f)
Parallel iteration over a range of integers with a step provided and default partitioner.
static void run(const Range &range, const Body &body, Partitioner &partitioner, task_group_context &context)
static internal::allocate_root_proxy allocate_root()
Returns proxy for overloaded new that allocates a root task.
static void fgt_alg_begin_body(string_index, void *, void *)
start_for(const Range &range, const Body &body, Partitioner &partitioner)
Constructor for root task.
internal::allocate_child_proxy & allocate_child()
Returns proxy for overloaded new that allocates a child task of *this.
const_iterator begin() const
Beginning of range.
task_group_context * context()
This method is deprecated and will be removed in the future.
static void fgt_alg_end_body(void *)
static void fgt_end_algorithm(void *)
static void spawn_root_and_wait(task &root)
Spawn task allocated by allocate_root, wait for it to complete, and deallocate it.
void offer_work(typename Partitioner::split_type &split_obj)
spawn right task, serves as callback for partitioner
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
void note_affinity(affinity_id id) __TBB_override
Update affinity info, if any.
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 * task
Dummy type that distinguishes splitting constructor from copy constructor.
void set_ref_count(int count)
Set reference count.
Calls the function with values from range [begin, end) with a step provided.
auto first(Container &c) -> decltype(begin(c))
A range over which to iterate.
Task type used in parallel_for.
void parallel_for_impl(Index first, Index last, Index step, const Function &f, Partitioner &partitioner)
Implementation of parallel iteration over stepped range of integers with explicit step and partitione...
const_iterator end() const
One past last value in range.
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
void offer_work(const Range &r, depth_t d=0)
spawn right task, serves as callback for partitioner
static void fgt_begin_algorithm(string_index, void *)
internal::affinity_id affinity_id
An id as used for specifying affinity.
task &__TBB_EXPORTED_METHOD allocate(size_t size) const