33 #ifndef _GLIBCXX_PARALLEL_OMP_LOOP_H
34 #define _GLIBCXX_PARALLEL_OMP_LOOP_H 1
42 namespace __gnu_parallel
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;