33 #ifndef _GLIBCXX_PARALLEL_OMP_LOOP_H
34 #define _GLIBCXX_PARALLEL_OMP_LOOP_H 1
61 template<
typename _RAIter,
68 _Op __o, _Fu& __f, _Red __r,
71 typename std::iterator_traits<_RAIter>::difference_type __bound)
73 typedef typename std::iterator_traits<_RAIter>::difference_type
76 _DifferenceType __length = __end - __begin;
77 _ThreadIndex __num_threads = __gnu_parallel::min<_DifferenceType>
78 (__get_max_threads(), __length);
80 _Result *__thread_results;
82 # pragma omp parallel num_threads(__num_threads)
86 __num_threads = omp_get_num_threads();
87 __thread_results =
new _Result[__num_threads];
90 __thread_results[__i] = _Result();
95 #pragma omp for schedule(dynamic, _Settings::get().workstealing_chunk_size)
96 for (_DifferenceType __pos = 0; __pos < __length; ++__pos)
97 __thread_results[__iam] = __r(__thread_results[__iam],
98 __f(__o, __begin+__pos));
102 __output = __r(__output, __thread_results[__i]);
104 delete [] __thread_results;
108 __f._M_finish_iterator = __begin + __length;
_Op __for_each_template_random_access_omp_loop(_RAIter __begin, _RAIter __end, _Op __o, _Fu &__f, _Red __r, _Result __base, _Result &__output, typename std::iterator_traits< _RAIter >::difference_type __bound)
Embarrassingly parallel algorithm for random access iterators, using an OpenMP for loop...
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
GNU parallel code for public use.
Sequential helper functions. This file is a GNU parallel extension to the Standard C++ Library...
uint16_t _ThreadIndex
Unsigned integer to index a thread number. The maximum thread number (for each processor) must fit in...
Includes the original header files concerned with iterators except for stream iterators. This file is a GNU parallel extension to the Standard C++ Library.
Runtime settings and tuning parameters, heuristics to decide whether to use parallelized algorithms...