Skip to content

Commit 79f0510

Browse files
committed
Merge pull request #5 from jaredhoberock/master
Final pre-Rapperswil changes
2 parents 9897952 + 98df328 commit 79f0510

File tree

3 files changed

+104
-66
lines changed

3 files changed

+104
-66
lines changed

algorithms.html

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ <h1>Effect of execution policies on algorithm execution</h1>
133133

134134
<p>
135135
Algorithms invoked with an execution policy object of type <code>execution_policy</code>
136-
execute internally as if invoked with the contained execution policy object.
136+
execute internally as if invoked with <del>instances of type <code>sequential_execution_policy</code>,
137+
<code>parallel_execution_policy</code>, or an implementation-defined execution policy type depending
138+
on the dynamic value of the <code>execution_policy</code> object.</del>
139+
<ins>the contained execution policy object.</ins>
137140
</p>
138141

139142
<p>
@@ -148,8 +151,10 @@ <h1><code>ExecutionPolicy</code> algorithm overloads</h1>
148151
<p>
149152
Parallel algorithms coexist alongside their sequential counterparts as overloads
150153
distinguished by a formal template parameter named <code>ExecutionPolicy</code>. This
151-
is the first template parameter and corresponds to the parallel algorithm's first function
152-
parameter, whose type is <code>ExecutionPolicy&amp;&amp;</code>.
154+
<del>template parameter corresponds to the parallel algorithm's first function parameter, whose
155+
type is <code>ExecutionPolicy</code></del>
156+
<ins>is the first template parameter and corresponds to the parallel algorithm's first function
157+
parameter, whose type is <code>ExecutionPolicy&amp;&amp;</code></ins>.
153158
</p>
154159

155160
<p>
@@ -158,16 +163,18 @@ <h1><code>ExecutionPolicy</code> algorithm overloads</h1>
158163
</p>
159164

160165
<p>
161-
Parallel algorithms shall not participate in overload resolution unless
162-
<code>is_execution_policy&lt;ExecutionPolicy&gt;::value</code> is <code>true</code>.
166+
Parallel algorithms
167+
<del>have the requirement <code>is_execution_policy&lt;ExecutionPolicy&gt;::value</code> is <code>true</code></del>
168+
<ins>shall not participate in overload resolution unless
169+
<code>is_execution_policy&lt;ExecutionPolicy&gt;::value</code> is <code>true</code></ins>.
163170
</p>
164171

165172
<p>The algorithms listed in <cxx-ref to="tab.parallel.algorithms"></cxx-ref> shall have <code>ExecutionPolicy</code> overloads.</p>
166173

167174
<table is="cxx-table" id="tab.parallel.algorithms" class="list">
168175
<caption>Table of parallel algorithms</caption>
169176
<tr>
170-
<td>adjacent_difference</td>
177+
<td><ins>adjacent_difference</ins></td>
171178
<td>adjacent_find</td>
172179
<td>all_of</td>
173180
<td>any_of</td>
@@ -203,7 +210,7 @@ <h1><code>ExecutionPolicy</code> algorithm overloads</h1>
203210
<td>inclusive_scan</td>
204211
</tr>
205212
<tr>
206-
<td>inner_product</td>
213+
<td><ins>inner_product</ins></td>
207214
<td>inplace_merge</td>
208215
<td>is_heap</td>
209216
<td>is_heap_until</td>
@@ -378,9 +385,11 @@ <h1>For each</h1>
378385
its <code>Function</code> parameter, since parallelization may not permit efficient state
379386
accumulation.
380387

381-
Unlike its sequential form, the parallel overload of <code>for_each</code> requires
382-
<code>Function</code> to meet the requirements of <code>CopyConstructible</code>, but not
383-
<code>MoveConstructible</code>.
388+
<ins>
389+
Unlike its sequential form, the parallel overload of <code>for_each</code> requires
390+
<code>Function</code> to meet the requirements of <code>CopyConstructible</code>, but not
391+
<code>MoveConstructible</code>.
392+
</ins>
384393
</cxx-notes>
385394
</cxx-function>
386395

@@ -410,47 +419,49 @@ <h1>For each</h1>
410419
</cxx-effects>
411420

412421
<cxx-returns>
413-
<code>first + n</code> for non-negative values of <code>n</code> and <code>first</code> for negative values.
422+
<code>first + n</code><ins> for non-negative values of <code>n</code> and <code>first</code> for negative values</ins>.
414423
</cxx-returns>
415424

416425
<cxx-remarks>
417426
If <code>f</code> returns a result, the result is ignored.
418427
</cxx-remarks>
419428
</cxx-function>
420429

