Intel(R) Threading Building Blocks Doxygen Documentation version 4.2.3
parallel_for_each.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2005-2020 Intel Corporation
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef __TBB_parallel_for_each_H
18#define __TBB_parallel_for_each_H
19
20#include "parallel_do.h"
21#include "parallel_for.h"
22
23namespace tbb {
24
26namespace internal {
27 // The class calls user function in operator()
28 template <typename Function, typename Iterator>
30 const Function &my_func;
31 public:
32 parallel_for_each_body_do(const Function &_func) : my_func(_func) {}
33
34 void operator()(typename std::iterator_traits<Iterator>::reference value) const {
36 }
37 };
38
39 // The class calls user function in operator()
40 template <typename Function, typename Iterator>
42 const Function &my_func;
43 public:
44 parallel_for_each_body_for(const Function &_func) : my_func(_func) {}
45
47#if __INTEL_COMPILER
48#pragma ivdep
49#endif
50 for(Iterator it = range.begin(), end = range.end(); it != end; ++it) {
51 my_func(*it);
52 }
53 }
54 };
55
56 template<typename Iterator, typename Function, typename Generic>
58#if __TBB_TASK_GROUP_CONTEXT
59 static void doit(Iterator first, Iterator last, const Function& f, task_group_context &context) {
61 tbb::parallel_do(first, last, body, context);
62 }
63#endif
64 static void doit(Iterator first, Iterator last, const Function& f) {
67 }
68 };
69 template<typename Iterator, typename Function>
70 struct parallel_for_each_impl<Iterator, Function, std::random_access_iterator_tag> {
71#if __TBB_TASK_GROUP_CONTEXT
72 static void doit(Iterator first, Iterator last, const Function& f, task_group_context &context) {
75 }
76#endif
77 static void doit(Iterator first, Iterator last, const Function& f) {
80 }
81 };
82} // namespace internal
84
89
90#if __TBB_TASK_GROUP_CONTEXT
91template<typename Iterator, typename Function>
92void parallel_for_each(Iterator first, Iterator last, const Function& f, task_group_context &context) {
94}
95
97
98template<typename Range, typename Function>
99void parallel_for_each(Range& rng, const Function& f, task_group_context& context) {
101}
102
104
105template<typename Range, typename Function>
106void parallel_for_each(const Range& rng, const Function& f, task_group_context& context) {
108}
109#endif /* __TBB_TASK_GROUP_CONTEXT */
110
112template<typename Iterator, typename Function>
113void parallel_for_each(Iterator first, Iterator last, const Function& f) {
115}
116
118template<typename Range, typename Function>
119void parallel_for_each(Range& rng, const Function& f) {
121}
122
124template<typename Range, typename Function>
125void parallel_for_each(const Range& rng, const Function& f) {
127}
128
130
131} // namespace
132
133#endif /* __TBB_parallel_for_each_H */
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
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 ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
void parallel_do(Iterator first, Iterator last, const Body &body)
Parallel iteration over a range, with optional addition of more work.
Definition: parallel_do.h:497
void parallel_for(const Range &range, const Body &body)
Parallel iteration over range with default partitioner.
void parallel_for_each(Iterator first, Iterator last, const Function &f, task_group_context &context)
Calls function f for all items from [first, last) interval using user-supplied context.
STL namespace.
The graph class.
auto last(Container &c) -> decltype(begin(c))
auto first(Container &c) -> decltype(begin(c))
A range over which to iterate.
Definition: blocked_range.h:45
const_iterator begin() const
Beginning of range.
Definition: blocked_range.h:69
const_iterator end() const
One past last value in range.
Definition: blocked_range.h:72
void operator()(typename std::iterator_traits< Iterator >::reference value) const
parallel_for_each_body_do(const Function &_func)
parallel_for_each_body_for(const Function &_func)
void operator()(tbb::blocked_range< Iterator > range) const
static void doit(Iterator first, Iterator last, const Function &f, task_group_context &context)
static void doit(Iterator first, Iterator last, const Function &f)
static void doit(Iterator first, Iterator last, const Function &f, task_group_context &context)
Used to form groups of tasks.
Definition: task.h:358
Base class for types that should not be assigned.
Definition: tbb_stddef.h:322

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.