|
1 | 1 | <cxx-clause id="parallel.execpol">
|
2 | 2 | <h1>Execution policies</h1>
|
3 |
| - <del><cxx-section id="parallel.execpol.general"></del> |
4 |
| - <del> |
5 |
| - <h1>In general</h1> |
6 |
| - <p> |
7 |
| - This clause describes classes that are <dfn>execution policy</dfn> types. An object |
8 |
| - of an execution policy type indicates the kinds of parallelism allowed in the execution |
9 |
| - of an algorithm and expresses the consequent requirements on the element |
10 |
| - access functions. |
11 |
| - </p> |
12 |
| - |
13 |
| - <cxx-example> |
14 |
| - <pre>std::vector<int> v = ... |
15 |
| - |
16 |
| -// standard sequential sort |
17 |
| -std::sort(v.begin(), v.end()); |
18 |
| - |
19 |
| -using namespace std::experimental::parallel; |
20 | 3 |
|
21 |
| -// explicitly sequential sort |
22 |
| -sort(seq, v.begin(), v.end()); |
23 |
| - |
24 |
| -// permitting parallel execution |
25 |
| -sort(par, v.begin(), v.end()); |
26 |
| - |
27 |
| -// permitting vectorization as well |
28 |
| -sort(par_vec, v.begin(), v.end()); |
29 |
| - |
30 |
| -// sort with dynamically-selected execution |
31 |
| -size_t threshold = ... |
32 |
| -execution_policy exec = seq; |
33 |
| -if (v.size() > threshold) |
34 |
| -{ |
35 |
| - exec = par; |
36 |
| -} |
37 |
| - |
38 |
| -sort(exec, v.begin(), v.end()); |
39 |
| -</pre> |
40 |
| - </cxx-example><pre> |
41 |
| -</pre> |
42 |
| - <cxx-note> |
43 |
| - Because different parallel architectures may require idiosyncratic |
44 |
| - parameters for efficient execution, implementations of the Standard Library |
45 |
| - may provide additional execution policies to those described in this |
46 |
| - Technical Specification as extensions. |
47 |
| - </cxx-note> |
48 |
| - </del> |
49 |
| - </cxx-section> |
50 | 4 | <cxx-section id="parallel.execpol.synopsis">
|
51 | 5 | <h1>Header <code><experimental/execution<del>_policy</del>></code> synopsis</h1>
|
52 | 6 |
|
|
0 commit comments