17 #ifndef __TBB_SERIAL_parallel_for_H 18 #define __TBB_SERIAL_parallel_for_H 22 #ifndef __TBB_NORMAL_EXECUTION 27 #if TBB_USE_EXCEPTIONS 37 namespace interface9 {
41 template<
typename Range,
typename Body,
typename Partitioner >
49 start_for(
const Range& range,
const Body& body, Partitioner& partitioner ) :
66 static void run(
const Range& range,
const Body& body, Partitioner& partitioner ) {
67 if( !range.empty() ) {
68 ANNOTATE_SITE_BEGIN( tbb_parallel_for );
73 ANNOTATE_SITE_END( tbb_parallel_for );
78 template<
typename Range,
typename Body,
typename Partitioner >
80 if( !my_range.is_divisible() || !my_partition.is_divisible() ) {
81 ANNOTATE_TASK_BEGIN( tbb_parallel_for_range );
85 ANNOTATE_TASK_END( tbb_parallel_for_range );
87 typename Partitioner::split_type split_obj;
96 template<
typename Range,
typename Body>
103 template<
typename Range,
typename Body>
110 template<
typename Range,
typename Body>
117 template<
typename Range,
typename Body>
124 template<
typename Range,
typename Body>
130 template <
typename Index,
typename Function,
typename Partitioner>
133 #if TBB_USE_EXCEPTIONS 134 throw std::invalid_argument(
"nonpositive_step" );
136 std::cerr <<
"nonpositive step in a call to parallel_for" << std::endl;
141 ANNOTATE_SITE_BEGIN( tbb_parallel_for );
142 for( Index i =
first; i <
last; i = i + step ) {
143 ANNOTATE_TASK_BEGIN( tbb_parallel_for_iteration );
145 ANNOTATE_TASK_END( tbb_parallel_for_iteration );
147 ANNOTATE_SITE_END( tbb_parallel_for );
152 template <
typename Index,
typename Function>
157 template <
typename Index,
typename Function>
159 parallel_for_impl<Index,Function,const simple_partitioner>(
first,
last, step, f,
p);
162 template <
typename Index,
typename Function>
164 parallel_for_impl<Index,Function,const auto_partitioner>(
first,
last, step, f,
p);
167 template <
typename Index,
typename Function>
169 parallel_for_impl<Index,Function,const static_partitioner>(
first,
last, step, f,
p);
172 template <
typename Index,
typename Function>
178 template <
typename Index,
typename Function>
183 template <
typename Index,
typename Function>
185 parallel_for_impl<Index,Function,const simple_partitioner>(
first,
last, static_cast<Index>(1), f,
p);
188 template <
typename Index,
typename Function>
190 parallel_for_impl<Index,Function,const auto_partitioner>(
first,
last, static_cast<Index>(1), f,
p);
193 template <
typename Index,
typename Function>
195 parallel_for_impl<Index,Function,const static_partitioner>(
first,
last, static_cast<Index>(1), f,
p);
198 template <
typename Index,
typename Function>
209 #ifndef __TBB_NORMAL_EXECUTION auto last(Container &c) -> decltype(begin(c))
void parallel_for(const Range &range, const Body &body)
Parallel iteration over range with default partitioner.
auto first(Container &c) -> decltype(begin(c))
start_for(start_for &parent_, typename Partitioner::split_type &split_obj)
Splitting constructor used to generate children.
Base class for types that should not be copied or assigned.
#define __TBB_DEFAULT_PARTITIONER
Partitioner::task_partition_type my_partition
void parallel_for_impl(Index first, Index last, Index step, const Function &f, Partitioner &)
Implementation of parallel iteration over stepped range of integers with explicit step and partitione...
void const char const char int ITT_FORMAT __itt_group_sync p
start_for(const Range &range, const Body &body, Partitioner &partitioner)
Constructor for root task.
static void run(const Range &range, const Body &body, Partitioner &partitioner)