Skip to content

Commit d8e53d0

Browse files
committed
Merge Artur's changes due to feedback from SG1 & LWG
Revert change to inclusive_scan's 2nd signature Add is_execution_policy_v variable template Use the correct phrasing for is_execution_policy's specification Add exception_list::what()
1 parent 7994f87 commit d8e53d0

File tree

5 files changed

+166
-125
lines changed

5 files changed

+166
-125
lines changed

algorithms.html

Lines changed: 62 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,24 @@ <h1>Effect of execution policies on algorithm execution</h1>
3333
</cxx-note>
3434
</p>
3535

36-
<cxx-example><pre>using namespace std::experimental::parallel;
36+
<cxx-example><pre>using namespace std::experimental::parallel<ins2>_v1</ins2>;
3737
int a[] = {0,1};
3838
std::vector&lt;int&gt; v;
3939
for_each(par, std::begin(a), std::end(a), [&amp;](int i) {
4040
v.push_back(i*2+1);
4141
});
42-
foo bar</pre>
42+
<del2>foo bar</del2></pre>
4343

4444
The program above has a data race because of the unsynchronized access to the container
4545
<code>v</code>.
4646
</cxx-example><pre>
4747
</pre>
4848

4949
<cxx-example><pre>
50-
using namespace std::experimental::parallel;
51-
std::atomic<int> x = 0;
50+
using namespace std::experimental::parallel<ins2>_v1</ins2>;
51+
std::atomic<ins2>&lt;int></ins2> x = 0;
5252
int a[] = {1,2};
53-
for_each(par, std::begin(a), std::end(a), [](int n) {
53+
for_each(par, std::begin(a), std::end(a), [<ins2>&amp;</ins2>](int n) {
5454
x.fetch_add(1, std::memory_order_relaxed);
5555
// spin wait for another iteration to change the value of x
5656
while (x.load(std::memory_order_relaxed) == 1) { }
@@ -62,8 +62,8 @@ <h1>Effect of execution policies on algorithm execution</h1>
6262
</pre>
6363

6464
<cxx-example><pre>
65-
using namespace std::experimental::parallel;
66-
int x;
65+
using namespace std::experimental::parallel<ins2>_v1</ins2>;
66+
int x<ins2>=0</ins2>;
6767
std::mutex m;
6868
int a[] = {1,2};
6969
for_each(par, std::begin(a), std::end(a), [&amp;](int) {
@@ -78,21 +78,25 @@ <h1>Effect of execution policies on algorithm execution</h1>
7878

7979
<p>
8080
The applications of function objects in parallel algorithms invoked with an execution policy
81-
of type <code>vector_execution_policy</code> are permitted to execute in an unordered fashion
81+
of type <code><del2>vector_execution_policy</del2><ins2>parallel_vector_execution_policy</ins2></code> are permitted to execute in an unordered fashion
8282
in unspecified threads, and unsequenced within each thread.
83-
83+
<ins2>
84+
<cxx-note>
85+
This means that multiple function-object invocations may be interleaved on a single thread.
86+
</cxx-note>
87+
</ins2>
8488
<cxx-note>
85-
As a consequence, function objects governed by the <code>vector_execution_policy</code>
89+
As a consequence, function objects governed by the <code><del2>vector_execution_policy</del2><ins2>parallel_vector_execution_policy</ins2></code>
8690
policy must not synchronize with each other. Specifically, they must not acquire locks.
8791
</cxx-note>
8892
</p>
8993

9094
<cxx-example><pre>
91-
using namespace std::experimental::parallel;
92-
int x;
95+
using namespace std::experimental::parallel<ins2>_v1</ins2>;
96+
int x<ins2>=0</ins2>;
9397
std::mutex m;
9498
int a[] = {1,2};
95-
for_each(vec, std::begin(a), std::end(a), [&amp;](int) {
99+
for_each(par_vec, std::begin(a), std::end(a), [&amp;](int) {
96100
m.lock();
97101
++x;
98102
m.unlock();
@@ -111,15 +115,15 @@ <h1>Effect of execution policies on algorithm execution</h1>
111115

112116
<cxx-note>
113117
The semantics of the <code>parallel_execution_policy</code> or the
114-
<code>vector_execution_policy</code> invocation allow the implementation to fall back to
118+
<code><del2>vector_execution_policy</del2><ins2>parallel_vector_execution_policy</ins2></code> invocation allow the implementation to fall back to
115119
sequential execution if the system cannot parallelize an algorithm invocation due to lack of
116120
resources.
117121
</cxx-note>
118122

119123
<p>
120-
If they exist, a parallel algorithm invoked with an execution policy object of type
121-
<code>parallel_execution_policy</code> or <code>vector_execution_policy</code> may apply
122-
iterator member functions of a stronger category than its specification requires. In this
124+
<del2>If they exist, a</del2><ins2>A</ins2> parallel algorithm invoked with an execution policy object of type
125+
<code>parallel_execution_policy</code> or <code><del2>vector_execution_policy</del2><ins2>parallel_vector_execution_policy</ins2></code> may apply
126+
iterator member functions of a stronger category than its specification requires<ins2>, if such iterators exist</ins2>. In this
123127
case, the application of these member functions are subject to provisions 3. and 4. above,
124128
respectively.
125129
</p>
@@ -141,22 +145,32 @@ <h1>Effect of execution policies on algorithm execution</h1>
141145

142146
<p>
143147
The semantics of parallel algorithms invoked with an execution policy object of
144-
implementation-defined type are unspecified.
148+
implementation-defined type are <del2>unspecified</del2><ins2>implementation-defined</ins2>.
145149
</p>
146150
</cxx-section>
147151

148152
<cxx-section id="parallel.alg.overloads">
149153
<h1><code>ExecutionPolicy</code> algorithm overloads</h1>
150154

151155
<p>
156+
<del2>
152157
Parallel algorithms coexist alongside their sequential counterparts as overloads
153158
distinguished by a formal template parameter named <code>ExecutionPolicy</code>. This
154159
<del>template parameter corresponds to the parallel algorithm's first function parameter, whose
155160
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>.
161+
<insdel>is the first template parameter and corresponds to the parallel algorithm's first function
162+
parameter, whose type is <code>ExecutionPolicy&amp;&amp;</code></insdel>.</del2>
163+
<ins2>
164+
The Parallel Algorithms Library provides overloads for each of the algorithms named in
165+
Table 1, corresponding to the algorithms with the same name in the C++ Standard Algorithms Library.
166+
For each algorithm in <cxx-ref to="tab.parallel.algorithms"></cxx-ref>, there shall be overloads with an additional
167+
template type parameter named <code>ExecutionPolicy</code>, which is the first template parameter.
168+
In addition, each such overload shall have the new function parameter as the
169+
first function parameter of type <code>ExecutionPolicy&amp;&amp;</code>.
170+
</ins2>
171+
158172
</p>
159-
173+
160174
<p>
161175
Unless otherwise specified, the semantics of <code>ExecutionPolicy</code> algorithm overloads
162176
are identical to their overloads without.
@@ -169,7 +183,7 @@ <h1><code>ExecutionPolicy</code> algorithm overloads</h1>
169183
<code>is_execution_policy&lt;ExecutionPolicy&gt;::value</code> is <code>true</code></ins>.
170184
</p>
171185

172-
<p>The algorithms listed in <cxx-ref to="tab.parallel.algorithms"></cxx-ref> shall have <code>ExecutionPolicy</code> overloads.</p>
186+
<del2><p>The algorithms listed in <cxx-ref to="tab.parallel.algorithms"></cxx-ref> shall have <code>ExecutionPolicy</code> overloads.</p></del2>
173187

174188
<table is="cxx-table" id="tab.parallel.algorithms" class="list">
175189
<caption>Table of parallel algorithms</caption>
@@ -301,12 +315,13 @@ <h1>Definitions</h1>
301315
<li><code>a1</code> when <code>N</code> is <code>1</code></li>
302316

303317
<li>
304-
<code>op(<em>GENERALIZED_SUM</em>(op, b1, ..., bM)</code>, <code><em>GENERALIZED_SUM</em>(op, bM, ..., bN))</code> where
318+
<code>op(<em>GENERALIZED_SUM</em>(op, b1, ..., b<del2>M</del2><ins2>K</ins2>)</code>, <code><em>GENERALIZED_SUM</em>(op, bM, ..., bN))</code> where
305319

306320
<ul>
307321
<li><code>b1, ..., bN</code> may be any permutation of <code>a1, ..., aN</code> and</li>
308322

309-
<li><code>0 &lt; M &lt; N</code>.</li>
323+
<del2><li><code>0 &lt; M &lt; N</code>.</li></del2>
324+
<ins2><li><code>1 &lt; K+1 = M &le; N</code>.</li></ins2>
310325
</ul>
311326
</li>
312327
</ul>
@@ -319,24 +334,24 @@ <h1>Definitions</h1>
319334
<li><code>a1</code> when <code>N</code> is <code>1</code></li>
320335

321336
<li>
322-
<code>op(<em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(op, a1, ..., aM), <em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(op, aM, ..., aN)</code> where <code>0 &lt; M &lt; N</code>.
337+
<code>op(<em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(op, a1, ..., a<del2>M</del2><ins2>K</ins2>), <em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(op, aM, ..., aN)</code> where <del2><code>0 &lt; M &lt; N</code></del2> <ins2><code>1 &lt; K+1 = M &le; N</code></ins2>.
323338
</li>
324339
</ul>
325340
</p>
326341
</cxx-section>
327342

328-
<cxx-section id="parallel.alg.novel">
343+
<cxx-section id="parallel.alg.added">
329344
<h1>Novel algorithms</h1>
330345

331346
This subclause describes novel algorithms introduced by this Technical Specification.
332347

333-
<cxx-section id="parallel.alg.novel.algorithms.synop">
348+
<cxx-section id="parallel.alg.added.algorithms.synop">
334349
<h1>Header <code>&lt;experimental/algorithm&gt;</code> synopsis</h1>
335350

336351
<pre>
337352
namespace std {
338353
namespace experimental {
339-
namespace parallel {
354+
namespace parallel<ins2>_v1</ins2> {
340355
template&lt;class ExecutionPolicy,
341356
class InputIterator, class Function&gt;
342357
void for_each(ExecutionPolicy&amp;&amp; exec,
@@ -351,7 +366,7 @@ <h1>Header <code>&lt;experimental/algorithm&gt;</code> synopsis</h1>
351366
</pre>
352367
</cxx-section>
353368

354-
<cxx-section id="parallel.alg.novel.foreach">
369+
<cxx-section id="parallel.alg.added.foreach">
355370
<h1>For each</h1>
356371

357372
<cxx-function>
@@ -384,13 +399,14 @@ <h1>For each</h1>
384399
Unlike its sequential form, the parallel overload of <code>for_each</code> does not return a copy of
385400
its <code>Function</code> parameter, since parallelization may not permit efficient state
386401
accumulation.
387-
402+
</cxx-notes>
403+
<cxx-requires>
388404
<ins>
389405
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>.
406+
<code>Function</code> to meet the requirements of <code>CopyConstructible</code><insdel>, but not
407+
<code>MoveConstructible</code></insdel>.
392408
</ins>
393-
</cxx-notes>
409+
</cxx-requires>
394410
</cxx-function>
395411

396412
<cxx-function>
@@ -464,18 +480,18 @@ <h1>For each</h1>
464480
</ins>
465481
</cxx-section>
466482

467-
<cxx-section id="parallel.alg.novel.numeric.synop">
483+
<cxx-section id="parallel.alg.added.numeric.synop">
468484
<h1>Header <code>&lt;experimental/numeric&gt;</code></h1>
469485

470486
<pre>
471487
namespace std {
472488
namespace experimental {
473-
namespace parallel {
489+
namespace parallel<ins2>_v1</ins2> {
474490
template&lt;class InputIterator&gt;
475491
typename iterator_traits&lt;InputIterator&gt;::value_type
476492
reduce(InputIterator first, InputIterator last);
477493
template&lt;class InputIterator, class T&gt;
478-
T reduce(InputIterator first, InputIterator last T init);
494+
T reduce(InputIterator first, InputIterator last<ins2>,</ins2> T init);
479495
template&lt;class InputIterator, class T, class BinaryOperation&gt;
480496
T reduce(InputIterator first, InputIterator last, T init,
481497
BinaryOperation binary_op);
@@ -506,7 +522,7 @@ <h1>Header <code>&lt;experimental/numeric&gt;</code></h1>
506522
OutputIterator
507523
inclusive_scan(InputIterator first, InputIterator last,
508524
OutputIterator result,
509-
BinaryOperation binary_op);
525+
T init);
510526
template&lt;class InputIterator, class OutputIterator,
511527
class T, class BinaryOperation&gt;
512528
OutputIterator
@@ -519,7 +535,7 @@ <h1>Header <code>&lt;experimental/numeric&gt;</code></h1>
519535
</pre>
520536
</cxx-section>
521537

522-
<cxx-section id="parallel.alg.novel.reduce">
538+
<cxx-section id="parallel.alg.added.reduce">
523539
<h1>Reduce</h1>
524540

525541
<cxx-function>
@@ -584,7 +600,7 @@ <h1>Reduce</h1>
584600
</cxx-signature>
585601

586602
<cxx-returns>
587-
<code><em>GENERALIZED_SUM</em>(binary_op, init, *first, ..., *(first + last - first - 1))</code>.
603+
<code><em>GENERALIZED_SUM</em>(binary_op, init, *first, ..., <del2>*(first + last - first - 1)</del2><ins2>*(first + (last - first) - 1)</ins2>)</code>.
588604
</cxx-returns>
589605

590606
<cxx-requires>
@@ -603,7 +619,7 @@ <h1>Reduce</h1>
603619
</cxx-function>
604620
</cxx-section>
605621

606-
<cxx-section id="parallel.alg.novel.exclusive.scan">
622+
<cxx-section id="parallel.alg.added.exclusive.scan">
607623
<h1>Exclusive scan</h1>
608624

609625
<cxx-function>
@@ -650,7 +666,7 @@ <h1>Exclusive scan</h1>
650666

651667
<cxx-effects>
652668
Assigns through each iterator <code>i</code> in <code>[result,result + (last - first))</code> the
653-
value of <code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(binary_op, init, *first, ..., (*first + i - result - 1))</code>.
669+
value of <code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(binary_op, init, *first, ..., <del2>(*first + i - result - 1)</del2><ins2>*(first + (i - result) - 1)</ins2>)</code>.
654670
</cxx-effects>
655671

656672
<cxx-returns>
@@ -675,7 +691,7 @@ <h1>Exclusive scan</h1>
675691
</cxx-function>
676692
</cxx-section>
677693

678-
<cxx-section id="parallel.alg.novel.inclusive.scan">
694+
<cxx-section id="parallel.alg.added.inclusive.scan">
679695
<h1>Inclusive scan</h1>
680696

681697
<cxx-function>
@@ -702,7 +718,7 @@ <h1>Inclusive scan</h1>
702718
</cxx-complexity>
703719

704720
<cxx-notes>
705-
The primary difference between <code>exclusive_scan</code> and <code>inclusive_scan</code> is that
721+
The <del2>primary</del2> difference between <code>exclusive_scan</code> and <code>inclusive_scan</code> is that
706722
<code>exclusive_scan</code> excludes the <code>i</code>th input element from the <code>i</code>th sum.
707723
If the <code>operator+</code> function is not mathematically associative, the behavior of
708724
<code>inclusive_scan</code> may be non-deterministic.
@@ -728,8 +744,8 @@ <h1>Inclusive scan</h1>
728744

729745
<cxx-effects>
730746
Assigns through each iterator <code>i</code> in <code>[result,result + (last - first))</code> the value of
731-
<code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(binary_op, *first, ..., (*first + i - result))</code> or
732-
<code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(binary_op, init, *first, ..., (*first + i - result))</code>
747+
<code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(binary_op, *first, ..., <del2>(*first + i - result)</del2><ins2>*(first + (i - result))</ins2>)</code> or
748+
<code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(binary_op, init, *first, ..., <del2>(*first + i - result)</del2><ins2>*(first + (i - result))</ins2>)</code>
733749
if <code>init</code> is provided.
734750
</cxx-effects>
735751

@@ -747,7 +763,7 @@ <h1>Inclusive scan</h1>
747763
</cxx-complexity>
748764

749765
<cxx-notes>
750-
The primary difference between <code>exclusive_scan</code> and <code>inclusive_scan</code> is that
766+
The <del2>primary</del2> difference between <code>exclusive_scan</code> and <code>inclusive_scan</code> is that
751767
<code>inclusive_scan</code> includes the <code>i</code>th input element in the <code>i</code>th sum.
752768
If <code>binary_op</code> is not mathematically associative, the behavior of
753769
<code>inclusive_scan</code> may be non-deterministic.

bower_components/cxx-html-doc-framework/base.css

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,13 @@ cxx-titlepage { page: title; page-break-after: always; }
3636

3737
@media print {
3838
html { font-size: 10pt; }
39-
* /deep/ code { font-size: 80%; }
39+
* /deep/ pre, * /deep/ code { font-size: 8pt; }
4040
/* Note that only Prince generates clickable links. */
4141
* /deep/ a[href] { text-decoration:none; }
4242
}
4343

44-
@media screen {
45-
/* Needed to make the <cxx-titlepage>'s vertical spacing work.
46-
For print see the <cxx-titlepage> definition. */
47-
html, body {height: 100%}
48-
}
44+
/* Needed to make the <cxx-titlepage>'s vertical spacing work. */
45+
html, body {height: 100%}
4946

5047
cxx-docnum { string-set: docnum content(); }
5148

@@ -77,30 +74,29 @@ p:first-child, ul, ol {margin-top: 0}
7774
del {text-decoration: line-through; color: #8B0040;}
7875
ins {text-decoration: underline; color: #005100;}
7976

77+
del2 {text-decoration: line-through; color: #FF0040; font-size:100%;}
78+
ins2 {text-decoration: underline; color: #FF0040; font-size:100%;}
79+
/* inserted in TS and then deleted for LWG */
80+
insdel {text-decoration: line-through; color: #FF4440; font-size:100%;}
81+
8082
pre {
8183
margin-left: 1em;
8284
margin-top: .5em;
8385
margin-bottom: .5em;
8486
}
87+
pre > code { display: inline-block; }
8588

86-
/* Use an em-dash for the list bullet.
87-
'print' is a proxy for supporting ::marker. */
88-
@media screen {
89-
ul {
90-
list-style: none;
91-
/* Relative positioning on the 'ul' lets the absolutely-positioned
92-
marker align relative to it.*/
93-
position: relative;
94-
}
95-
ul li:before {
96-
content: "\2014";
97-
position: absolute; left: 10px;
98-
}
89+
90+
/* Use an em-dash for the list bullet. */
91+
ul {
92+
list-style: none;
93+
/* Relative positioning on the 'ul' lets the absolutely-positioned
94+
marker align relative to it.*/
95+
position: relative;
9996
}
100-
@media print {
101-
ul li::marker {
102-
content: "\2014";
103-
}
97+
ul li:before {
98+
content: "\2014";
99+
position: absolute; left: 10px;
104100
}
105101

106102
/* This is here rather than inside elements/toc.html because browsers

0 commit comments

Comments
 (0)