421-
<cxx-function>
422-
<cxx-signature>
423-
template&lt;class ExecutionPolicy,
424-
class InputIterator, class Size, class Function&gt;
425-
InputIterator for_each_n(ExecutionPolicy &amp;&amp; exec,
426-
InputIterator first, Size n,
427-
Function f);
428-
</cxx-signature>
429-
430-
<cxx-effects>
431-
Applies <code>f</code> to the result of dereferencing every iterator in the range
432-
<code>[first,first + n)</code>, starting from <code>first</code> and proceeding to <code>first + n - 1</code>.
433-
434-
<cxx-note>
435-
If the type of <code>first</code> satisfies the requirements of a mutable iterator,
436-
<code>f</code> may apply nonconstant functions through the dereferenced iterator.
437-
</cxx-note>
438-
</cxx-effects>
439-
440-
<cxx-returns>
441-
<code>first + n</code> for non-negative values of <code>n</code> and <code>first</code> for negative values.
442-
</cxx-returns>
443-
444-
<cxx-remarks>
445-
If <code>f</code> returns a result, the result is ignored.
446-
</cxx-remarks>
447-
448-
<cxx-notes>
449-
Unlike its sequential form, the parallel overload of <code>for_each_n</code> requires
450-
<code>Function</code> to meet the requirements of <code>CopyConstructible</code>, but not
451-
<code>MoveConstructible</code>.
452-
</cxx-notes>
453-
</cxx-function>
430+
<ins>
431+
<cxx-function>
432+
<cxx-signature>
433+
template&lt;class ExecutionPolicy,
434+
class InputIterator, class Size, class Function&gt;
435+
InputIterator for_each_n(ExecutionPolicy &amp;&amp; exec,
436+
InputIterator first, Size n,
437+
Function f);
438+
</cxx-signature>
439+
440+
<cxx-effects>
441+
Applies <code>f</code> to the result of dereferencing every iterator in the range
442+
<code>[first,first + n)</code>, starting from <code>first</code> and proceeding to <code>first + n - 1</code>.
443+
444+
<cxx-note>
445+
If the type of <code>first</code> satisfies the requirements of a mutable iterator,
446+
<code>f</code> may apply nonconstant functions through the dereferenced iterator.
447+
</cxx-note>
448+
</cxx-effects>
449+
450+
<cxx-returns>
451+
<code>first + n</code><ins> for non-negative values of <code>n</code> and <code>first</code> for negative values.
452+
</cxx-returns>
453+
454+
<cxx-remarks>
455+
If <code>f</code> returns a result, the result is ignored.
456+
</cxx-remarks>
457+
458+
<cxx-notes>
459+
Unlike its sequential form, the parallel overload of <code>for_each_n</code> requires
460+
<code>Function</code> to meet the requirements of <code>CopyConstructible</code>, but not
461+
<code>MoveConstructible</code>.
462+
</cxx-notes>
463+
</cxx-function>
464+
</ins>
454465
</cxx-section>
455466

456467
<cxx-section id="parallel.alg.novel.numeric.synop">
@@ -587,7 +598,7 @@ <h1>Reduce</h1>
587598

588599
<cxx-notes>
589600
The primary difference between <code>reduce</code> and <code>accumulate</code> is that the behavior
590-
of <code>reduce</code> may be non-deterministic for non-associative or non-commutative <code>binary_op</code>.
601+
of <code>reduce</code> may be non-deterministic for non-associative or non-commutative <del><code>operator+</code></del><ins><code>binary_op</code></ins>.
591602
</cxx-notes>
592603
</cxx-function>
593604
</cxx-section>

execution_policies.html

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@ <h1>In general</h1>
1212
<pre>std::vector&lt;int&gt; v = ...
1313

1414
// standard sequential sort
15-
std::sort(vec.begin(), vec.end());
15+
<del>std::sort(vec.begin(), vec.end());</del>
16+
<ins>std::sort(std::begin(vec), std::end(vec));</ins>
1617

1718
using namespace std::experimental::parallel;
1819

1920
// explicitly sequential sort
20-
sort(seq, v.begin(), v.end());
21+
<del>sort(seq, v.begin(), v.end());</del>
22+
<ins>sort(seq, std::begin(v), std::end(v));</ins>
2123

2224
// permitting parallel execution
23-
sort(par, v.begin(), v.end());
25+
<del>sort(par, v.begin(), v.end());</del>
26+
<ins>sort(par, std::begin(v), std::end(v));</ins>
2427

2528
// permitting vectorization as well
26-
sort(vec, v.begin(), v.end());
29+
<del>sort(vec, v.begin(), v.end());</del>
30+
<ins>sort(vec, std::begin(v), std::end(v));</ins>
2731

