Section: 26.3.3 [algorithms.parallel.exec] Status: C++17 Submitter: Jared Hoberock Opened: 2016-05-25 Last modified: 2017-07-30
Priority: Not Prioritized
View all other issues in [algorithms.parallel.exec].
View all issues with C++17 status.
Discussion:
The paragraph describing the effect of composing sequential_execution_policy
with parallel algorithms says:
The invocations of element access functions in parallel algorithms invoked with an execution policy object of type
sequential_execution_policy
are indeterminately sequenced (1.9) in the calling thread.
The intended behavior of sequential_execution_policy
is to match the classic-style algorithm semantics, cf.
26.3.5 [algorithms.parallel.overloads] p2:
Unless otherwise specified, the semantics of
ExecutionPolicy
algorithm overloads are identical to their overloads without.
Because many classic-style algorithms execute element access functions in a specified sequence,
26.3.3 [algorithms.parallel.exec] p2 introduces unintentionally different semantics between classic-style
algorithms and parallel algorithms invoked with sequential_execution_policy
.
The invocations of element access functions in parallel algorithms invoked with an execution policy object of type
sequential_execution_policy
execute in sequential order in the calling thread.
to
The invocations of element access functions in parallel algorithms invoked with an execution policy object of type
sequential_execution_policy
are indeterminately sequenced (1.9) in the calling thread.
Suggested resolution:
To restore the originally intended behavior ofsequential_execution_policy
, Jens Maurer suggests
replacing 26.3.3 [algorithms.parallel.exec] p2 with:
The invocations of element access functions in parallel algorithms invoked with an execution policy object of type
sequential_execution_policy
all occur in the calling thread. [Note: The invocations are not interleaved; see 6.9.1 [intro.execution] — end note]
[2016-06 Oulu]
Could be P0 after SG1 gives OK
Tuesday, Oulu: Hans Ok'd this
Friday: status to Immediate
Proposed resolution:
This wording is relative to N4582.
Change 26.3.3 [algorithms.parallel.exec] as indicated:
The invocations of element access functions in parallel algorithms invoked with an execution policy object of type
sequential_execution_policy
all occurare indeterminately sequenced (1.9)in the calling thread. [Note: The invocations are not interleaved; see 6.9.1 [intro.execution] — end note]