This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]