32 #ifndef _GLIBCXX_PARALLEL_QUICKSORT_H 
   33 #define _GLIBCXX_PARALLEL_QUICKSORT_H 1 
   49   template<
typename _RAIter, 
typename _Compare>
 
   50     typename std::iterator_traits<_RAIter>::difference_type
 
   52                   _Compare __comp, 
typename std::iterator_traits
 
   53                   <_RAIter>::difference_type __pivot_rank,
 
   54                   typename std::iterator_traits
 
   55                   <_RAIter>::difference_type
 
   58       typedef std::iterator_traits<_RAIter> _TraitsType;
 
   59       typedef typename _TraitsType::value_type _ValueType;
 
   60       typedef typename _TraitsType::difference_type _DifferenceType;
 
   62       _DifferenceType __n = __end - __begin;
 
   63       __num_samples = 
std::min(__num_samples, __n);
 
   66       _ValueType* __samples = 
static_cast<_ValueType*
> 
   67     (::operator 
new(__num_samples * 
sizeof(_ValueType)));
 
   69       for (_DifferenceType __s = 0; __s < __num_samples; ++__s)
 
   71           const unsigned long long __index = 
static_cast<unsigned long long> 
   72         (__s) * __n / __num_samples;
 
   73           ::new(&(__samples[__s])) _ValueType(__begin[__index]);
 
   76       __gnu_sequential::sort(__samples, __samples + __num_samples, __comp);
 
   78       _ValueType& __pivot = __samples[__pivot_rank * __num_samples / __n];
 
   81         __pred(__comp, __pivot);
 
   83                              __pred, __num_threads);
 
   85       for (_DifferenceType __s = 0; __s < __num_samples; ++__s)
 
   86     __samples[__s].~_ValueType();
 
   87       ::operator 
delete(__samples);
 
   99   template<
typename _RAIter, 
typename _Compare>
 
  105       typedef std::iterator_traits<_RAIter> _TraitsType;
 
  106       typedef typename _TraitsType::value_type _ValueType;
 
  107       typedef typename _TraitsType::difference_type _DifferenceType;
 
  109       if (__num_threads <= 1)
 
  111           __gnu_sequential::sort(__begin, __end, __comp);
 
  115       _DifferenceType __n = __end - __begin, __pivot_rank;
 
  122       if ((__num_threads % 2) == 1)
 
  123         __num_threads_left = __num_threads / 2 + 1;
 
  125         __num_threads_left = __num_threads / 2;
 
  127       __pivot_rank = __n * __num_threads_left / __num_threads;
 
  130     (__begin, __end, __comp, __pivot_rank,
 
  133 #pragma omp parallel sections num_threads(2) 
  137                    __comp, __num_threads_left);
 
  140                    __comp, __num_threads - __num_threads_left);
 
  152   template<
typename _RAIter, 
typename _Compare>
 
  160       typedef std::iterator_traits<_RAIter> _TraitsType;
 
  161       typedef typename _TraitsType::value_type _ValueType;
 
  162       typedef typename _TraitsType::difference_type _DifferenceType;
 
  164       _DifferenceType __n = __end - __begin;
 
  167       if (__num_threads > __n)
 
  171         __begin, __begin + __n, __comp, __num_threads);
 
End-user include file. Provides advanced settings and tuning options. This file is a GNU parallel ext...
Similar to std::binder2nd, but giving the argument types explicitly. 
uint16_t _ThreadIndex
Unsigned integer to index a thread number. The maximum thread number (for each processor) must fit in...
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does. 
Parallel implementation of std::partition(), std::nth_element(), and std::partial_sort(). This file is a GNU parallel extension to the Standard C++ Library. 
void __parallel_sort_qs(_RAIter __begin, _RAIter __end, _Compare __comp, _ThreadIndex __num_threads)
Unbalanced quicksort main call. 
GNU parallel code for public use. 
static const _Settings & get()
Get the global settings. 
std::iterator_traits< _RAIter >::difference_type __parallel_sort_qs_divide(_RAIter __begin, _RAIter __end, _Compare __comp, typename std::iterator_traits< _RAIter >::difference_type __pivot_rank, typename std::iterator_traits< _RAIter >::difference_type __num_samples, _ThreadIndex __num_threads)
Unbalanced quicksort divide step. 
std::iterator_traits< _RAIter >::difference_type __parallel_partition(_RAIter __begin, _RAIter __end, _Predicate __pred, _ThreadIndex __num_threads)
Parallel implementation of std::partition. 
void __parallel_sort_qs_conquer(_RAIter __begin, _RAIter __end, _Compare __comp, _ThreadIndex __num_threads)
Unbalanced quicksort conquer step. 
#define _GLIBCXX_CALL(__n)
Macro to produce log message when entering a function.