Namespaces | |
checkout_mode | |
common | |
execution | |
ito | |
ori | |
reducer | |
Classes | |
class | checkout_span |
Checkout span to automatically manage the lifetime of checked-out memory. More... | |
class | global_span |
Global span to represent a view of a global memory range. More... | |
struct | global_vector_options |
Options for ityr::global_vector . More... | |
class | global_vector |
Global vector to manage a global memory region. More... | |
class | unique_file_ptr |
class | workhint_range |
class | workhint_range< void > |
class | workhint_range_view |
class | workhint_range_view< void > |
class | count_iterator |
Count iterator. More... | |
struct | is_global_iterator |
See ityr::is_global_iterator_v . More... | |
struct | is_global_iterator< T, std::void_t< typename T::checkout_iterator > > |
See ityr::is_global_iterator_v . More... | |
class | global_iterator |
Global iterator to enable/disable automatic checkout. More... | |
class | global_move_iterator |
Global iterator for moving objects. More... | |
class | global_reverse_iterator |
Reverse iterator for global memory. More... | |
class | global_construct_iterator |
Global iterator for constructing objects. More... | |
class | global_destruct_iterator |
Global iterator for destructing objects. More... | |
struct | workhint |
Typedefs | |
using | rank_t = common::topology::rank_t |
Process rank (ID) starting from 0 (corresponding to an MPI rank). More... | |
using | wallclock_t = common::wallclock::wallclock_t |
Wallclock time in nanoseconds. More... | |
using | default_random_engine = internal::random_engine_dummy |
Functions | |
template<typename T , typename Mode > | |
constexpr auto | data (const checkout_span< T, Mode > &cs) noexcept |
template<typename T , typename Mode > | |
constexpr auto | size (const checkout_span< T, Mode > &cs) noexcept |
template<typename T , typename Mode > | |
constexpr auto | begin (const checkout_span< T, Mode > &cs) noexcept |
template<typename T , typename Mode > | |
constexpr auto | end (const checkout_span< T, Mode > &cs) noexcept |
template<typename T , typename Mode > | |
checkout_span< T, Mode > | make_checkout (ori::global_ptr< T > gptr, std::size_t n, Mode mode) |
Checkout a global memory region. More... | |
template<typename T , typename Mode > | |
checkout_span< T, Mode > | make_checkout (global_span< T > gspan, Mode mode) |
Checkout a global memory region. More... | |
template<typename... Args> | |
auto | make_checkouts (Args &&... args) |
Checkout multiple global memory regions. More... | |
template<typename T > | |
constexpr auto | data (const global_span< T > &s) noexcept |
template<typename T > | |
constexpr auto | size (const global_span< T > &s) noexcept |
template<typename T > | |
constexpr auto | begin (const global_span< T > &s) noexcept |
template<typename T > | |
constexpr auto | end (const global_span< T > &s) noexcept |
template<typename T > | |
void | swap (global_vector< T > &v1, global_vector< T > &v2) noexcept |
template<typename T > | |
bool | operator== (const global_vector< T > &x, const global_vector< T > &y) |
template<typename T > | |
bool | operator!= (const global_vector< T > &x, const global_vector< T > &y) |
template<typename T1 , typename T2 > | |
bool | operator== (const unique_file_ptr< T1 > &ufp1, const unique_file_ptr< T2 > &ufp2) |
template<typename T > | |
bool | operator== (const unique_file_ptr< T > &ufp, std::nullptr_t) |
template<typename T > | |
bool | operator== (std::nullptr_t, const unique_file_ptr< T > &ufp) |
template<typename T1 , typename T2 > | |
bool | operator!= (const unique_file_ptr< T1 > &ufp1, const unique_file_ptr< T2 > &ufp2) |
template<typename T > | |
bool | operator!= (const unique_file_ptr< T > &ufp, std::nullptr_t) |
template<typename T > | |
bool | operator!= (std::nullptr_t, const unique_file_ptr< T > &ufp) |
template<typename T1 , typename T2 > | |
bool | operator> (const unique_file_ptr< T1 > &ufp1, const unique_file_ptr< T2 > &ufp2) |
template<typename T > | |
bool | operator> (const unique_file_ptr< T > &ufp, std::nullptr_t) |
template<typename T > | |
bool | operator> (std::nullptr_t, const unique_file_ptr< T > &ufp) |
template<typename T1 , typename T2 > | |
bool | operator>= (const unique_file_ptr< T1 > &ufp1, const unique_file_ptr< T2 > &ufp2) |
template<typename T > | |
bool | operator>= (const unique_file_ptr< T > &ufp, std::nullptr_t) |
template<typename T > | |
bool | operator>= (std::nullptr_t, const unique_file_ptr< T > &ufp) |
template<typename T1 , typename T2 > | |
bool | operator< (const unique_file_ptr< T1 > &ufp1, const unique_file_ptr< T2 > &ufp2) |
template<typename T > | |
bool | operator< (const unique_file_ptr< T > &ufp, std::nullptr_t) |
template<typename T > | |
bool | operator< (std::nullptr_t, const unique_file_ptr< T > &ufp) |
template<typename T1 , typename T2 > | |
bool | operator<= (const unique_file_ptr< T1 > &ufp1, const unique_file_ptr< T2 > &ufp2) |
template<typename T > | |
bool | operator<= (const unique_file_ptr< T > &ufp, std::nullptr_t) |
template<typename T > | |
bool | operator<= (std::nullptr_t, const unique_file_ptr< T > &ufp) |
template<typename T > | |
void | swap (unique_file_ptr< T > ufp1, unique_file_ptr< T > ufp2) |
template<typename CharT , typename Traits , typename T > | |
std::basic_ostream< CharT, Traits > & | operator<< (std::basic_ostream< CharT, Traits > &ostream, const unique_file_ptr< T > &ufp) |
template<typename T > | |
unique_file_ptr< T > | make_unique_file (const std::string &fpath, bool mlock=false) |
template<typename ExecutionPolicy , typename ForwardIterator , typename Op > | |
auto | create_workhint_range (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, Op op, std::size_t n_leaves) |
template<typename ExecutionPolicy , typename ForwardIterator , typename Op > | |
auto | create_workhint_range (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, Op op) |
void | init (MPI_Comm comm=MPI_COMM_WORLD) |
Initialize Itoyori (collective). More... | |
void | fini () |
Finalize Itoyori (collective). More... | |
rank_t | my_rank () |
Return the rank of the process running the current thread. More... | |
rank_t | n_ranks () |
Return the total number of processes. More... | |
bool | is_master () |
Return true if ityr::my_rank() == 0 . More... | |
bool | is_root () |
Return true if the current thread is the root thread. More... | |
void | migrate_to (rank_t target_rank) |
Migrate the current thread to target_rank . For the root thread only. More... | |
void | migrate_to_master () |
Migrate the current thread to the master worker (of rank 0). More... | |
bool | is_spmd () |
Return true if the current execution context is within the SPMD region. More... | |
void | barrier () |
Barrier for all processes (collective). More... | |
wallclock_t | gettime_ns () |
Return the current wallclock time in nanoseconds. More... | |
void | profiler_begin () |
Start the profiler (collective). More... | |
void | profiler_end () |
Stop the profiler (collective). More... | |
void | profiler_flush () |
Print the profiled results to stdout (collective). More... | |
void | print_compile_options () |
Print the compile-time options to stdout. More... | |
void | print_runtime_options () |
Print the runtime options to stdout. More... | |
template<typename T > | |
bool | operator== (const count_iterator< T > &it1, const count_iterator< T > &it2) |
template<typename T > | |
bool | operator!= (const count_iterator< T > &it1, const count_iterator< T > &it2) |
template<typename T > | |
bool | operator< (const count_iterator< T > &it1, const count_iterator< T > &it2) |
template<typename T > | |
bool | operator> (const count_iterator< T > &it1, const count_iterator< T > &it2) |
template<typename T > | |
bool | operator<= (const count_iterator< T > &it1, const count_iterator< T > &it2) |
template<typename T > | |
bool | operator>= (const count_iterator< T > &it1, const count_iterator< T > &it2) |
template<typename T > | |
auto | make_count_iterator (T x) |
template<typename T , typename Mode > | |
global_iterator< T, Mode > | make_global_iterator (ori::global_ptr< T > gptr, Mode) |
Make a global iterator to enable/disable automatic checkout. More... | |
template<typename T > | |
global_move_iterator< global_iterator< T, internal::src_checkout_mode_t< T > > > | make_move_iterator (ori::global_ptr< T > gptr) |
Make a global iterator for moving objects. More... | |
template<typename T , typename Mode > | |
global_reverse_iterator< global_iterator< T, Mode > > | make_reverse_iterator (ori::global_ptr< T > gptr, Mode mode) |
Make a reverse iterator for global memory. More... | |
template<typename GlobalIterator > | |
global_construct_iterator< GlobalIterator > | make_construct_iterator (GlobalIterator git) |
Make a global iterator for constructing objects. More... | |
template<typename T > | |
global_construct_iterator< global_iterator< T, checkout_mode::write_t > > | make_construct_iterator (ori::global_ptr< T > gptr) |
Make a global iterator for constructing objects. More... | |
template<typename GlobalIterator > | |
global_destruct_iterator< GlobalIterator > | make_destruct_iterator (GlobalIterator git) |
Make a global iterator for destructing objects. More... | |
template<typename T > | |
global_destruct_iterator< global_iterator< T, checkout_mode::read_write_t > > | make_destruct_iterator (ori::global_ptr< T > gptr) |
Make a global iterator for destructing objects. More... | |
template<typename T , typename Mode > | |
global_move_iterator< global_iterator< T, Mode > > | make_move_iterator (global_iterator< T, Mode > git) |
Make a global iterator for moving objects. More... | |
template<typename GlobalIterator > | |
global_move_iterator< global_reverse_iterator< GlobalIterator > > | make_move_iterator (global_reverse_iterator< GlobalIterator > git) |
Make a global iterator for moving objects. More... | |
template<typename T , typename Mode > | |
global_reverse_iterator< global_iterator< T, Mode > > | make_reverse_iterator (global_iterator< T, Mode > git) |
Make a reverse iterator for global memory. More... | |
template<typename GlobalIterator > | |
global_reverse_iterator< global_move_iterator< GlobalIterator > > | make_reverse_iterator (global_move_iterator< GlobalIterator > git) |
Make a reverse iterator for global memory. More... | |
template<typename ExecutionPolicy , typename BidirectionalIterator , typename Predicate > | |
BidirectionalIterator | stable_partition (const ExecutionPolicy &policy, BidirectionalIterator first, BidirectionalIterator last, Predicate pred) |
Partition elements into two disjoint parts in place. More... | |
template<typename ExecutionPolicy , typename BidirectionalIterator , typename Predicate > | |
BidirectionalIterator | partition (const ExecutionPolicy &policy, BidirectionalIterator first, BidirectionalIterator last, Predicate pred) |
Partition elements into two disjoint parts in place. More... | |
template<typename... Args> | |
auto | parallel_invoke (Args &&... args) |
Fork parallel tasks and join them. More... | |
template<typename ExecutionPolicy , typename ForwardIterator , typename Op > | |
void | for_each (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, Op op) |
Apply an operator to each element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename Op > | |
void | for_each (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, Op op) |
Apply an operator to each element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename ForwardIterator3 , typename Op > | |
void | for_each (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator3 first3, Op op) |
Apply an operator to each element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename ForwardIterator3 , typename ForwardIterator4 , typename Op > | |
void | for_each (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator3 first3, ForwardIterator4 first4, Op op) |
Apply an operator to each element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename ForwardIterator3 , typename ForwardIterator4 , typename ForwardIterator5 , typename Op > | |
void | for_each (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator3 first3, ForwardIterator4 first4, ForwardIterator5 first5, Op op) |
Apply an operator to each element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename ForwardIterator3 , typename ForwardIterator4 , typename ForwardIterator5 , typename ForwardIterator6 , typename Op > | |
void | for_each (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator3 first3, ForwardIterator4 first4, ForwardIterator5 first5, ForwardIterator6 first6, Op op) |
Apply an operator to each element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename ForwardIterator3 , typename ForwardIterator4 , typename ForwardIterator5 , typename ForwardIterator6 , typename ForwardIterator7 , typename Op > | |
void | for_each (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator3 first3, ForwardIterator4 first4, ForwardIterator5 first5, ForwardIterator6 first6, ForwardIterator6 first7, Op op) |
Apply an operator to each element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename ForwardIterator3 , typename ForwardIterator4 , typename ForwardIterator5 , typename ForwardIterator6 , typename ForwardIterator7 , typename ForwardIterator8 , typename Op > | |
void | for_each (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator3 first3, ForwardIterator4 first4, ForwardIterator5 first5, ForwardIterator6 first6, ForwardIterator6 first7, ForwardIterator6 first8, Op op) |
Apply an operator to each element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIteratorD , typename UnaryOp > | |
ForwardIteratorD | transform (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d, UnaryOp unary_op) |
Transform elements in a given range and store them in another range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename ForwardIteratorD , typename BinaryOp > | |
ForwardIteratorD | transform (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIteratorD first_d, BinaryOp binary_op) |
Transform elements in given ranges and store them in another range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator , typename T > | |
void | fill (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, const T &value) |
Fill a range with a given value. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIteratorD > | |
ForwardIteratorD | copy (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d) |
Copy a range to another. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIteratorD > | |
ForwardIteratorD | move (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d) |
Move a range to another. More... | |
template<typename ExecutionPolicy , typename BidirectionalIterator > | |
void | reverse (const ExecutionPolicy &policy, BidirectionalIterator first, BidirectionalIterator last) |
Reverse a range. More... | |
template<typename ExecutionPolicy , typename BidirectionalIterator1 , typename BidirectionalIteratorD > | |
BidirectionalIteratorD | reverse_copy (const ExecutionPolicy &policy, BidirectionalIterator1 first1, BidirectionalIterator1 last1, BidirectionalIteratorD first_d) |
Copy a reversed range to another. More... | |
template<typename ExecutionPolicy , typename BidirectionalIterator > | |
BidirectionalIterator | rotate (const ExecutionPolicy &policy, BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last) |
Rotate a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIteratorD > | |
ForwardIteratorD | rotate_copy (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 middle1, ForwardIterator1 last1, ForwardIteratorD first_d) |
Copy a rotated range to another. More... | |
template<typename ExecutionPolicy , typename RandomAccessIterator , typename Compare > | |
void | inplace_merge (const ExecutionPolicy &policy, RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp) |
Merge two sorted ranges into one sorted range in place. More... | |
template<typename ExecutionPolicy , typename RandomAccessIterator > | |
void | inplace_merge (const ExecutionPolicy &policy, RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last) |
Merge two sorted ranges into one sorted range in place. More... | |
template<typename ExecutionPolicy , typename ForwardIterator , typename Reducer , typename UnaryTransformOp > | |
Reducer::accumulator_type | transform_reduce (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, Reducer reducer, UnaryTransformOp unary_transform_op) |
Calculate reduction while transforming each element. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename Reducer , typename BinaryTransformOp > | |
Reducer::accumulator_type | transform_reduce (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, Reducer reducer, BinaryTransformOp binary_transform_op) |
Calculate reduction by transforming each element. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 > | |
auto | transform_reduce (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2) |
Calculate a dot product. More... | |
template<typename ExecutionPolicy , typename ForwardIterator , typename Reducer > | |
Reducer::accumulator_type | reduce (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, Reducer reducer) |
Calculate reduction. More... | |
template<typename ExecutionPolicy , typename ForwardIterator > | |
std::iterator_traits< ForwardIterator >::value_type | reduce (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last) |
Calculate reduction. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIteratorD , typename Reducer , typename UnaryTransformOp > | |
ForwardIteratorD | transform_inclusive_scan (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d, Reducer reducer, UnaryTransformOp unary_transform_op, typename Reducer::accumulator_type &&init) |
Calculate a prefix sum (inclusive scan) while transforming each element. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIteratorD , typename Reducer , typename UnaryTransformOp > | |
ForwardIteratorD | transform_inclusive_scan (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d, Reducer reducer, UnaryTransformOp unary_transform_op) |
Calculate a prefix sum (inclusive scan) while transforming each element. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIteratorD , typename Reducer > | |
ForwardIteratorD | inclusive_scan (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d, Reducer reducer, typename Reducer::accumulator_type &&init) |
Calculate a prefix sum (inclusive scan). More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIteratorD , typename Reducer > | |
ForwardIteratorD | inclusive_scan (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d, Reducer reducer) |
Calculate a prefix sum (inclusive scan). More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIteratorD > | |
ForwardIteratorD | inclusive_scan (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d) |
Calculate a prefix sum (inclusive scan). More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename BinaryPredicate > | |
bool | equal (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate pred) |
Check if two ranges have equal values. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 , typename BinaryPredicate > | |
bool | equal (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred) |
Check if two ranges have equal values. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 > | |
bool | equal (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2) |
Check if two ranges have equal values. More... | |
template<typename ExecutionPolicy , typename ForwardIterator1 , typename ForwardIterator2 > | |
bool | equal (const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2) |
Check if two ranges have equal values. More... | |
template<typename ExecutionPolicy , typename ForwardIterator , typename Compare > | |
bool | is_sorted (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, Compare comp) |
Check if a range is sorted. More... | |
template<typename ExecutionPolicy , typename ForwardIterator > | |
bool | is_sorted (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last) |
Check if a range is sorted. More... | |
template<typename ExecutionPolicy , typename ForwardIterator , typename Compare > | |
ForwardIterator | min_element (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, Compare comp) |
Search for the minimum element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator > | |
ForwardIterator | min_element (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last) |
Search for the minimum element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator , typename Compare > | |
ForwardIterator | max_element (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, Compare comp) |
Search for the maximum element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator > | |
ForwardIterator | max_element (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last) |
Search for the maximum element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator , typename Compare > | |
std::pair< ForwardIterator, ForwardIterator > | minmax_element (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last, Compare comp) |
Search for the minimum and maximum element in a range. More... | |
template<typename ExecutionPolicy , typename ForwardIterator > | |
std::pair< ForwardIterator, ForwardIterator > | minmax_element (const ExecutionPolicy &policy, ForwardIterator first, ForwardIterator last) |
Search for the minimum and maximum element in a range. More... | |
template<typename ExecutionPolicy , typename RandomAccessIterator , typename UniformRandomBitGenerator > | |
void | shuffle (const ExecutionPolicy &policy, RandomAccessIterator first, RandomAccessIterator last, UniformRandomBitGenerator &&urbg) |
Randomly shuffle elements in a range. More... | |
template<typename ExecutionPolicy , typename RandomAccessIterator , typename Compare > | |
void | stable_sort (const ExecutionPolicy &policy, RandomAccessIterator first, RandomAccessIterator last, Compare comp) |
Stable sort for a range. More... | |
template<typename ExecutionPolicy , typename RandomAccessIterator > | |
void | stable_sort (const ExecutionPolicy &policy, RandomAccessIterator first, RandomAccessIterator last) |
Stable sort for a range. More... | |
template<typename ExecutionPolicy , typename RandomAccessIterator , typename Compare > | |
void | sort (const ExecutionPolicy &policy, RandomAccessIterator first, RandomAccessIterator last, Compare comp) |
Sort a range. More... | |
template<typename ExecutionPolicy , typename RandomAccessIterator > | |
void | sort (const ExecutionPolicy &policy, RandomAccessIterator first, RandomAccessIterator last) |
Sort a range. More... | |
template<typename Fn , typename... Args> | |
auto | root_exec (Fn &&fn, Args &&... args) |
Spawn the root thread (collective). More... | |
template<typename Fn , typename... Args> | |
auto | coll_exec (const Fn &fn, const Args &... args) |
Execute the same function collectively on all processes. More... | |
template<typename BidirectionalIterator1 , typename BidirectionalIteratorD > | |
BidirectionalIteratorD | move_backward (const execution::sequenced_policy &policy, BidirectionalIterator1 first1, BidirectionalIterator1 last1, BidirectionalIteratorD first_d) |
Variables | |
template<typename T > | |
constexpr bool | is_global_iterator_v = is_global_iterator<T>::value |
True if T is a global iterator (ityr::global_iterator ). More... | |
using ityr::default_random_engine = typedef internal::random_engine_dummy |
using ityr::rank_t = typedef common::topology::rank_t |
Process rank (ID) starting from 0 (corresponding to an MPI rank).
ityr::my_rank()
ityr::n_ranks()
using ityr::wallclock_t = typedef common::wallclock::wallclock_t |
Wallclock time in nanoseconds.
ityr::gettime_ns()
.
|
inline |
Barrier for all processes (collective).
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inline |
Execute the same function collectively on all processes.
fn | Function object to be called on all processes. |
args... | Argments to be passed to fn (optional). |
fn(args...)
executed on the calling process.This function switches from the root thread to the SPMD region to execute fn(args...)
on all processes. This function must be called by the root thread (within ityr::root_exec()
). The return value of fn(args...)
on the process calling this function is returned, and those on other processes are discarded. This function returns when all processes complete the function.
Example:
ityr::root_exec()
|
inline |
Copy a range to another.
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
first_d + (last1 - first1)
).This function copies the input region [first1, last1)
to the output region [first_d, first_d + (last1 - first1))
. Copy semantics is applied to each element in the ranges.
If given iterators are global pointers, they are automatically checked out in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators. Input global pointers (first1
and last1
) are automatically checked out with the read-only mode. if their value type is trivially copyable; otherwise, they are checked out with the read-write mode, even if they are actually not modified. Similarly, output global iterator (first_d
) are checked out with the write-only mode if their value type is trivially copyable; otherwise, they are checked out with the read-write mode.
The input and output regions should not be overlapped.
Example:
|
inline |
|
inline |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inline |
Check if two ranges have equal values.
policy | Execution policy (ityr::execution ). |
first1 | 1st begin iterator. |
last1 | 1st end iterator. |
first2 | 2nd begin iterator. |
Equivalent to ityr::equal(policy, first1, last1, first2, std::equal_to<>{})
.
|
inline |
Check if two ranges have equal values.
policy | Execution policy (ityr::execution ). |
first1 | 1st begin iterator. |
last1 | 1st end iterator. |
first2 | 2nd begin iterator. |
pred | Binary predicate operator. |
pred
returns true for all pairs of elements in the input ranges ([first1, last1)
and [first2, first2 + (last1 - first1))
).If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Check if two ranges have equal values.
policy | Execution policy (ityr::execution ). |
first1 | 1st begin iterator. |
last1 | 1st end iterator. |
first2 | 2nd begin iterator. |
last2 | 2nd end iterator. |
Equivalent to ityr::equal(policy, first1, last1, first2, last2, std::equal_to<>{})
.
|
inline |
Check if two ranges have equal values.
policy | Execution policy (ityr::execution ). |
first1 | 1st begin iterator. |
last1 | 1st end iterator. |
first2 | 2nd begin iterator. |
last2 | 2nd end iterator. |
pred | Binary predicate operator. |
last1 - first1 == last2 - first2
) and pred
returns true for all pairs of elements in the input ranges.If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Fill a range with a given value.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
value | Value to be filled with. |
This function assigns value
to every element in the given range [first, last)
.
If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Finalize Itoyori (collective).
This function finalizes the Itoyori runtime system. Any itoyori APIs cannot be called after this call unless ityr::init()
is called again.
MPI_Finalize()
may be called in this function if MPI is not initialized by the user when ityr::init()
is called.
ityr::init()
|
inline |
Apply an operator to each element in a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
op | Operator for the i-th element in the range. |
This function iterates over the given range and applies the operator op
to the i-th element. The operator op
should accept an argument of type T
, which is the reference type of the given iterator type. This function resembles the standard std::for_each()
, but it is extended to accept multiple streams of iterators.
Global pointers are not automatically checked out. If global iterators are explicitly given (by ityr::make_global_iterator
), the regions are automatically checked out with the specified mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel).
Example:
|
inline |
Apply an operator to each element in a range.
|
inline |
Apply an operator to each element in a range.
|
inline |
Apply an operator to each element in a range.
|
inline |
Apply an operator to each element in a range.
|
inline |
Apply an operator to each element in a range.
|
inline |
Apply an operator to each element in a range.
policy | Execution policy (ityr::execution ). |
first1 | 1st begin iterator. |
last1 | 1st end iterator. |
first2 | 2nd begin iterator. |
first3 | 3rd begin iterator. |
op | Operator for the i-th element in the 1st, 2nd, and 3rd iterators. |
This function iterates over the given ranges and applies the operator op
to the i-th elements. The operator op
should accept three arguments of type T1
, T2
, and T3
, which are the reference types of the given iterators first1
, first2
, and first3
. This function resembles the standard std::for_each()
, but it is extended to accept multiple streams of iterators.
Global pointers are not automatically checked out. If global iterators are explicitly given (by ityr::make_global_iterator
), the regions are automatically checked out with the specified mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel).
Example:
|
inline |
Apply an operator to each element in a range.
policy | Execution policy (ityr::execution ). |
first1 | 1st begin iterator. |
last1 | 1st end iterator. |
first2 | 2nd begin iterator. |
op | Operator for the i-th element in the 1st and 2nd iterators. |
This function iterates over the given ranges and applies the operator op
to the i-th elements. The operator op
should accept three arguments of type T1
and T2
, which are the reference types of the given iterators first1
and first2
. This function resembles the standard std::for_each()
, but it is extended to accept multiple streams of iterators.
Global pointers are not automatically checked out. If global iterators are explicitly given (by ityr::make_global_iterator
), the regions are automatically checked out with the specified mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel).
Example:
|
inline |
Return the current wallclock time in nanoseconds.
The wallclock time is calibrated across different processes (that may reside in different machines) at the program startup in a simple way, but the clock may be skewed due to various reasons. To get an accurate execution time, it is recommended to call this function in the same process and calculate the difference.
|
inline |
Calculate a prefix sum (inclusive scan).
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
first_d + (last1 - first1)
).Equivalent to ityr::inclusive_scan(policy, first1, last1, first_d, ityr::reducer::plus<T>{})
, where T
is the value type of the input iterator.
Example:
|
inline |
Calculate a prefix sum (inclusive scan).
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
reducer | Reducer object (ityr::reducer ). |
first_d + (last1 - first1)
).Equivalent to ityr::inclusive_scan(policy, first1, last1, first_d, reducer, reducer())
.
Example:
|
inline |
Calculate a prefix sum (inclusive scan).
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
reducer | Reducer object (ityr::reducer ). |
init | Initial value for the prefix sum. |
first_d + (last1 - first1)
).This function calculates a prefix sum over the elements in the input range [first1, last1)
. The prefix sum is inclusive, which means that the i-th element of the prefix sum includes the i-th element in the input range. That is, the i-th element of the prefix sum is: init + *first1 + ... + *(first1 + i)
, where +
is the associative binary operator (provided by reducer
). The calculated prefix sum is stored in the output range [first_d, first_d + (last1 - first1))
.
If given iterators are global pointers, they are automatically checked out in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators. Input global pointers (first1
and last1
) are automatically checked out with the read-only mode. Similarly, output global iterator (first_d
) are checked out with the write-only mode if their value type is trivially copyable; otherwise, they are checked out with the read-write mode.
Overlapping regions can be specified for the input and output ranges.
Unlike the standard std::inclusive_scan()
, Itoyori's ityr::inclusive_scan()
requires a reducer
as ityr::reduce()
does.
Example:
|
inline |
Initialize Itoyori (collective).
comm | MPI communicator to be used in Itoyori (default: MPI_COMM_WORLD ). |
This function initializes the Itoyori runtime system. Any itoyori APIs (except for runtime option settings) cannot be called prior to this call. ityr::fini()
must be called to properly release allocated resources.
If MPI is not initialized at this point, Itoyori calls MPI_Init()
and finalizes MPI by calling MPI_Finalize()
when ityr::fini()
is called. If MPI is already initialized at this point, Itoyori does not have the responsibility to finalize MPI.
ityr::fini()
|
inline |
Merge two sorted ranges into one sorted range in place.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
middle | Middle iterator that splits the two sorted ranges. |
last | End iterator. |
Equivalent to ityr::inplace_merge(policy, first, middle, last, std::less<>{});
Example:
|
inline |
Merge two sorted ranges into one sorted range in place.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
middle | Middle iterator that splits the two sorted ranges. |
last | End iterator. |
comp | Binary comparison operator. |
This function merges two sorted ranges ([first, middle)
and [middle, last)
) into one sorted range ([first, last)
) in place. This merge opreration is stable.
If global pointers are provided as iterators, they are automatically checked out with the read-write mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Return true if ityr::my_rank() == 0
.
ityr::my_rank()
|
inline |
Return true if the current thread is the root thread.
|
inline |
Check if a range is sorted.
policy | Execution policy (ityr::execution ). |
first | Input begin iterator. |
last | Input end iterator. |
*(first + i + 1) < *(first + i)
is false for all i
.Equivalent to is_sorted(policy, first, last, std::less<>{})
.
Example:
|
inline |
Check if a range is sorted.
policy | Execution policy (ityr::execution ). |
first | Input begin iterator. |
last | Input end iterator. |
comp | Binary comparison operator. |
comp(*(first + i + 1), *(first + i))
is false for all i
.This function checks if the given range is sorted with respect to the comparison operator comp
.
If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Return true if the current execution context is within the SPMD region.
|
inline |
Checkout a global memory region.
gspan | Global span to be checked out. |
mode | Checkout mode (ityr::checkout_mode ). |
ityr::checkout_span
for the specified range.Equivalent to ityr::make_checkout(gspan.data(), gspan.size(), mode)
.
|
inline |
Checkout a global memory region.
gptr | Starting global pointer. |
n | Number of elements to be checked out. |
mode | Checkout mode (ityr::checkout_mode ). |
ityr::checkout_span
for the specified range.This function checks out the global memory range [gptr, gptr + n)
. After this call, this virtual memory region becomes directly accessible by CPU load/store instructions. In programs, it is recommended to access the memory via the returned checkout span.
The checkout mode mode
can be either read
, read_write
, or write
.
read
or read_write
, the checked-out region has the latest data.read_write
or write
, the entire checked-out region is considered modified.The checkout span automatically performs a checkin operation when destroyed (e.g., when exiting the scope). The lifetime of the checkout span cannot overlap with any fork/join call, because threads can be migrated and a pair of checkout and checkin calls must be performed in the same process.
Overlapping regions can be checked out by multiple processes at the same time, as long as no data race occurs (i.e., all regions are checked out with ityr::checkout_mode::read
). Within each process, multiple regions can be simultaneously checked out with an arbitrary mode, and the memory ordering to the checked-out region is determined to the program order (because the same memory view is exposed to the process).
Example:
|
inline |
Checkout multiple global memory regions.
args... | Sequence of checkout requests. Each checkout request should be in the form of <global_ptr>, <num_elems>, <checkout_mode> or <global_span>, <checkout_mode> . |
This function performs multiple checkout operations at the same time. This may improve performance by overlapping communication to fetch remote data, compared to checking out one by one.
Example:
ityr::make_checkout()
|
inline |
Make a global iterator for constructing objects.
git | Global iterator (see ityr::make_global_iterator ). |
|
inline |
Make a global iterator for constructing objects.
gptr | Global pointer to be converted to global iterator. |
This function converts a global pointer to a global iterator for constructing objects. The region will be checked out with the ityr::checkout_mode::write
mode. Raw pointers (not references) are returned when iterators are dereferenced.
|
inline |
|
inline |
Make a global iterator for destructing objects.
git | Global iterator (see ityr::make_global_iterator ). |
|
inline |
Make a global iterator for destructing objects.
gptr | Global pointer to be converted to global iterator. |
This function converts a global pointer to a global iterator for destructing objects. The region will be checked out with the ityr::checkout_mode::read_write
mode. Raw pointers (not references) are returned when iterators are dereferenced.
|
inline |
Make a global iterator to enable/disable automatic checkout.
gptr | Global pointer to be converted to global iterator. |
mode | Checkout mode (ityr::checkout_mode ). |
ityr::global_iterator
).This function converts a global pointer to a global iterator to enable/disable automatic checkout. If the checkout mode is read
, read_write
, or write
, these iterators are automatically checked out in iterator-based loop functions (e.g., ityr::for_each()
). Some loop functions in which the access mode is clear from definition (e.g., ityr::reduce()
) automatically enable automatic checkout. If so, this explicit conversion is not needed.
ityr::checkout_mode::no_access
can be speficied to disable automatic checkout, so that iterator-based loop functions (e.g., ityr::transform_reduce()
) do not automatically enable automatic checkout. This would be required if parallelism is nested.
Example:
|
inline |
Make a global iterator for moving objects.
git | Global iterator (ityr::global_iterator ). |
ityr::global_move_iterator
).
|
inline |
Make a global iterator for moving objects.
git | Global iterator (ityr::global_reverse_iterator ). |
ityr::global_move_iterator
).
|
inline |
Make a global iterator for moving objects.
gptr | Global pointer to be converted to global iterator. |
ityr::global_move_iterator
).This function converts a global pointer to a global iterator for moving objects. The region will be checked out with the ityr::checkout_mode::read_write
mode. After the region is automatically checked out in generic loops, the raw pointers are wrapped with std::make_move_iterator
to force move semantics.
Example:
|
inline |
Make a reverse iterator for global memory.
git | Global iterator (ityr::global_iterator ). |
ityr::global_reverse_iterator
).
|
inline |
Make a reverse iterator for global memory.
git | Global iterator (ityr::global_move_iterator ). |
ityr::global_reverse_iterator
).
|
inline |
Make a reverse iterator for global memory.
gptr | Global pointer to be converted to global iterator. |
mode | Checkout mode (ityr::checkout_mode ). |
ityr::global_reverse_iterator
).This function converts a global pointer to a reverse global iterator with mode
.
|
inline |
|
inline |
Search for the maximum element in a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
[first, last)
.Equivalent to `ityrmax_element(policy, first, last, std::less<>{});
Example:
|
inline |
Search for the maximum element in a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
comp | Binary comparison operator. Returns true if the first argument is less than the second argument. |
[first, last)
.This function returns an iterator to the maximum element in the given range [first, last)
. If multiple maximum elements exist, the iterator to the first element is returned.
If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Migrate the current thread to target_rank
. For the root thread only.
|
inline |
Migrate the current thread to the master worker (of rank 0).
|
inline |
Search for the minimum element in a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
[first, last)
.Equivalent to `ityrmin_element(policy, first, last, std::less<>{});
Example:
|
inline |
Search for the minimum element in a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
comp | Binary comparison operator. Returns true if the first argument is less than the second argument. |
[first, last)
.This function returns an iterator to the minimum element in the given range [first, last)
. If multiple minimum elements exist, the iterator to the first element is returned.
If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Search for the minimum and maximum element in a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
[first, last)
.Equivalent to `ityrminmax_element(policy, first, last, std::less<>{});
Example:
|
inline |
Search for the minimum and maximum element in a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
comp | Binary comparison operator. Returns true if the first argument is less than the second argument. |
[first, last)
.This function returns a pair of iterators to the minimum (.first
) and maximum (.second
) element in the given range [first, last)
. If multiple minimum/maximum elements exist, the iterator to the first element is returned for each.
If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Move a range to another.
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
Equivalent to:
|
inline |
|
inline |
Return the rank of the process running the current thread.
ityr::n_ranks()
|
inline |
Return the total number of processes.
ityr::n_ranks()
|
inline |
bool ityr::operator!= | ( | const global_vector< T > & | x, |
const global_vector< T > & | y | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool ityr::operator== | ( | const global_vector< T > & | x, |
const global_vector< T > & | y | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Fork parallel tasks and join them.
args... | Sequence of function objects and their arguments in the form of fn1, (args1), fn2, (args2), ... , where fn1 is a function object and args1 is a tuple of arguments for fn1 , and so on. The tuples of arguments are optional if functions require no argument. |
std::monostate
is used as a placeholder.This function forks parallel tasks given as function objects and joins them at a time. This function blocks the current thread's execution until all of the child tasks are completed.
The executing process can be changed across this function call (due to thread migration).
Example:
|
inline |
Partition elements into two disjoint parts in place.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
pred | Predicate operator to determine a group. |
This function partitions the elements in the range [first, last)
into two disjoint parts, so that elements with pred(x) == true
precede those with pred(x) == false
. This partition operation may not be stable (see ityr::stable_partition()
).
If global pointers are provided as iterators, they are automatically checked out with the read-write mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Print the compile-time options to stdout.
ityr::print_runtime_options()
.
|
inline |
Print the runtime options to stdout.
ityr::print_compile_options()
.
|
inline |
Start the profiler (collective).
ityr::profiler_end()
. ityr::profiler_flush()
.
|
inline |
Stop the profiler (collective).
ityr::profiler_begin()
. ityr::profiler_flush()
.
|
inline |
Print the profiled results to stdout (collective).
ityr::profiler_begin()
. ityr::profiler_end()
.
|
inline |
Calculate reduction.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
Equivalent to ityr::reduce(policy, first, last, ityr::reducer::plus<T>{})
, where type T
is the value type of given iterators (ForwardIterator
).
|
inline |
Calculate reduction.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
reducer | Reducer object (ityr::reducer ). |
This function performs reduction over the elements in the given range [first, last)
.
If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Itoyori's reduce operation resembles the standard std::reduce()
, but it differs from the standard one in that ityr::reduce()
receives a reducer
. A reducer offers an associative binary operator that satisfies op(x, op(y, z)) == op(op(x, y), z)
, and an identity element that satisfies op(identity, x) = x
and op(x, identity) = x
. Note that commucativity is not required unlike the standard std::reduce()
.
TODO: How to define a reducer is to be documented.
Example:
|
inline |
Reverse a range.
policy | Execution policy (ityr::execution ). |
first | Input begin iterator. |
last | Input end iterator. |
This function reverses the input region [first1, last1)
(in-place).
If given iterators are global pointers, they are automatically checked out in the read-write mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Copy a reversed range to another.
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
Equivalent to:
|
inline |
Spawn the root thread (collective).
fn | Function object to be called by the root thread. |
args... | Argments to be passed to fn (optional). |
fn(args...)
.This function switches from the SPMD region to the root thread executing fn(args...)
. This function must be called by all processes collectively (i.e., in the SPMD region). This function returns when the root thread is completed and its return value is broadcasted to all processes.
The root thread is created and started by the master process (of rank 0), but it is not guaranteed to be continuously executed by the master process, because it can be migrated to other processes at fork/join calls.
Example:
ityr::coll_exec()
|
inline |
Rotate a range.
policy | Execution policy (ityr::execution ). |
first | Input begin iterator. |
middle | Input iterator to the element that should be placed at the beginning of the range. |
last | Input end iterator. |
first + (last - middle)
).This function performs the left rotation for the given range. The elements in the range are swapped so that the range [first, middle)
is placed before the range [middle, last)
, preserving the original order in each range.
If given iterators are global pointers, they are automatically checked out in the read-write mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Copy a rotated range to another.
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
middle1 | Input iterator to the element that should be placed at the beginning of the output range. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
first_d + (last1 - first1)
).This function copies the left rotation for the input range to the output range..
If given iterators are global pointers, they are automatically checked out in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators. Input global pointers (first1
and last1
) are automatically checked out with the read-only mode. if their value type is trivially copyable; otherwise, they are checked out with the read-write mode, even if they are actually not modified. Similarly, output global iterator (first_d
) are checked out with the write-only mode if their value type is trivially copyable; otherwise, they are checked out with the read-write mode.
Example:
|
inline |
Randomly shuffle elements in a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
urbg | Uniform random bit generator. It needs to be splittable if parallel. |
This function randomly shuffles the elements in the input range. Randomness is given by the random number generator urbg
.
Although the standard std::shuffle()
does not have a parallel variant, ityr::shuffle()
can be computed in parallel if a splittable random number generator is provided. A splittable random number generator has a member split()
to spawn an apparently independent child stream of random numbers. LXM is a representative splittable random number generator, which was presented in the following paper.
For a C++ implementation, see s417-lama/lxm_random. The default random number generator in Itoyori (ityr::default_random_engine
) uses LXM.
Example:
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inline |
Sort a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
Equivalent to ityr::sort(policy, first, last, std::less<>{})
.
Example:
|
inline |
Sort a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
This function sorts the given range ([first, last)
) in place. This sort may not be stable.
If global pointers are provided as iterators, they are automatically checked out with the read-write mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Partition elements into two disjoint parts in place.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
pred | Predicate operator to determine a group. |
This function partitions the elements in the range [first, last)
into two disjoint parts, so that elements with pred(x) == true
precede those with pred(x) == false
. This partition operation is stable, meaning that the original order of elements is preserved in each group.
If global pointers are provided as iterators, they are automatically checked out with the read-write mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Stable sort for a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
Equivalent to ityr::stable_sort(policy, first, last, std::less<>{})
.
|
inline |
Stable sort for a range.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
comp | Binary comparison operator. |
This function sorts the given range ([first, last)
) in place. This sort is stable.
If global pointers are provided as iterators, they are automatically checked out with the read-write mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inlinenoexcept |
|
inline |
|
inline |
Transform elements in given ranges and store them in another range.
policy | Execution policy (ityr::execution ). |
first1 | 1st input begin iterator. |
last1 | 1st input end iterator. |
first2 | 2nd input begin iterator. |
first_d | Output begin iterator (output). |
binary_op | Binary operator to transform a pair of each element. |
first_d + (last1 - first1)
).This function applies binary_op
to a pair of each element in the range [first1, last1)
and [first2, (last1 - first1))
, and the result is stored to the output range [first_d, first_d + (last1 - first1))
. The element order is preserved, and this operation corresponds to the higher-order map function. This function resembles the standard std::transform
.
If given iterators are global pointers, they are automatically checked out in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators. Input global pointers (first1
, last1
, and first2
) are automatically checked out with the read-only mode. Similarly, output global iterator (first_d
) are checked out with the write-only mode if their value type is trivially copyable; otherwise, they are checked out with the read-write mode.
Overlapping regions can be specified for the input and output ranges.
Example:
|
inline |
Transform elements in a given range and store them in another range.
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
unary_op | Unary operator to transform each element. |
first_d + (last1 - first1)
).This function applies unary_op
to each element in the range [first1, last1)
and stores the result to the output range [first_d, first_d + (last1 - first1))
. The element order is preserved, and this operation corresponds to the higher-order map function. This function resembles the standard std::transform
.
If given iterators are global pointers, they are automatically checked out in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators. Input global pointers (first1
and last1
) are automatically checked out with the read-only mode. Similarly, output global iterator (first_d
) are checked out with the write-only mode if their value type is trivially copyable; otherwise, they are checked out with the read-write mode.
Overlapping regions can be specified for the input and output ranges.
Example:
|
inline |
Calculate a prefix sum (inclusive scan) while transforming each element.
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
reducer | Reducer object (ityr::reducer ). |
unary_transform_op | Unary operator to transform each element. |
first_d + (last1 - first1)
).Equivalent to ityr::transform_inclusive_reduce(policy, first1, last1, first_d, reducer, unary_transform_op, reducer())
.
Example:
|
inline |
Calculate a prefix sum (inclusive scan) while transforming each element.
policy | Execution policy (ityr::execution ). |
first1 | Input begin iterator. |
last1 | Input end iterator. |
first_d | Output begin iterator. |
reducer | Reducer object (ityr::reducer ). |
unary_transform_op | Unary operator to transform each element. |
init | Initial value for the prefix sum. |
first_d + (last1 - first1)
).This function applies unary_transform_op
to each element in the range [first1, last1)
and calculates a prefix sum over them. The prefix sum is inclusive, which means that the i-th element of the prefix sum includes the i-th element in the input range. That is, the i-th element of the prefix sum is: init + f(*first1) + ... + f(*(first1 + i))
, where +
is the associative binary operator (provided by reducer
) and f()
is the transform operator (unary_transform_op
). The calculated prefix sum is stored in the output range [first_d, first_d + (last1 - first1))
.
If given iterators are global pointers, they are automatically checked out in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators. Input global pointers (first1
and last1
) are automatically checked out with the read-only mode. Similarly, output global iterator (first_d
) are checked out with the write-only mode if their value type is trivially copyable; otherwise, they are checked out with the read-write mode.
Overlapping regions can be specified for the input and output ranges.
Unlike the standard std::transform_inclusive_scan()
, Itoyori's ityr::transform_inclusive_scan()
requires a reducer
as ityr::reduce()
does.
Example:
|
inline |
Calculate reduction while transforming each element.
policy | Execution policy (ityr::execution ). |
first | Begin iterator. |
last | End iterator. |
reducer | Reducer object (ityr::reducer ). |
unary_transform_op | Unary operator to transform each element. |
This function applies unary_transform_op
to each element in the range [first, last)
and performs reduction over them.
If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators.
Example:
|
inline |
Calculate a dot product.
policy | Execution policy (ityr::execution ). |
first1 | 1st begin iterator. |
last1 | 1st end iterator. |
first2 | 2nd begin iterator. |
Equivalent to ityr::transform_reduce(policy, first1, last1, first2, ityr::reducer::plus<T>{}, std::multiplies<>{})
, where T
is the type of the expression (*first1) * (*first2)
. This corresponds to calculating a dot product of two vectors.
Example:
|
inline |
Calculate reduction by transforming each element.
policy | Execution policy (ityr::execution ). |
first1 | 1st begin iterator. |
last1 | 1st end iterator. |
first2 | 2nd begin iterator. |
reducer | Reducer object (ityr::reducer ). |
binary_transform_op | Binary operator to transform a pair of each element. |
This function applies binary_transform_op
to a pair of each element in the range [first1, last1)
and [first2, first2 + (last1 - first1)]
and performs reduction over them.
If global pointers are provided as iterators, they are automatically checked out with the read-only mode in the specified granularity (ityr::execution::sequenced_policy::checkout_count
if serial, or ityr::execution::parallel_policy::checkout_count
if parallel) without explicitly passing them as global iterators. The specified regions can be overlapped.
Example:
|
inlineconstexpr |
True if T
is a global iterator (ityr::global_iterator
).
ityr::make_global_iterator()
.