Commit d95ba652 by Johannes Singler Committed by Johannes Singler

partition.h (__parallel_partition): Correctly initialize chunk size.

2009-11-19  Johannes Singler  <singler@kit.edu>

        * include/parallel/partition.h (__parallel_partition): Correctly
        initialize chunk size.
        (__parallel_nth_element): Respect nth_element_minimal_n.  Use
        sequential nth_element as base case, instead of sequential sort.

From-SVN: r154333
parent b66a1bac
2009-11-19 Johannes Singler <singler@kit.edu>
* include/parallel/partition.h (__parallel_partition): Correctly
initialize chunk size.
(__parallel_nth_element): Respect nth_element_minimal_n. Use
sequential nth_element as base case, instead of sequential sort.
2009-11-17 Benjamin Kosnik <bkoz@redhat.com> 2009-11-17 Benjamin Kosnik <bkoz@redhat.com>
* include/profile/impl/profiler.h: Remove namespace markup. * include/profile/impl/profiler.h: Remove namespace markup.
......
...@@ -73,7 +73,7 @@ namespace __gnu_parallel ...@@ -73,7 +73,7 @@ namespace __gnu_parallel
bool* __reserved_left = NULL, * __reserved_right = NULL; bool* __reserved_left = NULL, * __reserved_right = NULL;
_DifferenceType __chunk_size; _DifferenceType __chunk_size = __s.partition_chunk_size;
omp_lock_t __result_lock; omp_lock_t __result_lock;
omp_init_lock(&__result_lock); omp_init_lock(&__result_lock);
...@@ -345,8 +345,9 @@ namespace __gnu_parallel ...@@ -345,8 +345,9 @@ namespace __gnu_parallel
_RAIter __split; _RAIter __split;
_RandomNumber __rng; _RandomNumber __rng;
_DifferenceType __minimum_length = const _Settings& __s = _Settings::get();
std::max<_DifferenceType>(2, _Settings::get().partition_minimal_n); _DifferenceType __minimum_length = std::max<_DifferenceType>(2,
std::max(__s.nth_element_minimal_n, __s.partition_minimal_n));
// Break if input range to small. // Break if input range to small.
while (static_cast<_SequenceIndex>(__end - __begin) >= __minimum_length) while (static_cast<_SequenceIndex>(__end - __begin) >= __minimum_length)
...@@ -412,7 +413,7 @@ namespace __gnu_parallel ...@@ -412,7 +413,7 @@ namespace __gnu_parallel
} }
// Only at most _Settings::partition_minimal_n __elements __left. // Only at most _Settings::partition_minimal_n __elements __left.
__gnu_sequential::sort(__begin, __end, __comp); __gnu_sequential::nth_element(__begin, __nth, __end, __comp);
} }
/** @brief Parallel implementation of std::partial_sort(). /** @brief Parallel implementation of std::partial_sort().
......
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