From 5d336e9db5f25bb5872b262e3bfec41b95106531 Mon Sep 17 00:00:00 2001 From: Johannes Singler Date: Thu, 5 Jun 2008 15:45:10 +0000 Subject: [PATCH] random_shuffle.h: (parallel_random_shuffle_drs) Get the actual number of threads after entering... 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. From-SVN: r136405 --- 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 b7e06c5ef24..b73c082f302 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-05-15 Johannes Singler * doc/xml/manual/parallel_mode.xml: diff --git a/libstdc++-v3/include/parallel/algo.h b/libstdc++-v3/include/parallel/algo.h index e836b284fd3..8286c50a5cf 100644 --- a/libstdc++-v3/include/parallel/algo.h +++ b/libstdc++-v3/include/parallel/algo.h @@ -1647,7 +1647,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 75d9e18d23a..1f7cc10742d 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;