2832
// sort with dynamically-selected execution
2933
size_t threshold = ...
@@ -33,7 +37,8 @@ <h1>In general</h1>
3337
exec = par;
3438
}
3539

36-
sort(exec, v.begin(), v.end());</pre>
40+
<del>sort(exec, v.begin(), v.end());</del>
41+
<ins>sort(exec, std::begin(v), std::end(v));</ins></pre>
3742
</cxx-example><pre>
3843
</pre>
3944
<cxx-note>
@@ -172,15 +177,16 @@ <h1>Dynamic execution policy</h1>
172177
<cxx-example>
173178
<pre>std::vector&lt;float&gt; sort_me = ...
174179

175-
using namespace std::experimental::parallel;
176-
execution_policy exec = seq;
180+
<ins>using namespace std::experimental::parallel;</ins>
181+
<del><code>std::</code></del>execution_policy exec = <del><code>std::</code></del>seq;
177182

178183
if(sort_me.size() &gt; threshold)
179184
{
180185
exec = std::par;
181186
}
182187

183-
std::sort(exec, sort_me.begin(), sort_me.end());</pre>
188+
<del>std::sort(exec, sort_me.begin(), sort_me.end());</del>
189+
<ins>std::sort(exec, std::begin(sort_me), std::end(sort_me));</ins></pre>
184190
</cxx-example>
185191

186192
<p>Objects of type <code>execution_policy</code> shall be constructible and assignable from objects of
@@ -194,10 +200,17 @@ <h1><code>execution_policy</code> construct/assign</h1>
194200

195201
<cxx-effects>Constructs an <code>execution_policy</code> object with a copy of <code>exec</code>'s state.</cxx-effects>
196202

197-
<cxx-remarks>
198-
This constructor shall not participate in overload resolution unless
199-
<code>is_execution_policy&lt;T&gt;::value</code> is <code>true</code>.
200-
</cxx-remarks>
203+
<del>
204+
<cxx-requires>
205+
<code>is_execution_policy&lt;T&gt;::value</code> is <code>true</code>.
206+
</cxx-requires>
207+
</del>
208+
<ins>
209+
<cxx-remarks>
210+
This constructor shall not participate in overload resolution unless
211+
<code>is_execution_policy&lt;T&gt;::value</code> is <code>true</code>.
212+
</cxx-remarks>
213+
</ins>
201214
</cxx-function>
202215

203216
<cxx-function>
@@ -207,10 +220,17 @@ <h1><code>execution_policy</code> construct/assign</h1>
207220

208221
<cxx-returns><code>*this</code>.
209222

210-
<cxx-remarks>
211-
This operator shall not partipate in overload resolution unless
212-
<code>is_execution_policy&lt;T&gt;::value</code> is <code>true</code>.
213-
</cxx-remarks>
223+
<del>
224+
<cxx-requires>
225+
<code>is_execution_policy&lt;T&gt;::value</code> is <code>true</code>.
226+
</cxx-requires>
227+
</del>
228+
<ins>
229+
<cxx-remarks>
230+
This operator shall not partipate in overload resolution unless
231+
<code>is_execution_policy&lt;T&gt;::value</code> is <code>true</code>.
232+
</cxx-remarks>
233+
</ins>
214234
</cxx-function>
215235
</cxx-section>
216236

@@ -233,10 +253,17 @@ <h1><code>execution_policy</code> object access</h1>
233253

234254
<cxx-returns>If <code>target_type() == typeid(T)</code>, a pointer to the stored execution policy object; otherwise a null pointer.</cxx-returns>
235255

236-
<cxx-remarks>
237-
This function shall not participate in overload resolution unless
238-
<code>is_execution_policy&lt;T&gt;</code> is <code>true</code>.
239-
</cxx-remarks>
256+
<del>
257+
<cxx-requires>
258+
<code>is_execution_policy&lt;T&gt;::value</code> is <code>true</code>.
259+
</cxx-requires>
260+
</del>
261+
<ins>
262+
<cxx-remarks>
263+
This function shall not participate in overload resolution unless
264+
<code>is_execution_policy&lt;T&gt;</code> is <code>true</code>.
265+
</cxx-remarks>
266+
</ins>
240267
</cxx-function>
241268

242269
</cxx-section>

front_matter.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<cxx-titlepage stage="draft">
22
<cxx-docnum>N3989</cxx-docnum>
3-
<time pubdate="">2014-05-XX</time>
3+
<time pubdate="">2014-05-23</time>
44
<cxx-revises><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3960.pdf">N3960</a></cxx-revises>
55
<cxx-editor>
66
Jared Hoberock<br/>

0 commit comments

Comments
 (0)