33 #ifndef _GLIBCXX_PARALLEL_OMP_LOOP_H
34 #define _GLIBCXX_PARALLEL_OMP_LOOP_H 1
42 namespace __gnu_parallel
61 template<
typename RandomAccessIterator,
68 RandomAccessIterator end,
69 Op o, Fu& f, Red r, Result base,
72 <RandomAccessIterator>::
73 difference_type bound)
76 std::iterator_traits<RandomAccessIterator>::difference_type
79 difference_type length = end - begin;
81 __gnu_parallel::min<difference_type>(get_max_threads(), length);
83 Result *thread_results;
85 # pragma omp parallel num_threads(num_threads)
89 num_threads = omp_get_num_threads();
90 thread_results =
new Result[num_threads];
93 thread_results[i] = Result();
98 # pragma omp for schedule(dynamic, _Settings::get().workstealing_chunk_size)
99 for (difference_type pos = 0; pos < length; ++pos)
100 thread_results[iam] =
101 r(thread_results[iam], f(o, begin+pos));
105 output = r(output, thread_results[i]);
107 delete [] thread_results;
111 f.finish_iterator = begin + length;
uint16 thread_index_t
Unsigned integer to index a thread number. The maximum thread number (for each processor) must fit in...
Runtime settings and tuning parameters, heuristics to decide whether to use parallelized algorithms...
Sequential helper functions. This file is a GNU parallel extension to the Standard C++ Library...
Op for_each_template_random_access_omp_loop(RandomAccessIterator begin, RandomAccessIterator end, Op o, Fu &f, Red r, Result base, Result &output, typename std::iterator_traits< RandomAccessIterator >::difference_type bound)
Embarrassingly parallel algorithm for random access iterators, using an OpenMP for loop...
Includes the original header files concerned with iterators except for stream iterators. This file is a GNU parallel extension to the Standard C++ Library.