From 707843a2bae5fbb253ea60bea451866bcc8d9b23 Mon Sep 17 00:00:00 2001 From: singler Date: Thu, 5 Jun 2008 15:47:17 +0000 Subject: [PATCH] 2008-06-05 Johannes Singler * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136406 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/parallel/algo.h | 2 +- libstdc++-v3/include/parallel/random_shuffle.h | 7 ++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d06e303..0f2e56c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2008-06-05 Johannes Singler + + * 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. + 2008-06-04 Benjamin Kosnik * include/ext/pb_ds/assoc_container.hpp: Change allocator typedef diff --git a/libstdc++-v3/include/parallel/algo.h b/libstdc++-v3/include/parallel/algo.h index 397d7cb..4aa4d8a 100644 --- a/libstdc++-v3/include/parallel/algo.h +++ b/libstdc++-v3/include/parallel/algo.h @@ -1649,7 +1649,7 @@ namespace __parallel { 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. diff --git a/libstdc++-v3/include/parallel/random_shuffle.h b/libstdc++-v3/include/parallel/random_shuffle.h index 75d9e18..1f7cc10 100644 --- a/libstdc++-v3/include/parallel/random_shuffle.h +++ b/libstdc++-v3/include/parallel/random_shuffle.h @@ -333,6 +333,7 @@ template # pragma omp parallel num_threads(num_threads) { + thread_index_t num_threads = omp_get_num_threads(); # pragma omp single { pus = new DRSSorterPU @@ -375,9 +376,9 @@ template } 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; -- 2.7.4