This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
[execpol.general]
# 26 Algorithms library [[algorithms]](./#algorithms)
## 26.3 Parallel algorithms [[algorithms.parallel]](algorithms.parallel#execpol.general)
### 26.3.6 Execution policies [[execpol]](execpol#general)
#### 26.3.6.1 General [execpol.general]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L636)
Subclause [[execpol]](execpol "26.3.6Execution policies") describes classes that are [*execution policy*](#def:execution_policy "26.3.6.1General[execpol.general]") types[.](#1.sentence-1)
An
object of an execution policy type indicates the kinds of parallelism allowed
in the execution of an algorithm and expresses the consequent requirements on
the element access functions[.](#1.sentence-2)
Execution policy types are declared in header [<execution>](execution.syn#header:%3cexecution%3e "33.4Header <execution> synopsis[execution.syn]")[.](#1.sentence-3)
[*Example [1](#example-1)*: using namespace std;
vector<int> v = /* ... */;
// standard sequential sort sort(v.begin(), v.end());
// explicitly sequential sort sort(execution::seq, v.begin(), v.end());
// permitting parallel execution sort(execution::par, v.begin(), v.end());
// permitting vectorization as well sort(execution::par_unseq, v.begin(), v.end()); — *end example*]
[*Note [1](#note-1)*:
Implementations can provide additional execution policies
to those described in this document as extensions
to address parallel architectures that require idiosyncratic
parameters for efficient execution[.](#1.sentence-4)
— *end note*]

View File

@@ -0,0 +1,23 @@
[execpol.objects]
# 26 Algorithms library [[algorithms]](./#algorithms)
## 26.3 Parallel algorithms [[algorithms.parallel]](algorithms.parallel#execpol.objects)
### 26.3.6 Execution policies [[execpol]](execpol#objects)
#### 26.3.6.7 Execution policy objects [execpol.objects]
[🔗](#lib:seq)
`inline constexpr execution::sequenced_policy execution::seq{ unspecified };
inline constexpr execution::parallel_policy execution::par{ unspecified };
inline constexpr execution::parallel_unsequenced_policy execution::par_unseq{ unspecified };
inline constexpr execution::unsequenced_policy execution::unseq{ unspecified };
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L795)
The header [<execution>](execution.syn#header:%3cexecution%3e "33.4Header <execution> synopsis[execution.syn]") declares global objects associated with each type of execution policy[.](#1.sentence-1)

30
cppdraft/execpol/par.md Normal file
View File

@@ -0,0 +1,30 @@
[execpol.par]
# 26 Algorithms library [[algorithms]](./#algorithms)
## 26.3 Parallel algorithms [[algorithms.parallel]](algorithms.parallel#execpol.par)
### 26.3.6 Execution policies [[execpol]](execpol#par)
#### 26.3.6.4 Parallel execution policy [execpol.par]
[🔗](#lib:execution::parallel_policy)
`class execution::parallel_policy { unspecified };
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L724)
The class execution::parallel_policy is an execution policy type used as
a unique type to disambiguate parallel algorithm overloading and indicate that
a parallel algorithm's execution may be parallelized[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L729)
During the execution of a parallel algorithm with
the execution::parallel_policy policy,
if the invocation of an element access function exits via an exception,terminate is invoked ([[except.terminate]](except.terminate "14.6.2The std::terminate function"))[.](#2.sentence-1)

View File

@@ -0,0 +1,31 @@
[execpol.parunseq]
# 26 Algorithms library [[algorithms]](./#algorithms)
## 26.3 Parallel algorithms [[algorithms.parallel]](algorithms.parallel#execpol.parunseq)
### 26.3.6 Execution policies [[execpol]](execpol#parunseq)
#### 26.3.6.5 Parallel and unsequenced execution policy [execpol.parunseq]
[🔗](#lib:execution::parallel_unsequenced_policy)
`class execution::parallel_unsequenced_policy { unspecified };
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L744)
The class execution::parallel_unsequenced_policy is an execution policy type
used as a unique type to disambiguate parallel algorithm overloading and
indicate that a parallel algorithm's execution may be parallelized and
vectorized[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L750)
During the execution of a parallel algorithm with
the execution::parallel_unsequenced_policy policy,
if the invocation of an element access function exits via an exception,terminate is invoked ([[except.terminate]](except.terminate "14.6.2The std::terminate function"))[.](#2.sentence-1)

30
cppdraft/execpol/seq.md Normal file
View File

@@ -0,0 +1,30 @@
[execpol.seq]
# 26 Algorithms library [[algorithms]](./#algorithms)
## 26.3 Parallel algorithms [[algorithms.parallel]](algorithms.parallel#execpol.seq)
### 26.3.6 Execution policies [[execpol]](execpol#seq)
#### 26.3.6.3 Sequenced execution policy [execpol.seq]
[🔗](#lib:execution::sequenced_policy)
`class execution::sequenced_policy { unspecified };
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L704)
The class execution::sequenced_policy is an execution policy type used
as a unique type to disambiguate parallel algorithm overloading and require
that a parallel algorithm's execution may not be parallelized[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L709)
During the execution of a parallel algorithm with
the execution::sequenced_policy policy,
if the invocation of an element access function exits via an exception,terminate is invoked ([[except.terminate]](except.terminate "14.6.2The std::terminate function"))[.](#2.sentence-1)

44
cppdraft/execpol/type.md Normal file
View File

@@ -0,0 +1,44 @@
[execpol.type]
# 26 Algorithms library [[algorithms]](./#algorithms)
## 26.3 Parallel algorithms [[algorithms.parallel]](algorithms.parallel#execpol.type)
### 26.3.6 Execution policies [[execpol]](execpol#type)
#### 26.3.6.2 Execution policy type trait [execpol.type]
[🔗](#lib:is_execution_policy)
`template<class T> struct is_execution_policy;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L675)
is_execution_policy can be used to detect execution policies for the
purpose of excluding function signatures from otherwise ambiguous overload
resolution participation[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L680)
is_execution_policy<T> is a *Cpp17UnaryTypeTrait* with a
base characteristic of true_type if T is the type of a standard
or implementation-defined
execution policy, otherwise false_type[.](#2.sentence-1)
[*Note [1](#note-1)*:
This provision reserves the privilege of creating non-standard execution
policies to the library implementation[.](#2.sentence-2)
— *end note*]
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L691)
The behavior of a program that adds specializations foris_execution_policy is undefined[.](#3.sentence-1)

32
cppdraft/execpol/unseq.md Normal file
View File

@@ -0,0 +1,32 @@
[execpol.unseq]
# 26 Algorithms library [[algorithms]](./#algorithms)
## 26.3 Parallel algorithms [[algorithms.parallel]](algorithms.parallel#execpol.unseq)
### 26.3.6 Execution policies [[execpol]](execpol#unseq)
#### 26.3.6.6 Unsequenced execution policy [execpol.unseq]
[🔗](#lib:execution::unsequenced_policy)
`class execution::unsequenced_policy { unspecified };
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L765)
The class unsequenced_policy is an execution policy type
used as a unique type to disambiguate parallel algorithm overloading and
indicate that a parallel algorithm's execution may be vectorized,
e.g., executed on a single thread using instructions
that operate on multiple data items[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L772)
During the execution of a parallel algorithm with
the execution::unsequenced_policy policy,
if the invocation of an element access function exits via an exception,terminate is invoked ([[except.terminate]](except.terminate "14.6.2The std::terminate function"))[.](#2.sentence-1)