Title
Parallelism bug in [algorithms.parallel.exec] p2
Status
c++17
Section
[algorithms.parallel.exec]
Submitter
Jared Hoberock

Created on 2016-05-25.00:00:00 last changed 89 months ago

Messages

Date: 2016-06-20.16:35:58

Proposed resolution:

This wording is relative to N4582.

  1. Change [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 [intro.execution]end note]

Date: 2016-06-27.16:42:33

[ 2016-06 Oulu ]

Could be P0 after SG1 gives OK

Tuesday, Oulu: Hans Ok'd this

Friday: status to Immediate

Date: 2016-05-25.00:00:00

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. [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, [algorithms.parallel.exec] p2 introduces unintentionally different semantics between classic-style algorithms and parallel algorithms invoked with sequential_execution_policy.

The unintentional change to [algorithms.parallel.exec] p2 was introduced in the revision from P0024R1 to P0024R0 when the wording was changed from

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 of sequential_execution_policy, Jens Maurer suggests replacing [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 [intro.execution]end note]

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-06-28 13:14:43adminsetstatus: immediate -> wp
2016-06-27 16:42:33adminsetstatus: open -> immediate
2016-06-20 16:35:58adminsetmessages: + msg8182
2016-06-20 16:35:58adminsetstatus: new -> open
2016-05-29 13:09:54adminsetmessages: + msg8155
2016-05-25 00:00:00admincreate