Commit 26e02053 by Johannes Singler Committed by Johannes Singler

random_shuffle.h (__parallel_random_shuffle_drs): Take as many threads as possible, i.

2010-03-30  Johannes Singler  <singler@kit.edu>

        * include/parallel/random_shuffle.h
        (__parallel_random_shuffle_drs) : Take as many threads as
        possible, i. e. favor parallelism over cache efficiency.
        Use own PRNG also for the 1 thread case.

From-SVN: r157826
parent a3e7e012
2010-03-30 Johannes Singler <singler@kit.edu>
* include/parallel/random_shuffle.h
(__parallel_random_shuffle_drs) : Take as many threads as
possible, i. e. favor parallelism over cache efficiency.
Use own PRNG also for the 1 thread case.
2010-03-30 Paolo Carlini <paolo.carlini@oracle.com> 2010-03-30 Paolo Carlini <paolo.carlini@oracle.com>
* include/debug/unordered_map: Clean-up includes and guards. * include/debug/unordered_map: Clean-up includes and guards.
......
...@@ -322,10 +322,16 @@ namespace __gnu_parallel ...@@ -322,10 +322,16 @@ namespace __gnu_parallel
} }
#endif #endif
__num_threads = std::min<_BinIndex>(__num_threads, __num_bins); __num_bins = __round_up_to_pow2(
std::max<_BinIndex>(__num_threads, __num_bins));
if (__num_threads <= 1) if (__num_threads <= 1)
return __sequential_random_shuffle(__begin, __end, __rng); {
_RandomNumber __derived_rng(
__rng(std::numeric_limits<uint32_t>::max()));
__sequential_random_shuffle(__begin, __end, __derived_rng);
return;
}
_DRandomShufflingGlobalData<_RAIter> __sd(__begin); _DRandomShufflingGlobalData<_RAIter> __sd(__begin);
_DRSSorterPU<_RAIter, _RandomNumber >* __pus; _DRSSorterPU<_RAIter, _RandomNumber >* __pus;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment