149#ifndef __ADS_ParallelSort
150 #define __ADS_ParallelSort
247 class T = std::ranges::range_value_t< std::remove_cvref_t< Store > > ,
248 class C = std::less<> >
249void sort( E & ex , Store && A , C less = C() );
252template< Executor E ,
class T ,
class C = std::less<> >
253void sort( E & ex , std::vector< T > & A , C less = C() );
274 class T = std::ranges::range_value_t< std::remove_cvref_t< Store > > ,
275 class C = std::less<> >
279template< Executor E ,
class T ,
class C = std::less<> >
280void stableSort( E & ex , std::vector< T > & A , C less = C() );
303 VectorKey T = std::ranges::range_value_t< std::remove_cvref_t< Store > > >
307template< Executor E , VectorKey T >
326 VectorKey T = std::ranges::range_value_t< std::remove_cvref_t< Store > > >
330template< Executor E , VectorKey T >
342 requires requires( E & ex ,
343 std::vector< std::ranges::range_value_t< R > > & v ,
345{
sort( ex , v , std::forward< P >( p )... ); }
346decltype( auto )
sort( E & ex , R && A , P &&... p )
348 const auto f = [ & ](
auto & v ) ->
decltype(
auto ) {
349 return(
sort( ex , v , std::forward< P >( p )... ) );
351 return( detail::sortRange( A , f ) );
358template< Executor E , SortRange R ,
class... P >
359 requires requires( E & ex ,
360 std::vector< std::ranges::range_value_t< R > > & v ,
363 stableSort( ex , v , std::forward< P >( p )... );
367 const auto f = [ & ](
auto & v ) ->
decltype(
auto ) {
368 return(
stableSort( ex , v , std::forward< P >( p )... ) );
370 return( detail::sortRange( A , f ) );
377template< Executor E , SortRange R ,
class... P >
378 requires requires( E & ex ,
379 std::vector< std::ranges::range_value_t< R > > & v ,
386 const auto f = [ & ](
auto & v ) ->
decltype(
auto ) {
387 return(
learnedSort( ex , v , std::forward< P >( p )... ) );
389 return( detail::sortRange( A , f ) );
396template< Executor E , SortRange R ,
class... P >
397 requires requires( E & ex ,
398 std::vector< std::ranges::range_value_t< R > > & v ,
405 const auto f = [ & ](
auto & v ) ->
decltype(
auto ) {
408 return( detail::sortRange( A , f ) );
419#include "ADS/parallel/impl/ParallelSort.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The layer of execution of the parallel algorithms of ADS, beyond the book: an executor runs the calls...
An allocator for the large blocks of a structure, beyond the book: a request of at least one huge pag...
The learned sort, beyond the book: learnedSort() distributes the numbers of 32 or 64 bits into bucket...
The parallel merge of sorted ranges, beyond the book: multiwayMerge( ex , R , out ,...
The sorts by the digits of the keys, beyond the book (which has Counting Sort and Pigeonhole Sort,...
The room of the parallel algorithms, beyond the book: the buffers of items that the parallel sorts a...
The sort that chooses its algorithm, beyond the book: sort() and stableSort() look at what they sort ...
The quicksort in the lanes of the vector registers, beyond the book: vectorQuickSort() sorts integers...
the executors, whose bulk( n , f ) runs on their threads and returns when they have returned,...
Definition Executor.h:168
a range that the sorts take beside std::vector and std::span: random access, sized,...
Definition Sorted.h:153
the storage on which the sorts work in place, by reference: a std::vector or a std::span of its items...
Definition Sorted.h:178
the types that vectorQuickSort() sorts: integers and floating point numbers of 32 or 64 bits
Definition VectorQuickSort.h:178
void learnedStableSort(E &ex, Store &&A)
the vector of numbers sorted as learnedSort( ex , A ) sorts it, the equal items in their order ( an...
void sort(E &ex, Store &&A, C less=C())
the vector sorted by less on the threads of ex, not necessarily stable
constexpr std::size_t kParallelSort
the items from which the parallel sorts use more than one thread,
Definition ParallelSort.h:182
void learnedSort(E &ex, Store &&A)
the vector of numbers sorted in their natural order on the threads of ex, distributed by the model o...
void stableSort(E &ex, Store &&A, C less=C())
the vector sorted by less on the threads of ex, the equal items in their order
constexpr std::size_t kParallelSortThreads
the threads from which the parallel sorts distribute: on 2 threads the passes of the distribution cos...
Definition ParallelSort.h:188