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>
50 my_partition.note_affinity(
id );
55 start_for(
const Range& range,
const Body& body, Partitioner& partitioner ) :
58 my_partition(partitioner)
65 my_range(parent_.my_range, split_obj),
66 my_body(parent_.my_body),
67 my_partition(parent_.my_partition, split_obj)
69 my_partition.set_affinity(*
this);
76 my_body(parent_.my_body),
77 my_partition(parent_.my_partition,
split())
79 my_partition.set_affinity(*
this);
80 my_partition.align_depth( d );
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>
154 template<
typename Function,
typename Index>
161 : my_func(_func), my_begin(_begin), my_step(_step) {}
168 Index k = my_begin + b*ms;
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>
278 else if (last > first) {
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>
345 else if (last > first) {
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>
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
Base class for types that should not be assigned.
internal::affinity_id affinity_id
An id as used for specifying affinity.
task * execute() __TBB_override
execute task for parallel_for
Partitioner::task_partition_type my_partition
void operator()(const tbb::blocked_range< Index > &r) const
auto last(Container &c) -> decltype(begin(c))
const_iterator end() const
One past last value in range.
void parallel_for(const Range &range, const Body &body)
Parallel iteration over range with default partitioner.
start_for(start_for &parent_, typename Partitioner::split_type &split_obj)
Splitting constructor used to generate children.
void set_ref_count(int count)
Set reference count.
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.
static void fgt_alg_end_body(void *)
#define __TBB_DEFAULT_PARTITIONER
static void run(const Range &range, const Body &body, Partitioner &partitioner)
void offer_work(typename Partitioner::split_type &split_obj)
spawn right task, serves as callback for partitioner
auto first(Container &c) -> decltype(begin(c))
void note_affinity(affinity_id id) __TBB_override
Update affinity info, if any.
Task type used in parallel_for.
void * allocate_sibling(task *start_for_task, size_t bytes)
allocate right task with new parent
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
task &__TBB_EXPORTED_METHOD allocate(size_t size) const
internal::allocate_continuation_proxy & allocate_continuation()
Returns proxy for overloaded new that allocates a continuation task of *this.
static void fgt_algorithm(string_index, void *, void *)
task_group_context * context()
This method is deprecated and will be removed in the future.
static void fgt_end_algorithm(void *)
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)
void parallel_for_impl(Index first, Index last, Index step, const Function &f, Partitioner &partitioner, tbb::task_group_context &context)
Implementation of parallel iteration over stepped range of integers with explicit step...
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
static void fgt_begin_algorithm(string_index, void *)
void set_parent(task *p)
sets parent task pointer to specified value
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
void offer_work(const Range &r, depth_t d=0)
spawn right task, serves as callback for partitioner
static internal::allocate_root_proxy allocate_root()
Returns proxy for overloaded new that allocates a root task.
A range over which to iterate.
static void spawn_root_and_wait(task &root)
Spawn task allocated by allocate_root, wait for it to complete, and deallocate it.
parallel_for_body(const Function &_func, Index &_begin, Index &_step)
Dummy type that distinguishes splitting constructor from copy constructor.
Join task node that contains shared flag for stealing feedback.
Used to form groups of tasks.
Calls the function with values from range [begin, end) with a step provided.
static void fgt_alg_begin_body(string_index, void *, void *)
const_iterator begin() const
Beginning of range.
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.
Base class for user-defined tasks.