tmp/tmp7maxnkra/{from.md → to.md}
RENAMED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
-
## Execution policies <a id="execpol">[[execpol]]</a>
|
| 2 |
|
| 3 |
-
###
|
| 4 |
|
| 5 |
Subclause [[execpol]] describes classes that are *execution policy*
|
| 6 |
types. An object of an execution policy type indicates the kinds of
|
| 7 |
parallelism allowed in the execution of an algorithm and expresses the
|
| 8 |
-
consequent requirements on the element access functions.
|
|
|
|
| 9 |
|
| 10 |
[*Example 1*:
|
| 11 |
|
| 12 |
``` cpp
|
| 13 |
using namespace std;
|
|
@@ -27,48 +28,18 @@ sort(execution::par_unseq, v.begin(), v.end());
|
|
| 27 |
```
|
| 28 |
|
| 29 |
— *end example*]
|
| 30 |
|
| 31 |
[*Note 1*: Implementations can provide additional execution policies to
|
| 32 |
-
those described in this
|
| 33 |
architectures that require idiosyncratic parameters for efficient
|
| 34 |
execution. — *end note*]
|
| 35 |
|
| 36 |
-
###
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
-
namespace std {
|
| 40 |
-
// [execpol.type], execution policy type trait
|
| 41 |
template<class T> struct is_execution_policy;
|
| 42 |
-
template<class T> constexpr bool is_execution_policy_v = is_execution_policy<T>::value;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
namespace std::execution {
|
| 46 |
-
// [execpol.seq], sequenced execution policy
|
| 47 |
-
class sequenced_policy;
|
| 48 |
-
|
| 49 |
-
// [execpol.par], parallel execution policy
|
| 50 |
-
class parallel_policy;
|
| 51 |
-
|
| 52 |
-
// [execpol.parunseq], parallel and unsequenced execution policy
|
| 53 |
-
class parallel_unsequenced_policy;
|
| 54 |
-
|
| 55 |
-
// [execpol.unseq], unsequenced execution policy
|
| 56 |
-
class unsequenced_policy;
|
| 57 |
-
|
| 58 |
-
// [execpol.objects], execution policy objects
|
| 59 |
-
inline constexpr sequenced_policy seq{ unspecified };
|
| 60 |
-
inline constexpr parallel_policy par{ unspecified };
|
| 61 |
-
inline constexpr parallel_unsequenced_policy par_unseq{ unspecified };
|
| 62 |
-
inline constexpr unsequenced_policy unseq{ unspecified };
|
| 63 |
-
}
|
| 64 |
-
```
|
| 65 |
-
|
| 66 |
-
### Execution policy type trait <a id="execpol.type">[[execpol.type]]</a>
|
| 67 |
-
|
| 68 |
-
``` cpp
|
| 69 |
-
template<class T> struct is_execution_policy { see below };
|
| 70 |
```
|
| 71 |
|
| 72 |
`is_execution_policy` can be used to detect execution policies for the
|
| 73 |
purpose of excluding function signatures from otherwise ambiguous
|
| 74 |
overload resolution participation.
|
|
@@ -82,11 +53,11 @@ non-standard execution policies to the library
|
|
| 82 |
implementation. — *end note*]
|
| 83 |
|
| 84 |
The behavior of a program that adds specializations for
|
| 85 |
`is_execution_policy` is undefined.
|
| 86 |
|
| 87 |
-
### Sequenced execution policy <a id="execpol.seq">[[execpol.seq]]</a>
|
| 88 |
|
| 89 |
``` cpp
|
| 90 |
class execution::sequenced_policy { unspecified };
|
| 91 |
```
|
| 92 |
|
|
@@ -97,11 +68,11 @@ require that a parallel algorithm’s execution may not be parallelized.
|
|
| 97 |
During the execution of a parallel algorithm with the
|
| 98 |
`execution::sequenced_policy` policy, if the invocation of an element
|
| 99 |
access function exits via an exception, `terminate` is
|
| 100 |
invoked [[except.terminate]].
|
| 101 |
|
| 102 |
-
### Parallel execution policy <a id="execpol.par">[[execpol.par]]</a>
|
| 103 |
|
| 104 |
``` cpp
|
| 105 |
class execution::parallel_policy { unspecified };
|
| 106 |
```
|
| 107 |
|
|
@@ -112,11 +83,11 @@ indicate that a parallel algorithm’s execution may be parallelized.
|
|
| 112 |
During the execution of a parallel algorithm with the
|
| 113 |
`execution::parallel_policy` policy, if the invocation of an element
|
| 114 |
access function exits via an exception, `terminate` is
|
| 115 |
invoked [[except.terminate]].
|
| 116 |
|
| 117 |
-
### Parallel and unsequenced execution policy <a id="execpol.parunseq">[[execpol.parunseq]]</a>
|
| 118 |
|
| 119 |
``` cpp
|
| 120 |
class execution::parallel_unsequenced_policy { unspecified };
|
| 121 |
```
|
| 122 |
|
|
@@ -128,11 +99,11 @@ parallelized and vectorized.
|
|
| 128 |
During the execution of a parallel algorithm with the
|
| 129 |
`execution::parallel_unsequenced_policy` policy, if the invocation of an
|
| 130 |
element access function exits via an exception, `terminate` is
|
| 131 |
invoked [[except.terminate]].
|
| 132 |
|
| 133 |
-
### Unsequenced execution policy <a id="execpol.unseq">[[execpol.unseq]]</a>
|
| 134 |
|
| 135 |
``` cpp
|
| 136 |
class execution::unsequenced_policy { unspecified };
|
| 137 |
```
|
| 138 |
|
|
@@ -142,14 +113,14 @@ that a parallel algorithm’s execution may be vectorized, e.g., executed
|
|
| 142 |
on a single thread using instructions that operate on multiple data
|
| 143 |
items.
|
| 144 |
|
| 145 |
During the execution of a parallel algorithm with the
|
| 146 |
`execution::unsequenced_policy` policy, if the invocation of an element
|
| 147 |
-
access function exits via an exception, `terminate` is
|
| 148 |
-
[[except.terminate]].
|
| 149 |
|
| 150 |
-
### Execution policy objects <a id="execpol.objects">[[execpol.objects]]</a>
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
inline constexpr execution::sequenced_policy execution::seq{ unspecified };
|
| 154 |
inline constexpr execution::parallel_policy execution::par{ unspecified };
|
| 155 |
inline constexpr execution::parallel_unsequenced_policy execution::par_unseq{ unspecified };
|
|
|
|
| 1 |
+
### Execution policies <a id="execpol">[[execpol]]</a>
|
| 2 |
|
| 3 |
+
#### General <a id="execpol.general">[[execpol.general]]</a>
|
| 4 |
|
| 5 |
Subclause [[execpol]] describes classes that are *execution policy*
|
| 6 |
types. An object of an execution policy type indicates the kinds of
|
| 7 |
parallelism allowed in the execution of an algorithm and expresses the
|
| 8 |
+
consequent requirements on the element access functions. Execution
|
| 9 |
+
policy types are declared in header `<execution>`.
|
| 10 |
|
| 11 |
[*Example 1*:
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
using namespace std;
|
|
|
|
| 28 |
```
|
| 29 |
|
| 30 |
— *end example*]
|
| 31 |
|
| 32 |
[*Note 1*: Implementations can provide additional execution policies to
|
| 33 |
+
those described in this document as extensions to address parallel
|
| 34 |
architectures that require idiosyncratic parameters for efficient
|
| 35 |
execution. — *end note*]
|
| 36 |
|
| 37 |
+
#### Execution policy type trait <a id="execpol.type">[[execpol.type]]</a>
|
| 38 |
|
| 39 |
``` cpp
|
|
|
|
|
|
|
| 40 |
template<class T> struct is_execution_policy;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
```
|
| 42 |
|
| 43 |
`is_execution_policy` can be used to detect execution policies for the
|
| 44 |
purpose of excluding function signatures from otherwise ambiguous
|
| 45 |
overload resolution participation.
|
|
|
|
| 53 |
implementation. — *end note*]
|
| 54 |
|
| 55 |
The behavior of a program that adds specializations for
|
| 56 |
`is_execution_policy` is undefined.
|
| 57 |
|
| 58 |
+
#### Sequenced execution policy <a id="execpol.seq">[[execpol.seq]]</a>
|
| 59 |
|
| 60 |
``` cpp
|
| 61 |
class execution::sequenced_policy { unspecified };
|
| 62 |
```
|
| 63 |
|
|
|
|
| 68 |
During the execution of a parallel algorithm with the
|
| 69 |
`execution::sequenced_policy` policy, if the invocation of an element
|
| 70 |
access function exits via an exception, `terminate` is
|
| 71 |
invoked [[except.terminate]].
|
| 72 |
|
| 73 |
+
#### Parallel execution policy <a id="execpol.par">[[execpol.par]]</a>
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
class execution::parallel_policy { unspecified };
|
| 77 |
```
|
| 78 |
|
|
|
|
| 83 |
During the execution of a parallel algorithm with the
|
| 84 |
`execution::parallel_policy` policy, if the invocation of an element
|
| 85 |
access function exits via an exception, `terminate` is
|
| 86 |
invoked [[except.terminate]].
|
| 87 |
|
| 88 |
+
#### Parallel and unsequenced execution policy <a id="execpol.parunseq">[[execpol.parunseq]]</a>
|
| 89 |
|
| 90 |
``` cpp
|
| 91 |
class execution::parallel_unsequenced_policy { unspecified };
|
| 92 |
```
|
| 93 |
|
|
|
|
| 99 |
During the execution of a parallel algorithm with the
|
| 100 |
`execution::parallel_unsequenced_policy` policy, if the invocation of an
|
| 101 |
element access function exits via an exception, `terminate` is
|
| 102 |
invoked [[except.terminate]].
|
| 103 |
|
| 104 |
+
#### Unsequenced execution policy <a id="execpol.unseq">[[execpol.unseq]]</a>
|
| 105 |
|
| 106 |
``` cpp
|
| 107 |
class execution::unsequenced_policy { unspecified };
|
| 108 |
```
|
| 109 |
|
|
|
|
| 113 |
on a single thread using instructions that operate on multiple data
|
| 114 |
items.
|
| 115 |
|
| 116 |
During the execution of a parallel algorithm with the
|
| 117 |
`execution::unsequenced_policy` policy, if the invocation of an element
|
| 118 |
+
access function exits via an exception, `terminate` is
|
| 119 |
+
invoked [[except.terminate]].
|
| 120 |
|
| 121 |
+
#### Execution policy objects <a id="execpol.objects">[[execpol.objects]]</a>
|
| 122 |
|
| 123 |
``` cpp
|
| 124 |
inline constexpr execution::sequenced_policy execution::seq{ unspecified };
|
| 125 |
inline constexpr execution::parallel_policy execution::par{ unspecified };
|
| 126 |
inline constexpr execution::parallel_unsequenced_policy execution::par_unseq{ unspecified };
|