From: Johannes Singler Date: Thu, 5 Jun 2008 15:47:17 +0000 (+0000) Subject: random_shuffle.h: (parallel_random_shuffle_drs) Get the actual number of threads... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3611e1767daf889bef7de7e867dacfa14527146e;p=gcc.git 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: r136406 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d06e303f343..0f2e56c57a7 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 397d7cbcb4f..4aa4d8af47f 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 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;