empty()
, size()
, and top()
are intentionally not provided. Calling them would not make sense in a concurrent setting. More...typedef unsigned short __gnu_parallel::bin_index |
Type to hold the index of a bin.
Since many variables of this type are allocated, it should be chosen as small as possible.
Definition at line 53 of file random_shuffle.h.
typedef short __gnu_parallel::int16 |
typedef int __gnu_parallel::int32 |
typedef long long __gnu_parallel::int64 |
typedef int64 __gnu_parallel::lcas_t |
typedef uint16 __gnu_parallel::thread_index_t |
typedef unsigned short __gnu_parallel::uint16 |
typedef unsigned int __gnu_parallel::uint32 |
typedef unsigned long long __gnu_parallel::uint64 |
Run-time equivalents for the compile-time tags.
void __gnu_parallel::calc_borders | ( | RandomAccessIterator | elements, | |
_DifferenceTp | length, | |||
_DifferenceTp * | off | |||
) |
Precalculate advances for Knuth-Morris-Pratt algorithm.
elements | Begin iterator of sequence to search for. | |
length | Length of sequence to search for. | |
advances | Returned offsets. |
Definition at line 58 of file search.h.
Referenced by search_template().
bool __gnu_parallel::compare_and_swap | ( | volatile T * | ptr, | |
T | comparand, | |||
T | replacement | |||
) | [inline] |
Compare *ptr
and comparand
. If equal, let *ptr=replacement
and return true
, return false
otherwise.
Implementation is heavily platform-dependent.
ptr | Pointer to signed integer. | |
comparand | Compare value. | |
replacement | Replacement value. |
Definition at line 333 of file parallel/compatibility.h.
References _GLIBCXX_PARALLEL_ASSERT, compare_and_swap_32(), and compare_and_swap_64().
Referenced by __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::pop_back(), and __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::pop_front().
bool __gnu_parallel::compare_and_swap_32 | ( | volatile int32 * | ptr, | |
int32 | comparand, | |||
int32 | replacement | |||
) | [inline] |
Compare *ptr
and comparand
. If equal, let *ptr=replacement
and return true
, return false
otherwise.
Implementation is heavily platform-dependent.
ptr | Pointer to 32-bit signed integer. | |
comparand | Compare value. | |
replacement | Replacement value. |
Definition at line 241 of file parallel/compatibility.h.
Referenced by compare_and_swap().
bool __gnu_parallel::compare_and_swap_64 | ( | volatile int64 * | ptr, | |
int64 | comparand, | |||
int64 | replacement | |||
) | [inline] |
Compare *ptr
and comparand
. If equal, let *ptr=replacement
and return true
, return false
otherwise.
Implementation is heavily platform-dependent.
ptr | Pointer to 64-bit signed integer. | |
comparand | Compare value. | |
replacement | Replacement value. |
Definition at line 281 of file parallel/compatibility.h.
References _GLIBCXX_PARALLEL_ASSERT.
Referenced by compare_and_swap().
void __gnu_parallel::decode2 | ( | lcas_t | x, | |
int & | a, | |||
int & | b | |||
) | [inline] |
Decode two integers from one __gnu_parallel::lcas_t.
x | __gnu_parallel::lcas_t to decode integers from. | |
a | First integer, to be decoded from the most-significant lcas_t_bits/2 bits of x . | |
b | Second integer, to be encoded in the least-significant lcas_t_bits/2 bits of x . |
Definition at line 143 of file base.h.
References __gnu_cxx::int, lcas_t_bits, and lcas_t_mask.
Referenced by __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::pop_back(), __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::pop_front(), and __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::push_front().
void __gnu_parallel::determine_samples | ( | PMWMSSortingData< RandomAccessIterator > * | sd, | |
_DifferenceTp & | num_samples | |||
) |
Select samples from a sequence.
sd | Pointer to algorithm data. Result will be placed in sd->samples . | |
num_samples | Number of samples to select. |
Definition at line 124 of file multiway_mergesort.h.
References equally_split(), std::get(), __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::num_threads, __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::samples, __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::source, and __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::starts.
Referenced by parallel_sort_mwms_pu().
lcas_t __gnu_parallel::encode2 | ( | int | a, | |
int | b | |||
) | [inline] |
Encode two integers into one __gnu_parallel::lcas_t.
a | First integer, to be encoded in the most-significant lcas_t_bits/2 bits. | |
b | Second integer, to be encoded in the least-significant lcas_t_bits/2 bits. |
a
and b
. Definition at line 129 of file base.h.
References lcas_t_bits.
Referenced by __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::pop_back(), __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::pop_front(), __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::push_front(), and __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::RestrictedBoundedConcurrentQueue().
OutputIterator __gnu_parallel::equally_split | ( | difference_type | n, | |
thread_index_t | num_threads, | |||
OutputIterator | s | |||
) |
Function to split a sequence into parts of almost equal size.
The resulting sequence s of length num_threads+1 contains the splitting positions when splitting the range [0,n) into parts of almost equal size (plus minus 1). The first entry is 0, the last one n. There may result empty parts.
n | Number of elements | |
num_threads | Number of parts | |
s | Splitters |
s+num_threads+1
Definition at line 54 of file equally_split.h.
Referenced by determine_samples(), parallel_multiway_merge(), parallel_partial_sum_linear(), parallel_set_operation(), parallel_unique_copy(), and search_template().
difference_type __gnu_parallel::equally_split_point | ( | difference_type | n, | |
thread_index_t | num_threads, | |||
thread_index_t | thread_no | |||
) |
Function to split a sequence into parts of almost equal size.
Returns the position of the splitting point between thread number thread_no (included) and thread number thread_no+1 (excluded).
n | Number of elements | |
num_threads | Number of parts |
Definition at line 79 of file equally_split.h.
Referenced by for_each_template_random_access_ed().
T __gnu_parallel::fetch_and_add | ( | volatile T * | ptr, | |
T | addend | |||
) | [inline] |
Add a value to a variable, atomically.
Implementation is heavily platform-dependent.
ptr | Pointer to a signed integer. | |
addend | Value to add. |
Definition at line 191 of file parallel/compatibility.h.
References _GLIBCXX_PARALLEL_ASSERT, fetch_and_add_32(), and fetch_and_add_64().
Referenced by __gnu_parallel::RestrictedBoundedConcurrentQueue< std::pairpair< RandomAccessIterator, RandomAccessIterator > >::push_front().
int32 __gnu_parallel::fetch_and_add_32 | ( | volatile int32 * | ptr, | |
int32 | addend | |||
) | [inline] |
Add a value to a variable, atomically.
Implementation is heavily platform-dependent.
ptr | Pointer to a 32-bit signed integer. | |
addend | Value to add. |
Definition at line 101 of file parallel/compatibility.h.
Referenced by fetch_and_add().
int64 __gnu_parallel::fetch_and_add_64 | ( | volatile int64 * | ptr, | |
int64 | addend | |||
) | [inline] |
Add a value to a variable, atomically.
Implementation is heavily platform-dependent.
ptr | Pointer to a 64-bit signed integer. | |
addend | Value to add. |
Definition at line 140 of file parallel/compatibility.h.
References _GLIBCXX_PARALLEL_ASSERT.
Referenced by fetch_and_add().
std::pair<RandomAccessIterator1, RandomAccessIterator2> __gnu_parallel::find_template | ( | RandomAccessIterator1 | begin1, | |
RandomAccessIterator1 | end1, | |||
RandomAccessIterator2 | begin2, | |||
Pred | pred, | |||
Selector | selector | |||
) | [inline] |
Parallel std::find, switch for different algorithms.
begin1 | Begin iterator of first sequence. | |
end1 | End iterator of first sequence. | |
begin2 | Begin iterator of second sequence. Must have same length as first sequence. | |
pred | Find predicate. | |
selector | Functionality (e. g. std::find_if (), std::equal(),...) |
Definition at line 66 of file find.h.
References _GLIBCXX_PARALLEL_ASSERT, __gnu_parallel::_Settings::get(), and std::make_pair().
Referenced by std::__parallel::adjacent_find_switch(), std::__parallel::find_first_of_switch(), std::__parallel::find_if_switch(), std::__parallel::find_switch(), and std::__parallel::mismatch_switch().
UserOp __gnu_parallel::for_each_template_random_access | ( | InputIterator | begin, | |
InputIterator | end, | |||
UserOp | user_op, | |||
Functionality & | functionality, | |||
Red | reduction, | |||
Result | reduction_start, | |||
Result & | output, | |||
typename std::iterator_traits< InputIterator >::difference_type | bound, | |||
_Parallelism | parallelism_tag | |||
) |
Chose the desired algorithm by evaluating parallelism_tag
.
begin | Begin iterator of input sequence. | |
end | End iterator of input sequence. | |
user_op | A user-specified functor (comparator, predicate, associative operator,...) | |
functionality | functor to "process" an element with user_op (depends on desired functionality, e. g. accumulate, for_each,... | |
reduction | Reduction functor. | |
reduction_start | Initial value for reduction. | |
output | Output iterator. | |
bound | Maximum number of elements processed. | |
parallelism_tag | Parallelization method |
Definition at line 67 of file for_each.h.
References for_each_template_random_access_ed(), for_each_template_random_access_omp_loop(), for_each_template_random_access_workstealing(), parallel_omp_loop, parallel_omp_loop_static, and parallel_unbalanced.
Referenced by std::__parallel::accumulate_switch(), std::__parallel::adjacent_difference_switch(), std::__parallel::count_if_switch(), std::__parallel::count_switch(), std::__parallel::for_each_switch(), std::__parallel::generate_switch(), std::__parallel::inner_product_switch(), std::__parallel::max_element_switch(), std::__parallel::min_element_switch(), std::__parallel::replace_if_switch(), std::__parallel::transform1_switch(), and std::__parallel::transform2_switch().
Op __gnu_parallel::for_each_template_random_access_ed | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Op | o, | |||
Fu & | f, | |||
Red | r, | |||
Result | base, | |||
Result & | output, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | bound | |||
) |
Embarrassingly parallel algorithm for random access iterators, using hand-crafted parallelization by equal splitting the work.
begin | Begin iterator of element sequence. | |
end | End iterator of element sequence. | |
o | User-supplied functor (comparator, predicate, adding functor, ...) | |
f | Functor to "process" an element with op (depends on desired functionality, e. g. for std::for_each(), ...). | |
r | Functor to "add" a single result to the already processed elements (depends on functionality). | |
base | Base value for reduction. | |
output | Pointer to position where final result is written to | |
bound | Maximum number of elements processed (e. g. for std::count_n()). |
Definition at line 73 of file par_loop.h.
References equally_split_point(), and get_max_threads().
Referenced by for_each_template_random_access().
Op __gnu_parallel::for_each_template_random_access_omp_loop | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Op | o, | |||
Fu & | f, | |||
Red | r, | |||
Result | base, | |||
Result & | output, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | bound | |||
) |
Embarrassingly parallel algorithm for random access iterators, using an OpenMP for loop.
begin | Begin iterator of element sequence. | |
end | End iterator of element sequence. | |
o | User-supplied functor (comparator, predicate, adding functor, etc.). | |
f | Functor to "process" an element with op (depends on desired functionality, e. g. for std::for_each(), ...). | |
r | Functor to "add" a single result to the already processed elements (depends on functionality). | |
base | Base value for reduction. | |
output | Pointer to position where final result is written to | |
bound | Maximum number of elements processed (e. g. for std::count_n()). |
Definition at line 73 of file omp_loop.h.
References get_max_threads().
Referenced by for_each_template_random_access().
Op __gnu_parallel::for_each_template_random_access_omp_loop_static | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Op | o, | |||
Fu & | f, | |||
Red | r, | |||
Result | base, | |||
Result & | output, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | bound | |||
) |
Embarrassingly parallel algorithm for random access iterators, using an OpenMP for loop with static scheduling.
begin | Begin iterator of element sequence. | |
end | End iterator of element sequence. | |
o | User-supplied functor (comparator, predicate, adding functor, ...). | |
f | Functor to "process" an element with op (depends on desired functionality, e. g. for std::for_each(), ...). | |
r | Functor to "add" a single result to the already processed elements (depends on functionality). | |
base | Base value for reduction. | |
output | Pointer to position where final result is written to | |
bound | Maximum number of elements processed (e. g. for std::count_n()). |
Definition at line 73 of file omp_loop_static.h.
References get_max_threads().
Op __gnu_parallel::for_each_template_random_access_workstealing | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Op | op, | |||
Fu & | f, | |||
Red | r, | |||
Result | base, | |||
Result & | output, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | bound | |||
) |
Work stealing algorithm for random access iterators.
Uses O(1) additional memory. Synchronization at job lists is done with atomic operations.
begin | Begin iterator of element sequence. | |
end | End iterator of element sequence. | |
op | User-supplied functor (comparator, predicate, adding functor, ...). | |
f | Functor to "process" an element with op (depends on desired functionality, e. g. for std::for_each(), ...). | |
r | Functor to "add" a single result to the already processed elements (depends on functionality). | |
base | Base value for reduction. | |
output | Pointer to position where final result is written to | |
bound | Maximum number of elements processed (e. g. for std::count_n()). |
Definition at line 105 of file workstealing.h.
References _GLIBCXX_CALL, __gnu_parallel::_Settings::cache_line_size, __gnu_parallel::Job< _DifferenceTp >::first, std::get(), get_max_threads(), __gnu_parallel::Job< _DifferenceTp >::last, __gnu_parallel::Job< _DifferenceTp >::load, min(), __gnu_parallel::_Settings::workstealing_chunk_size, and yield().
Referenced by for_each_template_random_access().
bool __gnu_parallel::is_sorted | ( | InputIterator | begin, | |
InputIterator | end, | |||
Comparator | comp = std::less<typename std::iterator_traits<InputIterator>:: value_type>() | |||
) |
Check whether [begin,
end
) is sorted according to comp
.
begin | Begin iterator of sequence. | |
end | End iterator of sequence. | |
comp | Comparator. |
true
if sorted, false
otherwise. Definition at line 57 of file checkers.h.
Referenced by multiway_merge(), multiway_merge_3_combined(), multiway_merge_4_combined(), multiway_merge_loser_tree_combined(), and multiway_merge_loser_tree_sentinel().
bool __gnu_parallel::is_sorted_failure | ( | InputIterator | begin, | |
InputIterator | end, | |||
InputIterator & | first_failure, | |||
Comparator | comp = std::less<typename std::iterator_traits<InputIterator>:: value_type>() | |||
) |
Check whether [begin,
end
) is sorted according to comp
. Prints the position in case an unordered pair is found.
begin | Begin iterator of sequence. | |
end | End iterator of sequence. | |
first_failure | The first failure is returned in this variable. | |
comp | Comparator. |
true
if sorted, false
otherwise. Definition at line 95 of file checkers.h.
bool __gnu_parallel::is_sorted_print_failures | ( | InputIterator | begin, | |
InputIterator | end, | |||
Comparator | comp = std::less<typename std::iterator_traits <InputIterator>::value_type>() | |||
) |
Check whether [begin,
end
) is sorted according to comp
. Prints all unordered pair, including the surrounding two elements.
begin | Begin iterator of sequence. | |
end | End iterator of sequence. | |
comp | Comparator. |
true
if sorted, false
otherwise. Definition at line 135 of file checkers.h.
size_t __gnu_parallel::list_partition | ( | const InputIterator | begin, | |
const InputIterator | end, | |||
InputIterator * | starts, | |||
size_t * | lengths, | |||
const int | num_parts, | |||
FunctorType & | f, | |||
int | oversampling = 0 | |||
) |
Splits a sequence given by input iterators into parts of almost equal size.
The function needs only one pass over the sequence.
begin | Begin iterator of input sequence. | |
end | End iterator of input sequence. | |
starts | Start iterators for the resulting parts, dimension num_parts+1 . For convenience, starts [num_parts] contains the end iterator of the sequence. | |
lengths | Length of the resulting parts. | |
num_parts | Number of parts to split the sequence into. | |
f | Functor to be applied to each element by traversing it | |
oversampling | Oversampling factor. If 0, then the partitions will differ in at most ![]() ![]() |
Definition at line 106 of file list_partition.h.
References shrink_and_double(), and std::vector< _Tp, _Alloc >::size().
Size __gnu_parallel::log2 | ( | Size | n | ) | [inline] |
Calculates the rounded-down logarithm of n
for base 2.
n | Argument. |
Definition at line 112 of file base.h.
Referenced by multiseq_partition(), multiseq_selection(), parallel_random_shuffle_drs(), parallel_sort_qsb(), round_up_to_pow2(), and sequential_random_shuffle().
const T& __gnu_parallel::max | ( | const T & | a, | |
const T & | b | |||
) |
Equivalent to std::max.
Definition at line 158 of file base.h.
Referenced by prepare_unguarded_sentinel().
RandomAccessIterator __gnu_parallel::median_of_three_iterators | ( | RandomAccessIterator | a, | |
RandomAccessIterator | b, | |||
RandomAccessIterator | c, | |||
Comparator & | comp | |||
) |
Compute the median of three referenced elements, according to comp
.
a | First iterator. | |
b | Second iterator. | |
c | Third iterator. | |
comp | Comparator. |
Definition at line 450 of file base.h.
Referenced by qsb_divide().
OutputIterator __gnu_parallel::merge_advance | ( | RandomAccessIterator1 & | begin1, | |
RandomAccessIterator1 | end1, | |||
RandomAccessIterator2 & | begin2, | |||
RandomAccessIterator2 | end2, | |||
OutputIterator | target, | |||
_DifferenceTp | max_length, | |||
Comparator | comp | |||
) | [inline] |
Merge routine being able to merge only the max_length
smallest elements.
The begin
iterators are advanced accordingly, they might not reach end
, in contrast to the usual variant. Static switch on whether to use the conditional-move variant.
begin1 | Begin iterator of first sequence. | |
end1 | End iterator of first sequence. | |
begin2 | Begin iterator of second sequence. | |
end2 | End iterator of second sequence. | |
target | Target begin iterator. | |
max_length | Maximum number of elements to merge. | |
comp | Comparator. |
Definition at line 180 of file merge.h.
References _GLIBCXX_CALL, and merge_advance_movc().
Referenced by std::__parallel::merge_switch(), multiway_merge(), multiway_merge_3_combined(), parallel_merge_advance(), and parallel_multiway_merge().
OutputIterator __gnu_parallel::merge_advance_movc | ( | RandomAccessIterator1 & | begin1, | |
RandomAccessIterator1 | end1, | |||
RandomAccessIterator2 & | begin2, | |||
RandomAccessIterator2 | end2, | |||
OutputIterator | target, | |||
_DifferenceTp | max_length, | |||
Comparator | comp | |||
) |
Merge routine being able to merge only the max_length
smallest elements.
The begin
iterators are advanced accordingly, they might not reach end
, in contrast to the usual variant. Specially designed code should allow the compiler to generate conditional moves instead of branches.
begin1 | Begin iterator of first sequence. | |
end1 | End iterator of first sequence. | |
begin2 | Begin iterator of second sequence. | |
end2 | End iterator of second sequence. | |
target | Target begin iterator. | |
max_length | Maximum number of elements to merge. | |
comp | Comparator. |
Definition at line 112 of file merge.h.
References _GLIBCXX_PARALLEL_ASSERT.
Referenced by merge_advance().
OutputIterator __gnu_parallel::merge_advance_usual | ( | RandomAccessIterator1 & | begin1, | |
RandomAccessIterator1 | end1, | |||
RandomAccessIterator2 & | begin2, | |||
RandomAccessIterator2 | end2, | |||
OutputIterator | target, | |||
_DifferenceTp | max_length, | |||
Comparator | comp | |||
) |
Merge routine being able to merge only the max_length
smallest elements.
The begin
iterators are advanced accordingly, they might not reach end
, in contrast to the usual variant.
begin1 | Begin iterator of first sequence. | |
end1 | End iterator of first sequence. | |
begin2 | Begin iterator of second sequence. | |
end2 | End iterator of second sequence. | |
target | Target begin iterator. | |
max_length | Maximum number of elements to merge. | |
comp | Comparator. |
const T& __gnu_parallel::min | ( | const T & | a, | |
const T & | b | |||
) |
Equivalent to std::min.
Definition at line 152 of file base.h.
Referenced by __gnu_cxx::__lexicographical_compare_3way(), for_each_template_random_access_workstealing(), prepare_unguarded(), and __gnu_cxx::random_sample_n().
void __gnu_parallel::multiseq_partition | ( | RanSeqs | begin_seqs, | |
RanSeqs | end_seqs, | |||
RankType | rank, | |||
RankIterator | begin_offsets, | |||
Comparator | comp = std::less< typename std::iterator_traits<typename std::iterator_traits<RanSeqs>::value_type:: first_type>::value_type>() | |||
) |
Splits several sorted sequences at a certain global rank, resulting in a splitting point for each sequence. The sequences are passed via a sequence of random-access iterator pairs, none of the sequences may be empty. If there are several equal elements across the split, the ones on the left side will be chosen from sequences with smaller number.
begin_seqs | Begin of the sequence of iterator pairs. | |
end_seqs | End of the sequence of iterator pairs. | |
rank | The global rank to partition at. | |
begin_offsets | A random-access sequence begin where the result will be stored in. Each element of the sequence is an iterator that points to the first element on the greater part of the respective sequence. | |
comp | The ordering functor, defaults to std::less<T>. |
Definition at line 129 of file multiseq_selection.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_ASSERT, std::vector< _Tp, _Alloc >::begin(), std::distance(), std::vector< _Tp, _Alloc >::end(), log2(), std::make_pair(), std::max(), std::min(), std::priority_queue< _Tp, _Sequence, _Compare >::pop(), std::priority_queue< _Tp, _Sequence, _Compare >::push(), std::vector< _Tp, _Alloc >::push_back(), and std::priority_queue< _Tp, _Sequence, _Compare >::top().
Referenced by parallel_multiway_merge(), parallel_set_operation(), and parallel_sort_mwms_pu().
T __gnu_parallel::multiseq_selection | ( | RanSeqs | begin_seqs, | |
RanSeqs | end_seqs, | |||
RankType | rank, | |||
RankType & | offset, | |||
Comparator | comp = std::less<T>() | |||
) |
Selects the element at a certain global rank from several sorted sequences.
The sequences are passed via a sequence of random-access iterator pairs, none of the sequences may be empty.
begin_seqs | Begin of the sequence of iterator pairs. | |
end_seqs | End of the sequence of iterator pairs. | |
rank | The global rank to partition at. | |
offset | The rank of the selected element in the global subsequence of elements equal to the selected element. If the selected element is unique, this number is 0. | |
comp | The ordering functor, defaults to std::less. |
Definition at line 382 of file multiseq_selection.h.
References _GLIBCXX_CALL, std::vector< _Tp, _Alloc >::begin(), std::distance(), std::vector< _Tp, _Alloc >::end(), log2(), std::make_pair(), std::max(), std::min(), std::priority_queue< _Tp, _Sequence, _Compare >::pop(), std::priority_queue< _Tp, _Sequence, _Compare >::push(), std::vector< _Tp, _Alloc >::push_back(), and std::priority_queue< _Tp, _Sequence, _Compare >::top().
RandomAccessIterator3 __gnu_parallel::multiway_merge | ( | RandomAccessIteratorPairIterator | seqs_begin, | |
RandomAccessIteratorPairIterator | seqs_end, | |||
RandomAccessIterator3 | target, | |||
Comparator | comp, | |||
_DifferenceTp | length, | |||
bool | stable | |||
) |
Multi-way merging front-end.
seqs_begin | Begin iterator of iterator pair input sequence. | |
seqs_end | End iterator of iterator pair input sequence. | |
target | Begin iterator out output sequence. | |
comp | Comparator. | |
length | Maximum length to merge. | |
stable | Stable merging incurs a performance penalty. |
Definition at line 1760 of file multiway_merge.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_CONDITION, std::get(), __gnu_parallel::_Settings::multiway_merge_minimal_k, __gnu_parallel::_Settings::multiway_merge_minimal_n, and parallel_multiway_merge().
Referenced by multiway_merge_sentinel(), and parallel_multiway_merge().
RandomAccessIterator3 __gnu_parallel::multiway_merge | ( | RandomAccessIteratorIterator | seqs_begin, | |
RandomAccessIteratorIterator | seqs_end, | |||
RandomAccessIterator3 | target, | |||
Comparator | comp, | |||
_DifferenceTp | length, | |||
bool | stable, | |||
bool | sentinel, | |||
sequential_tag | ||||
) |
Sequential multi-way merging switch.
The _GLIBCXX_PARALLEL_DECISION if based on the branching factor and runtime settings.
seqs_begin | Begin iterator of iterator pair input sequence. | |
seqs_end | End iterator of iterator pair input sequence. | |
target | Begin iterator out output sequence. | |
comp | Comparator. | |
length | Maximum length to merge. | |
stable | Stable merging incurs a performance penalty. | |
sentinel | The sequences have a sentinel element. |
Definition at line 1338 of file multiway_merge.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_ASSERT, std::get(), is_sorted(), merge_advance(), multiway_merge_3_combined(), multiway_merge_4_combined(), multiway_merge_bubble(), multiway_merge_loser_tree(), multiway_merge_loser_tree_combined(), and multiway_merge_loser_tree_sentinel().
RandomAccessIterator3 __gnu_parallel::multiway_merge_3_variant | ( | RandomAccessIteratorIterator | seqs_begin, | |
RandomAccessIteratorIterator | seqs_end, | |||
RandomAccessIterator3 | target, | |||
Comparator | comp, | |||
_DifferenceTp | length, | |||
bool | stable | |||
) |
Highly efficient 3-way merging procedure.
seqs_begin | Begin iterator of iterator pair input sequence. | |
seqs_end | End iterator of iterator pair input sequence. | |
target | Begin iterator out output sequence. | |
comp | Comparator. | |
length | Maximum length to merge. | |
stable | Unused, stable anyway. |
Definition at line 407 of file multiway_merge.h.
References _GLIBCXX_CALL.
RandomAccessIterator3 __gnu_parallel::multiway_merge_4_variant | ( | RandomAccessIteratorIterator | seqs_begin, | |
RandomAccessIteratorIterator | seqs_end, | |||
RandomAccessIterator3 | target, | |||
Comparator | comp, | |||
_DifferenceTp | length, | |||
bool | stable | |||
) |
Highly efficient 4-way merging procedure.
seqs_begin | Begin iterator of iterator pair input sequence. | |
seqs_end | End iterator of iterator pair input sequence. | |
target | Begin iterator out output sequence. | |
comp | Comparator. | |
length | Maximum length to merge. | |
stable | Unused, stable anyway. |
Definition at line 579 of file multiway_merge.h.
References _GLIBCXX_CALL.
RandomAccessIterator3 __gnu_parallel::multiway_merge_bubble | ( | RandomAccessIteratorIterator | seqs_begin, | |
RandomAccessIteratorIterator | seqs_end, | |||
RandomAccessIterator3 | target, | |||
Comparator | comp, | |||
_DifferenceTp | length, | |||
bool | stable | |||
) |
Basic multi-way merging procedure.
The head elements are kept in a sorted array, new heads are inserted linearly.
seqs_begin | Begin iterator of iterator pair input sequence. | |
seqs_end | End iterator of iterator pair input sequence. | |
target | Begin iterator out output sequence. | |
comp | Comparator. | |
length | Maximum length to merge. | |
stable | Stable merging incurs a performance penalty. |
Definition at line 768 of file multiway_merge.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_LENGTH, and std::swap().
Referenced by multiway_merge().
RandomAccessIterator3 __gnu_parallel::multiway_merge_loser_tree | ( | RandomAccessIteratorIterator | seqs_begin, | |
RandomAccessIteratorIterator | seqs_end, | |||
RandomAccessIterator3 | target, | |||
Comparator | comp, | |||
_DifferenceTp | length, | |||
bool | stable | |||
) |
Multi-way merging procedure for a high branching factor, guarded case.
The head elements are kept in a loser tree.
seqs_begin | Begin iterator of iterator pair input sequence. | |
seqs_end | End iterator of iterator pair input sequence. | |
target | Begin iterator out output sequence. | |
comp | Comparator. | |
length | Maximum length to merge. | |
stable | Stable merging incurs a performance penalty. |
Definition at line 960 of file multiway_merge.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_LENGTH, and std::min().
Referenced by multiway_merge(), and multiway_merge_loser_tree_combined().
RandomAccessIterator3 __gnu_parallel::multiway_merge_loser_tree_unguarded | ( | RandomAccessIteratorIterator | seqs_begin, | |
RandomAccessIteratorIterator | seqs_end, | |||
RandomAccessIterator3 | target, | |||
Comparator | comp, | |||
_DifferenceTp | length, | |||
bool | stable | |||
) |
Multi-way merging procedure for a high branching factor, unguarded case.
The head elements are kept in a loser tree.
seqs_begin | Begin iterator of iterator pair input sequence. | |
seqs_end | End iterator of iterator pair input sequence. | |
target | Begin iterator out output sequence. | |
comp | Comparator. | |
length | Maximum length to merge. | |
stable | Stable merging incurs a performance penalty. |
Definition at line 1079 of file multiway_merge.h.
References _GLIBCXX_ASSERTIONS, _GLIBCXX_CALL, _GLIBCXX_PARALLEL_ASSERT, _GLIBCXX_PARALLEL_LENGTH, and std::min().
Referenced by multiway_merge_loser_tree_combined(), and multiway_merge_loser_tree_sentinel().
RandomAccessIterator3 __gnu_parallel::multiway_merge_sentinel | ( | RandomAccessIteratorPairIterator | seqs_begin, | |
RandomAccessIteratorPairIterator | seqs_end, | |||
RandomAccessIterator3 | target, | |||
Comparator | comp, | |||
_DifferenceTp | length, | |||
bool | stable | |||
) |
Multi-way merging front-end.
seqs_begin | Begin iterator of iterator pair input sequence. | |
seqs_end | End iterator of iterator pair input sequence. | |
target | Begin iterator out output sequence. | |
comp | Comparator. | |
length | Maximum length to merge. | |
stable | Stable merging incurs a performance penalty. |
i
, seqs_begin
[i].second must be the end marker of the sequence, but also reference the one more sentinel element. Definition at line 1804 of file multiway_merge.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_CONDITION, std::get(), multiway_merge(), __gnu_parallel::_Settings::multiway_merge_minimal_k, __gnu_parallel::_Settings::multiway_merge_minimal_n, and parallel_multiway_merge().
bool __gnu_parallel::operator< | ( | unguarded_iterator< RandomAccessIterator, Comparator > & | bi1, | |
unguarded_iterator< RandomAccessIterator, Comparator > & | bi2 | |||
) | [inline] |
Compare two elements referenced by unguarded iterators.
bi1 | First iterator. | |
bi2 | Second iterator. |
True
if less. Definition at line 239 of file multiway_merge.h.
bool __gnu_parallel::operator< | ( | guarded_iterator< RandomAccessIterator, Comparator > & | bi1, | |
guarded_iterator< RandomAccessIterator, Comparator > & | bi2 | |||
) | [inline] |
Compare two elements referenced by guarded iterators.
bi1 | First iterator. | |
bi2 | Second iterator. |
True
if less. Definition at line 144 of file multiway_merge.h.
bool __gnu_parallel::operator<= | ( | unguarded_iterator< RandomAccessIterator, Comparator > & | bi1, | |
unguarded_iterator< RandomAccessIterator, Comparator > & | bi2 | |||
) | [inline] |
Compare two elements referenced by unguarded iterators.
bi1 | First iterator. | |
bi2 | Second iterator. |
True
if less equal. Definition at line 252 of file multiway_merge.h.
bool __gnu_parallel::operator<= | ( | guarded_iterator< RandomAccessIterator, Comparator > & | bi1, | |
guarded_iterator< RandomAccessIterator, Comparator > & | bi2 | |||
) | [inline] |
Compare two elements referenced by guarded iterators.
bi1 | First iterator. | |
bi2 | Second iterator. |
True
if less equal. Definition at line 160 of file multiway_merge.h.
RandomAccessIterator3 __gnu_parallel::parallel_merge_advance | ( | RandomAccessIterator1 & | begin1, | |
RandomAccessIterator1 | end1, | |||
RandomAccessIterator1 & | begin2, | |||
RandomAccessIterator1 | end2, | |||
RandomAccessIterator3 | target, | |||
typename std::iterator_traits< RandomAccessIterator1 >::difference_type | max_length, | |||
Comparator | comp | |||
) | [inline] |
Parallel merge routine being able to merge only the max_length
smallest elements.
The begin
iterators are advanced accordingly, they might not reach end
, in contrast to the usual variant. The functionality is projected onto parallel_multiway_merge.
begin1 | Begin iterator of first sequence. | |
end1 | End iterator of first sequence. | |
begin2 | Begin iterator of second sequence. | |
end2 | End iterator of second sequence. | |
target | Target begin iterator. | |
max_length | Maximum number of elements to merge. | |
comp | Comparator. |
Definition at line 234 of file merge.h.
References std::make_pair(), and parallel_multiway_merge().
RandomAccessIterator3 __gnu_parallel::parallel_merge_advance | ( | RandomAccessIterator1 & | begin1, | |
RandomAccessIterator1 | end1, | |||
RandomAccessIterator2 & | begin2, | |||
RandomAccessIterator2 | end2, | |||
RandomAccessIterator3 | target, | |||
typename std::iterator_traits< RandomAccessIterator1 >::difference_type | max_length, | |||
Comparator | comp | |||
) | [inline] |
Merge routine fallback to sequential in case the iterators of the two input sequences are of different type.
begin1 | Begin iterator of first sequence. | |
end1 | End iterator of first sequence. | |
begin2 | Begin iterator of second sequence. | |
end2 | End iterator of second sequence. | |
target | Target begin iterator. | |
max_length | Maximum number of elements to merge. | |
comp | Comparator. |
Definition at line 204 of file merge.h.
References merge_advance().
Referenced by std::__parallel::merge_switch().
RandomAccessIterator3 __gnu_parallel::parallel_multiway_merge | ( | RandomAccessIteratorIterator | seqs_begin, | |
RandomAccessIteratorIterator | seqs_end, | |||
RandomAccessIterator3 | target, | |||
Comparator | comp, | |||
_DifferenceTp | length, | |||
bool | stable, | |||
bool | sentinel | |||
) |
Parallel multi-way merge routine.
The _GLIBCXX_PARALLEL_DECISION if based on the branching factor and runtime settings.
seqs_begin | Begin iterator of iterator pair input sequence. | |
seqs_end | End iterator of iterator pair input sequence. | |
target | Begin iterator out output sequence. | |
comp | Comparator. | |
length | Maximum length to merge. | |
stable | Stable merging incurs a performance penalty. | |
sentinel | Ignored. |
Definition at line 1518 of file multiway_merge.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_LENGTH, std::vector< _Tp, _Alloc >::begin(), std::copy(), equally_split(), std::get(), get_max_threads(), std::make_pair(), merge_advance(), __gnu_parallel::_Settings::merge_oversampling, std::min(), multiseq_partition(), multiway_merge(), __gnu_parallel::_Settings::multiway_merge_splitting, and std::vector< _Tp, _Alloc >::resize().
Referenced by multiway_merge(), multiway_merge_sentinel(), and parallel_merge_advance().
void __gnu_parallel::parallel_nth_element | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | nth, | |||
RandomAccessIterator | end, | |||
Comparator | comp | |||
) |
Parallel implementation of std::nth_element().
begin | Begin iterator of input sequence. | |
nth | Iterator of element that must be in position afterwards. | |
end | End iterator of input sequence. | |
comp | Comparator. |
Definition at line 336 of file partition.h.
References _GLIBCXX_CALL, std::get(), get_max_threads(), parallel_partition(), and std::swap().
Referenced by std::__parallel::nth_element(), and parallel_partial_sort().
void __gnu_parallel::parallel_partial_sort | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | middle, | |||
RandomAccessIterator | end, | |||
Comparator | comp | |||
) |
Parallel implementation of std::partial_sort().
begin | Begin iterator of input sequence. | |
middle | Sort until this position. | |
end | End iterator of input sequence. | |
comp | Comparator. |
Definition at line 423 of file partition.h.
References parallel_nth_element().
Referenced by std::__parallel::partial_sort().
OutputIterator __gnu_parallel::parallel_partial_sum | ( | InputIterator | begin, | |
InputIterator | end, | |||
OutputIterator | result, | |||
BinaryOperation | bin_op | |||
) |
Parallel partial sum front-end.
begin | Begin iterator of input sequence. | |
end | End iterator of input sequence. | |
result | Begin iterator of output sequence. | |
bin_op | Associative binary function. |
Definition at line 202 of file partial_sum.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_ASSERT, __gnu_parallel::_Settings::get(), and parallel_partial_sum_linear().
Referenced by std::__parallel::partial_sum_switch().
OutputIterator __gnu_parallel::parallel_partial_sum_basecase | ( | InputIterator | begin, | |
InputIterator | end, | |||
OutputIterator | result, | |||
BinaryOperation | bin_op, | |||
typename std::iterator_traits< InputIterator >::value_type | value | |||
) |
Base case prefix sum routine.
begin | Begin iterator of input sequence. | |
end | End iterator of input sequence. | |
result | Begin iterator of output sequence. | |
bin_op | Associative binary function. | |
value | Start value. Must be passed since the neutral element is unknown in general. |
Definition at line 64 of file partial_sum.h.
Referenced by parallel_partial_sum_linear().
OutputIterator __gnu_parallel::parallel_partial_sum_linear | ( | InputIterator | begin, | |
InputIterator | end, | |||
OutputIterator | result, | |||
BinaryOperation | bin_op, | |||
typename std::iterator_traits< InputIterator >::difference_type | n | |||
) |
Parallel partial sum implementation, two-phase approach, no recursion.
begin | Begin iterator of input sequence. | |
end | End iterator of input sequence. | |
result | Begin iterator of output sequence. | |
bin_op | Associative binary function. | |
n | Length of sequence. | |
num_threads | Number of threads to use. |
Definition at line 96 of file partial_sum.h.
References std::accumulate(), equally_split(), std::get(), get_max_threads(), parallel_partial_sum_basecase(), and __gnu_parallel::_Settings::partial_sum_dilation.
Referenced by parallel_partial_sum().
std::iterator_traits<RandomAccessIterator>::difference_type __gnu_parallel::parallel_partition | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Predicate | pred, | |||
thread_index_t | num_threads | |||
) |
Parallel implementation of std::partition.
begin | Begin iterator of input sequence to split. | |
end | End iterator of input sequence to split. | |
pred | Partition predicate, possibly including some kind of pivot. | |
num_threads | Maximum number of threads to use for this task. |
Definition at line 61 of file partition.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_ASSERT, _GLIBCXX_VOLATILE, std::get(), std::left(), __gnu_parallel::_Settings::partition_chunk_share, __gnu_parallel::_Settings::partition_chunk_size, std::right(), and std::swap().
Referenced by parallel_nth_element(), parallel_sort_qs_divide(), std::__parallel::partition_switch(), and qsb_divide().
void __gnu_parallel::parallel_random_shuffle | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
RandomNumberGenerator | rng = random_number() | |||
) | [inline] |
Parallel random public call.
begin | Begin iterator of sequence. | |
end | End iterator of sequence. | |
rng | Random number generator to use. |
Definition at line 509 of file random_shuffle.h.
References get_max_threads(), and parallel_random_shuffle_drs().
Referenced by std::__parallel::random_shuffle().
void __gnu_parallel::parallel_random_shuffle_drs | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | n, | |||
thread_index_t | num_threads, | |||
RandomNumberGenerator & | rng | |||
) |
Main parallel random shuffle step.
begin | Begin iterator of sequence. | |
end | End iterator of sequence. | |
n | Length of sequence. | |
num_threads | Number of threads to use. | |
rng | Random number generator to use. |
Definition at line 264 of file random_shuffle.h.
References _GLIBCXX_CALL, __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::bin_proc, __gnu_parallel::DRSSorterPU< RandomAccessIterator, RandomNumberGenerator >::bins_begin, __gnu_parallel::DRSSorterPU< RandomAccessIterator, RandomNumberGenerator >::bins_end, __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::dist, std::get(), __gnu_parallel::_Settings::L2_cache_size, log2(), std::min(), __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::num_bins, __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::num_bits, __gnu_parallel::DRSSorterPU< RandomAccessIterator, RandomNumberGenerator >::num_threads, parallel_random_shuffle_drs_pu(), round_up_to_pow2(), __gnu_parallel::DRSSorterPU< RandomAccessIterator, RandomNumberGenerator >::sd, __gnu_parallel::DRSSorterPU< RandomAccessIterator, RandomNumberGenerator >::seed, sequential_random_shuffle(), __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::starts, __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::temporaries, and __gnu_parallel::_Settings::TLB_size.
Referenced by parallel_random_shuffle().
void __gnu_parallel::parallel_random_shuffle_drs_pu | ( | DRSSorterPU< RandomAccessIterator, RandomNumberGenerator > * | pus | ) |
Random shuffle code executed by each thread.
pus | Array of thread-local data records. |
Definition at line 128 of file random_shuffle.h.
References __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::dist, __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::num_bins, __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::num_bits, __gnu_parallel::DRSSorterPU< RandomAccessIterator, RandomNumberGenerator >::num_threads, random_number_pow2(), __gnu_parallel::DRSSorterPU< RandomAccessIterator, RandomNumberGenerator >::sd, __gnu_parallel::DRSSorterPU< RandomAccessIterator, RandomNumberGenerator >::seed, and __gnu_parallel::DRandomShufflingGlobalData< RandomAccessIterator >::starts.
Referenced by parallel_random_shuffle_drs().
void __gnu_parallel::parallel_sort | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Comparator | comp, | |||
bool | stable | |||
) | [inline] |
Choose a parallel sorting algorithm.
begin | Begin iterator of input sequence. | |
end | End iterator of input sequence. | |
comp | Comparator. | |
stable | Sort stable. |
Definition at line 73 of file sort.h.
References _GLIBCXX_CALL, __gnu_parallel::_Settings::get(), get_max_threads(), parallel_sort_mwms(), parallel_sort_qs(), and parallel_sort_qsb().
Referenced by std::__parallel::sort(), and std::__parallel::stable_sort().
Here is the call graph for this function:
void __gnu_parallel::parallel_sort_mwms | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Comparator | comp, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | n, | |||
int | num_threads, | |||
bool | stable | |||
) |
PMWMS main call.
begin | Begin iterator of sequence. | |
end | End iterator of sequence. | |
comp | Comparator. | |
n | Length of sequence. | |
num_threads | Number of threads to use. | |
stable | Stable sorting. |
Definition at line 336 of file multiway_mergesort.h.
References _GLIBCXX_CALL, std::get(), parallel_sort_mwms_pu(), __gnu_parallel::_Settings::sort_mwms_oversampling, and __gnu_parallel::_Settings::sort_splitting.
Referenced by parallel_sort().
void __gnu_parallel::parallel_sort_mwms_pu | ( | PMWMSSortingData< RandomAccessIterator > * | sd, | |
Comparator & | comp | |||
) |
PMWMS code executed by each thread.
sd | Pointer to algorithm data. | |
comp | Comparator. |
Definition at line 153 of file multiway_mergesort.h.
References determine_samples(), std::get(), std::make_pair(), multiseq_partition(), __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::num_threads, __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::pieces, __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::samples, __gnu_parallel::_Settings::sort_splitting, __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::sorting_places, __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::source, __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::stable, __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::starts, __gnu_parallel::PMWMSSortingData< RandomAccessIterator >::temporaries, and std::uninitialized_copy().
Referenced by parallel_sort_mwms().
void __gnu_parallel::parallel_sort_qs | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Comparator | comp, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | n, | |||
int | num_threads | |||
) |
Unbalanced quicksort main call.
begin | Begin iterator of input sequence. | |
end | End iterator input sequence, ignored. | |
comp | Comparator. | |
n | Length of input sequence. | |
num_threads | Number of threads that are allowed to work on this part. |
Definition at line 163 of file quicksort.h.
References _GLIBCXX_CALL, and parallel_sort_qs_conquer().
Referenced by parallel_sort().
void __gnu_parallel::parallel_sort_qs_conquer | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Comparator | comp, | |||
thread_index_t | num_threads | |||
) |
Unbalanced quicksort conquer step.
begin | Begin iterator of subsequence. | |
end | End iterator of subsequence. | |
comp | Comparator. | |
num_threads | Number of threads that are allowed to work on this part. |
Definition at line 106 of file quicksort.h.
References __gnu_parallel::_Settings::get(), and parallel_sort_qs_divide().
Referenced by parallel_sort_qs().
std::iterator_traits<RandomAccessIterator>::difference_type __gnu_parallel::parallel_sort_qs_divide | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Comparator | comp, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | pivot_rank, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | num_samples, | |||
thread_index_t | num_threads | |||
) |
Unbalanced quicksort divide step.
begin | Begin iterator of subsequence. | |
end | End iterator of subsequence. | |
comp | Comparator. | |
pivot_rank | Desired rank of the pivot. | |
num_samples | Choose pivot from that many samples. | |
num_threads | Number of threads that are allowed to work on this part. |
Definition at line 57 of file quicksort.h.
References std::min(), and parallel_partition().
Referenced by parallel_sort_qs_conquer().
void __gnu_parallel::parallel_sort_qsb | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Comparator | comp, | |||
typename std::iterator_traits< RandomAccessIterator >::difference_type | n, | |||
thread_index_t | num_threads | |||
) |
Top-level quicksort routine.
begin | Begin iterator of sequence. | |
end | End iterator of sequence. | |
comp | Comparator. | |
n | Length of the sequence to sort. | |
num_threads | Number of threads that are allowed to work on this part. |
Definition at line 424 of file balanced_quicksort.h.
References _GLIBCXX_CALL, _GLIBCXX_PARALLEL_ASSERT, log2(), std::make_pair(), and qsb_conquer().
Referenced by parallel_sort().
OutputIterator __gnu_parallel::parallel_unique_copy | ( | InputIterator | first, | |
InputIterator | last, | |||
OutputIterator | result | |||
) | [inline] |
Parallel std::unique_copy(), without explicit equality predicate.
first | Begin iterator of input sequence. | |
last | End iterator of input sequence. | |
result | Begin iterator of result sequence. |
Definition at line 187 of file unique_copy.h.
References parallel_unique_copy().
OutputIterator __gnu_parallel::parallel_unique_copy | ( | InputIterator | first, | |
InputIterator | last, | |||
OutputIterator | result, | |||
BinaryPredicate | binary_pred | |||
) |
Parallel std::unique_copy(), w/o explicit equality predicate.
first | Begin iterator of input sequence. | |
last | End iterator of input sequence. | |
result | Begin iterator of result sequence. | |
binary_pred | Equality predicate. |
Definition at line 57 of file unique_copy.h.
References _GLIBCXX_CALL, equally_split(), and get_max_threads().
Referenced by parallel_unique_copy(), and std::__parallel::unique_copy_switch().
std::iterator_traits< typename std::iterator_traits<RandomAccessIteratorIterator>::value_type ::first_type>::difference_type __gnu_parallel::prepare_unguarded | ( | RandomAccessIteratorIterator | seqs_begin, | |
RandomAccessIteratorIterator | seqs_end, | |||
Comparator | comp, | |||
int & | min_sequence, | |||
bool | stable | |||
) |
Prepare a set of sequences to be merged without a (end) guard
seqs_begin | ||
seqs_end | ||
comp | ||
min_sequence | ||
stable |
Definition at line 270 of file multiway_merge.h.
References _GLIBCXX_CALL, and min().
Referenced by multiway_merge_3_combined(), multiway_merge_4_combined(), and multiway_merge_loser_tree_combined().
std::iterator_traits<typename std::iterator_traits< RandomAccessIteratorIterator>::value_type::first_type>::difference_type __gnu_parallel::prepare_unguarded_sentinel | ( | RandomAccessIteratorIterator | seqs_begin, | |
RandomAccessIteratorIterator | seqs_end, | |||
Comparator | comp | |||
) |
Prepare a set of sequences to be merged with a (end) guard (sentinel)
seqs_begin | ||
seqs_end | ||
comp |
Definition at line 347 of file multiway_merge.h.
References _GLIBCXX_CALL, and max().
Referenced by multiway_merge_loser_tree_sentinel().
void __gnu_parallel::qsb_conquer | ( | QSBThreadLocal< RandomAccessIterator > ** | tls, | |
RandomAccessIterator | begin, | |||
RandomAccessIterator | end, | |||
Comparator | comp, | |||
thread_index_t | iam, | |||
thread_index_t | num_threads, | |||
bool | parent_wait | |||
) |
Quicksort conquer step.
tls | Array of thread-local storages. | |
begin | Begin iterator of subsequence. | |
end | End iterator of subsequence. | |
comp | Comparator. | |
iam | Number of the thread processing this function. | |
num_threads | Number of threads that are allowed to work on this part. |
Definition at line 169 of file balanced_quicksort.h.
References _GLIBCXX_PARALLEL_ASSERT, __gnu_parallel::QSBThreadLocal< RandomAccessIterator >::elements_leftover, __gnu_parallel::QSBThreadLocal< RandomAccessIterator >::initial, qsb_divide(), and qsb_local_sort_with_helping().
Referenced by parallel_sort_qsb().
std::iterator_traits<RandomAccessIterator>::difference_type __gnu_parallel::qsb_divide | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
Comparator | comp, | |||
thread_index_t | num_threads | |||
) |
Balanced quicksort divide step.
begin | Begin iterator of subsequence. | |
end | End iterator of subsequence. | |
comp | Comparator. | |
num_threads | Number of threads that are allowed to work on this part. |
(end-begin)>=1 Definition at line 106 of file balanced_quicksort.h.
References _GLIBCXX_PARALLEL_ASSERT, median_of_three_iterators(), parallel_partition(), and std::swap().
Referenced by qsb_conquer().
void __gnu_parallel::qsb_local_sort_with_helping | ( | QSBThreadLocal< RandomAccessIterator > ** | tls, | |
Comparator & | comp, | |||
int | iam, | |||
bool | wait | |||
) |
Quicksort step doing load-balanced local sort.
tls | Array of thread-local storages. | |
comp | Comparator. | |
iam | Number of the thread processing this function. |
Definition at line 245 of file balanced_quicksort.h.
References _GLIBCXX_ASSERTIONS, _GLIBCXX_PARALLEL_ASSERT, __gnu_parallel::QSBThreadLocal< RandomAccessIterator >::elements_leftover, std::get(), __gnu_parallel::QSBThreadLocal< RandomAccessIterator >::initial, __gnu_parallel::QSBThreadLocal< RandomAccessIterator >::leftover_parts, std::make_pair(), __gnu_parallel::QSBThreadLocal< RandomAccessIterator >::num_threads, std::swap(), and yield().
Referenced by qsb_conquer().
int __gnu_parallel::random_number_pow2 | ( | int | logp, | |
RandomNumberGenerator & | rng | |||
) | [inline] |
Generate a random number in [0,2^logp).
logp | Logarithm (basis 2) of the upper range bound. | |
rng | Random number generator to use. |
Definition at line 121 of file random_shuffle.h.
Referenced by parallel_random_shuffle_drs_pu(), and sequential_random_shuffle().
T __gnu_parallel::round_up_to_pow2 | ( | T | x | ) |
Round up to the next greater power of 2.
x | Integer to round up |
Definition at line 247 of file random_shuffle.h.
References log2().
Referenced by parallel_random_shuffle_drs(), and sequential_random_shuffle().
_RandomAccessIterator1 __gnu_parallel::search_template | ( | _RandomAccessIterator1 | begin1, | |
_RandomAccessIterator1 | end1, | |||
_RandomAccessIterator2 | begin2, | |||
_RandomAccessIterator2 | end2, | |||
Pred | pred | |||
) |
Parallel std::search.
begin1 | Begin iterator of first sequence. | |
end1 | End iterator of first sequence. | |
begin2 | Begin iterator of second sequence. | |
end2 | End iterator of second sequence. | |
pred | Find predicate. |
Definition at line 88 of file search.h.
References _GLIBCXX_CALL, calc_borders(), equally_split(), get_max_threads(), and std::min().
Referenced by std::__parallel::search_n_switch(), and std::__parallel::search_switch().
void __gnu_parallel::sequential_random_shuffle | ( | RandomAccessIterator | begin, | |
RandomAccessIterator | end, | |||
RandomNumberGenerator & | rng | |||
) |
Sequential cache-efficient random shuffle.
begin | Begin iterator of sequence. | |
end | End iterator of sequence. | |
rng | Random number generator to use. |
Definition at line 399 of file random_shuffle.h.
References std::get(), __gnu_parallel::_Settings::L2_cache_size, log2(), std::min(), random_number_pow2(), round_up_to_pow2(), and __gnu_parallel::_Settings::TLB_size.
Referenced by parallel_random_shuffle_drs(), and std::__parallel::random_shuffle().
void __gnu_parallel::shrink | ( | std::vector< InputIterator > & | os_starts, | |
size_t & | count_to_two, | |||
size_t & | range_length | |||
) |
Combines two ranges into one and thus halves the number of ranges.
os_starts | Start positions worked on (oversampled). | |
count_to_two | Counts up to 2. | |
range_length | Current length of a chunk. |
Definition at line 76 of file list_partition.h.
References std::vector< _Tp, _Alloc >::size().
Referenced by shrink_and_double().
void __gnu_parallel::shrink_and_double | ( | std::vector< InputIterator > & | os_starts, | |
size_t & | count_to_two, | |||
size_t & | range_length, | |||
const bool | make_twice | |||
) |
Shrinks and doubles the ranges.
os_starts | Start positions worked on (oversampled). | |
count_to_two | Counts up to 2. | |
range_length | Current length of a chunk. | |
make_twice | Whether the os_starts is allowed to be grown or not |
Definition at line 56 of file list_partition.h.
References std::vector< _Tp, _Alloc >::resize(), shrink(), and std::vector< _Tp, _Alloc >::size().
Referenced by list_partition().
void __gnu_parallel::yield | ( | ) | [inline] |
Yield the control to another thread, without waiting for the end to the time slice.
Definition at line 346 of file parallel/compatibility.h.
Referenced by for_each_template_random_access_workstealing(), and qsb_local_sort_with_helping().
const int __gnu_parallel::lcas_t_bits [static] |
const lcas_t __gnu_parallel::lcas_t_mask [static] |