17 #include "../../tbb/internal/_deprecated_header_message_guard.h" 19 #if !defined(__TBB_show_deprecation_message_parallel_for_H) && defined(__TBB_show_deprecated_header_message) 20 #define __TBB_show_deprecation_message_parallel_for_H 21 #pragma message("TBB Warning: serial/tbb/parallel_for.h is deprecated. For details, please see Deprecated Features appendix in the TBB reference manual.") 24 #if defined(__TBB_show_deprecated_header_message) 25 #undef __TBB_show_deprecated_header_message 28 #ifndef __TBB_SERIAL_parallel_for_H 29 #define __TBB_SERIAL_parallel_for_H 33 #ifndef __TBB_NORMAL_EXECUTION 38 #if TBB_USE_EXCEPTIONS 48 namespace interface9 {
52 template<
typename Range,
typename Body,
typename Partitioner >
60 start_for(
const Range& range,
const Body& body, Partitioner& partitioner ) :
77 static void run(
const Range& range,
const Body& body, Partitioner& partitioner ) {
78 if( !range.empty() ) {
79 ANNOTATE_SITE_BEGIN( tbb_parallel_for );
84 ANNOTATE_SITE_END( tbb_parallel_for );
89 template<
typename Range,
typename Body,
typename Partitioner >
91 if( !my_range.is_divisible() || !my_partition.is_divisible() ) {
92 ANNOTATE_TASK_BEGIN( tbb_parallel_for_range );
96 ANNOTATE_TASK_END( tbb_parallel_for_range );
98 typename Partitioner::split_type split_obj;
107 template<
typename Range,
typename Body>
114 template<
typename Range,
typename Body>
121 template<
typename Range,
typename Body>
128 template<
typename Range,
typename Body>
135 template<
typename Range,
typename Body>
141 template <
typename Index,
typename Function,
typename Partitioner>
144 #if TBB_USE_EXCEPTIONS 145 throw std::invalid_argument(
"nonpositive_step" );
147 std::cerr <<
"nonpositive step in a call to parallel_for" << std::endl;
152 ANNOTATE_SITE_BEGIN( tbb_parallel_for );
153 for( Index i =
first; i <
last; i = i + step ) {
154 ANNOTATE_TASK_BEGIN( tbb_parallel_for_iteration );
156 ANNOTATE_TASK_END( tbb_parallel_for_iteration );
158 ANNOTATE_SITE_END( tbb_parallel_for );
163 template <
typename Index,
typename Function>
168 template <
typename Index,
typename Function>
170 parallel_for_impl<Index,Function,const simple_partitioner>(
first,
last, step, f,
p);
173 template <
typename Index,
typename Function>
175 parallel_for_impl<Index,Function,const auto_partitioner>(
first,
last, step, f,
p);
178 template <
typename Index,
typename Function>
180 parallel_for_impl<Index,Function,const static_partitioner>(
first,
last, step, f,
p);
183 template <
typename Index,
typename Function>
189 template <
typename Index,
typename Function>
194 template <
typename Index,
typename Function>
196 parallel_for_impl<Index,Function,const simple_partitioner>(
first,
last, static_cast<Index>(1), f,
p);
199 template <
typename Index,
typename Function>
201 parallel_for_impl<Index,Function,const auto_partitioner>(
first,
last, static_cast<Index>(1), f,
p);
204 template <
typename Index,
typename Function>
206 parallel_for_impl<Index,Function,const static_partitioner>(
first,
last, static_cast<Index>(1), f,
p);
209 template <
typename Index,
typename Function>
220 #ifndef __TBB_NORMAL_EXECUTION __TBB_DEPRECATED_IN_VERBOSE_MODE void parallel_for(const Range &range, const Body &body)
Parallel iteration over range with default partitioner.
static void run(const Range &range, const Body &body, Partitioner &partitioner)
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...
#define __TBB_DEPRECATED_IN_VERBOSE_MODE
#define __TBB_DEFAULT_PARTITIONER
auto last(Container &c) -> decltype(begin(c))
start_for(start_for &parent_, typename Partitioner::split_type &split_obj)
Splitting constructor used to generate children.
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.
Base class for types that should not be copied or assigned.
auto first(Container &c) -> decltype(begin(c))
Partitioner::task_partition_type my_partition