This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH][libstdc++-v3 parallel mode] random_shuffle fixes
- From: Johannes Singler <singler at ira dot uka dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 05 Jun 2008 10:29:09 +0200
- Subject: [PATCH][libstdc++-v3 parallel mode] random_shuffle fixes
Fixes two small things in parallel random_shuffle.
Tested x86_64-unknown-linux-gnu: No regressions
Please approve for mainline and gcc-4_3-branch.
2008-06-05 Johannes Singler <singler@ira.uka.de>
* include/parallel/random_shuffle.h:
(parallel_random_shuffle_drs) Get the actual number of
threads after entering the parallel region. Indentation.
* include/parallel/algo.h: (random_shuffle(begin, end))
Add namespace qualification to avoid ambiguity.
Johannes
Index: include/parallel/random_shuffle.h
===================================================================
--- include/parallel/random_shuffle.h (revision 136359)
+++ include/parallel/random_shuffle.h (working copy)
@@ -333,6 +333,7 @@
# pragma omp parallel num_threads(num_threads)
{
+ thread_index_t num_threads = omp_get_num_threads();
# pragma omp single
{
pus = new DRSSorterPU<RandomAccessIterator, random_number>
@@ -375,9 +376,9 @@
}
starts[num_threads] = start;
} //single
- // Now shuffle in parallel.
- parallel_random_shuffle_drs_pu(pus);
- }
+ // Now shuffle in parallel.
+ parallel_random_shuffle_drs_pu(pus);
+ } // parallel
delete[] starts;
delete[] sd.bin_proc;
Index: include/parallel/algo.h
===================================================================
--- include/parallel/algo.h (revision 136359)
+++ include/parallel/algo.h (working copy)
@@ -1647,7 +1647,7 @@
{
c_rand_number<> r;
// Parallelization still possible.
- random_shuffle(begin, end, r);
+ __gnu_parallel::random_shuffle(begin, end, r);
}
// Parallel algorithm for random access iterators.