Extensions for parallelism - cppreference.com (original) (raw)
Extensions for parallelism
![]() |
Merged into ISO C++ The functionality described on this page was merged into the mainline ISO C++ standard (except for dynamic execution policy and exception_list) as of 3/2016; see the algorithm library (since C++17) |
---|
The C++ Extensions for Parallelism, ISO/IEC TS 19570:2015 defines the following new components for the C++ standard library:
Contents
- 1 Execution policies
- 2 Exception lists
- 3 Parallelized versions of existing algorithms
- 4 New algorithms
[edit] Execution policies
The parallelism TS describes three execution policies: sequential, parallel, and parallel+vector, and provides corresponding execution policy types and objects. Users may select an execution policy statically by invoking a parallel algorithm with the an execution policy object of the corresponding type, or dynamically by using the type-erasing execution_policy
class.
Implementations may define additional execution policies as an extension. The semantics of parallel algorithms invoked with an execution policy object of implementation-defined type is implementation-defined.
[edit] Exception lists
[edit] Parallelized versions of existing algorithms
The TS provides parallelized versions of the following 69 algorithms from , and :
[edit] New algorithms
Defined in header <experimental/algorithm> | |
---|---|
for_each | similar to std::for_each except returns void (function template) |
for_each_n | applies a function object to the first n elements of a sequence (function template) |
Defined in header <experimental/numeric> | |
reduce(parallelism TS) | similar to std::accumulate, except out of order (function template) [edit] |
exclusive_scan | similar to std::partial_sum, excludes the ith input element from the ith sum (function template) |
inclusive_scan | similar to std::partial_sum, includes the ith input element in the ith sum (function template) |
transform_reduce(parallelism TS) | applies a functor, then reduces out of order (function template) [edit] |
transform_exclusive_scan | applies a functor, then calculates exclusive scan (function template) |
transform_inclusive_scan | applies a functor, then calculates inclusive scan (function template) |