Skip to content

Commit 17d2829

Browse files
committed
Merge pull request #36 from jaredhoberock/master
Changes for new DTS ballot doc
2 parents 6140007 + 3835fa2 commit 17d2829

File tree

6 files changed

+222
-120
lines changed

6 files changed

+222
-120
lines changed

algorithms.html

Lines changed: 100 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ <h1>Effect of execution policies on algorithm execution</h1>
3535
<p>
3636
The invocations of element access functions in parallel algorithms invoked with an execution
3737
policy object of type <code>parallel_execution_policy</code> are permitted to execute in an
38-
unordered fashion in <del>unspecified threads</del><ins>either the invoking thread or in a
39-
thread implicitly created by the library to support parallel algorithm execution.</ins>
40-
<del>, and</del> <ins>Any such invocations executing in the same thread are</ins> indeterminately
41-
sequenced <del>within each thread</del><ins>with respect to each other</ins>.
38+
unordered fashion in either the invoking thread or in a thread implicitly created by the library
39+
to support parallel algorithm execution. Any such invocations executing in the same thread are
40+
indeterminately sequenced with respect to each other.
4241

4342
<cxx-note>
4443
It is the caller's responsibility to ensure correctness, for example that the invocation does
@@ -296,9 +295,9 @@ <h1><code>ExecutionPolicy</code> algorithm overloads</h1>
296295
<td><code>transform</code></td>
297296
</tr>
298297
<tr>
299-
<td><code><ins>transform_exclusive_scan</ins></code></td>
300-
<td><code><ins>transform_inclusive_scan</ins></code></td>
301-
<td><code><ins>transform_reduce</ins></code></td>
298+
<td><code>transform_exclusive_scan</code></td>
299+
<td><code>transform_inclusive_scan</code></td>
300+
<td><code>transform_reduce</code></td>
302301
<td><code>uninitialized_copy</code></td>
303302
</tr>
304303
<tr>
@@ -374,6 +373,11 @@ <h1>Header <code>&lt;experimental/algorithm&gt;</code> synopsis</h1>
374373
template&lt;class InputIterator, class Size, class Function&gt;
375374
InputIterator for_each_n(InputIterator first, Size n,
376375
Function f);
376+
<ins>template&lt;class ExecutionPolicy,
377+
class InputIterator, class Size, class Function&gt;
378+
InputIterator for_each_n(ExecutionPolicy&amp;&amp; exec,
379+
InputIterator first, Size n,
380+
Function f);</ins>
377381
}
378382
}
379383
}
@@ -504,48 +508,105 @@ <h1>Header <code>&lt;experimental/numeric&gt;</code> synopsis</h1>
504508
template&lt;class InputIterator&gt;
505509
typename iterator_traits&lt;InputIterator&gt;::value_type
506510
reduce(InputIterator first, InputIterator last);
511+
<ins>template&lt;class ExecutionPolicy,
512+
InputIterator&gt;
513+
typename iterator_traits&lt;InputIterator&gt;::value_type
514+
reduce(ExecutionPolicy&amp;&amp; exec,
515+
InputIterator first, InputIterator last);</ins>
507516
template&lt;class InputIterator, class T&gt;
508-
T reduce(InputIterator first, InputIterator last<ins>,</ins> T init);
517+
T reduce(InputIterator first, InputIterator last, T init);
518+
<ins>template&lt;class ExecutionPolicy,
519+
class InputIterator, class T&gt;
520+
T reduce(ExecutionPolicy&amp;&amp; exec,
521+
InputIterator first, InputIterator last, T init);</ins>
509522
template&lt;class InputIterator, class T, class BinaryOperation&gt;
510523
T reduce(InputIterator first, InputIterator last, T init,
511524
BinaryOperation binary_op);
525+
<ins>template&lt;class ExecutionPolicy, class InputIterator, class T, class BinaryOperation&gt;
526+
T reduce(ExecutionPolicy&amp;&amp; exec,
527+
InputIterator first, InputIterator last, T init,
528+
BinaryOperation binary_op);</ins>
512529

513530
template&lt;class InputIterator, class OutputIterator,
514531
class T&gt;
515532
OutputIterator
516533
exclusive_scan(InputIterator first, InputIterator last,
517534
OutputIterator result,
518535
T init);
536+
<ins>template&lt;class ExecutionPolicy,
537+
class InputIterator, class OutputIterator,
538+
class T&gt;
539+
OutputIterator
540+
exclusive_scan(ExecutionPolicy&amp;&amp; exec,
541+
InputIterator first, InputIterator last,
542+
OutputIterator result,
543+
T init);</ins>
519544
template&lt;class InputIterator, class OutputIterator,
520545
class T, class BinaryOperation&gt;
521546
OutputIterator
522547
exclusive_scan(InputIterator first, InputIterator last,
523548
OutputIterator result,
524549
T init, BinaryOperation binary_op);
550+
<ins>template&lt;class ExecutionPolicy,
551+
class InputIterator, class OutputIterator,
552+
class T, class BinaryOperation&gt;
553+
OutputIterator
554+
exclusive_scan(ExecutionPolicy&amp;&amp; exec,
555+
InputIterator first, InputIterator last,
556+
OutputIterator result,
557+
T init, BinaryOperation binary_op);</ins>
525558

526559
template&lt;class InputIterator, class OutputIterator&gt;
527560
OutputIterator
528561
inclusive_scan(InputIterator first, InputIterator last,
529562
OutputIterator result);
563+
<ins>template&lt;class ExecutionPolicy,
564+
class InputIterator, class OutputIterator&gt;
565+
OutputIterator
566+
inclusive_scan(ExecutionPolicy&amp;&amp; exec,
567+
InputIterator first, InputIterator last,
568+
OutputIterator result);</ins>
530569
template&lt;class InputIterator, class OutputIterator,
531570
class BinaryOperation&gt;
532571
OutputIterator
533572
inclusive_scan(InputIterator first, InputIterator last,
534573
OutputIterator result,
535574
BinaryOperation binary_op);
575+
<ins>template&lt;class ExecutionPolicy,
576+
class InputIterator, class OutputIterator,
577+
class BinaryOperation&gt;
578+
OutputIterator
579+
inclusive_scan(ExecutionPolicy&amp;&amp; exec,
580+
InputIterator first, InputIterator last,
581+
OutputIterator result,
582+
BinaryOperation binary_op);</ins>
536583
template&lt;class InputIterator, class OutputIterator,
537584
class BinaryOperation, class T&gt;
538585
OutputIterator
539586
inclusive_scan(InputIterator first, InputIterator last,
540587
OutputIterator result,
541588
BinaryOperation binary_op, T init);
589+
<ins>template&lt;class ExecutionPolicy,
590+
class InputIterator, class OutputIterator,
591+
class BinaryOperation, class T&gt;
592+
OutputIterator
593+
inclusive_scan(ExecutionPolicy&amp;&amp; exec,
594+
InputIterator first, InputIterator last,
595+
OutputIterator result,
596+
BinaryOperation binary_op, T init);</ins>
542597

543-
<ins>
544598
template&lt;class InputIterator, class UnaryOperation,
545599
class T, class BinaryOperation&gt;
546600
T transform_reduce(InputIterator first, InputIterator last,
547601
UnaryOperation unary_op,
548602
T init, BinaryOperation binary_op);
603+
<ins>template&lt;class ExecutionPolicy,
604+
class InputIterator, class UnaryOperation,
605+
class T, class BinaryOperation&gt;
606+
T transform_reduce(ExecutionPolicy&amp;&amp; exec,
607+
InputIterator first, InputIterator last,
608+
UnaryOperation unary_op,
609+
T init, BinaryOperation binary_op);</ins>
549610

550611
template&lt;class InputIterator, class OutputIterator,
551612
class UnaryOperation, class T, class BinaryOperation&gt;
@@ -554,6 +615,15 @@ <h1>Header <code>&lt;experimental/numeric&gt;</code> synopsis</h1>
554615
OutputIterator result,
555616
UnaryOperation unary_op,
556617
T init, BinaryOperation binary_op);
618+
<ins>template&lt;class ExecutionPolicy,
619+
class InputIterator, class OutputIterator,
620+
class UnaryOperation, class T, class BinaryOperation&gt;
621+
OutputIterator
622+
transform_exclusive_scan(ExecutionPolicy&amp;&amp; exec,
623+
InputIterator first, InputIterator last,
624+
OutputIterator result,
625+
UnaryOperation unary_op,
626+
T init, BinaryOperation binary_op);</ins>
557627

558628
template&lt;class InputIterator, class OutputIterator,
559629
class UnaryOperation, class BinaryOperation&gt;
@@ -562,6 +632,15 @@ <h1>Header <code>&lt;experimental/numeric&gt;</code> synopsis</h1>
562632
OutputIterator result,
563633
UnaryOperation unary_op,
564634
BinaryOperation binary_op);
635+
<ins>template&lt;class ExecutionPolicy,
636+
class InputIterator, class OutputIterator,
637+
class UnaryOperation, class BinaryOperation&gt;
638+
OutputIterator
639+
transform_inclusive_scan(ExecutionPolicy&amp;&amp; exec,
640+
InputIterator first, InputIterator last,
641+
OutputIterator result,
642+
UnaryOperation unary_op,
643+
BinaryOperation binary_op);</ins>
565644

566645
template&lt;class InputIterator, class OutputIterator,
567646
class UnaryOperation, class BinaryOperation, class T&gt;
@@ -570,7 +649,15 @@ <h1>Header <code>&lt;experimental/numeric&gt;</code> synopsis</h1>
570649
OutputIterator result,
571650
UnaryOperation unary_op,
572651
BinaryOperation binary_op, T init);
573-
</ins>
652+
<ins>template&lt;class ExecutionPolicy,
653+
class InputIterator, class OutputIterator,
654+
class UnaryOperation, class BinaryOperation, class T&gt;
655+
OutputIterator
656+
transform_inclusive_scan(ExecutionPolicy&amp;&amp; exec,
657+
InputIterator first, InputIterator last,
658+
OutputIterator result,
659+
UnaryOperation unary_op,
660+
BinaryOperation binary_op, T init);</ins>
574661
}
575662
}
576663
}
@@ -753,35 +840,25 @@ <h1>Transform reduce</h1>
753840

754841
<cxx-function>
755842
<cxx-signature>
756-
<ins>
757843
template&lt;class InputIterator, class UnaryFunction, class T, class BinaryOperation&gt;
758844
T transform_reduce(InputIterator first, InputIterator last,
759845
UnaryOperation unary_op, T init, BinaryOperation binary_op);
760-
</ins>
761846
</cxx-signature>
762847

763848
<cxx-returns>
764-
<ins>
765849
<code><em>GENERALIZED_SUM</em>(binary_op, init, unary_op(*first), ..., unary_op(*(first + (last - first) - 1)))</code>.
766-
</ins>
767850
</cxx-returns>
768851

769852
<cxx-requires>
770-
<ins>
771853
Neither <code>unary_op</code> nor <code>binary_op</code> shall invalidate subranges, or modify elements in the range <code>[first,last)</code>
772-
</ins>
773854
</cxx-requires>
774855

775856
<cxx-complexity>
776-
<ins>
777857
O(<code>last - first</code>) applications each of <code>unary_op</code> and <code>binary_op</code>.
778-
</ins>
779858
</cxx-complexity>
780859

781860
<cxx-notes>
782-
<ins>
783861
<code>transform_reduce</code> does not apply <code>unary_op</code> to <code>init</code>.
784-
</ins>
785862
</cxx-notes>
786863
</cxx-function>
787864
</cxx-section>
@@ -791,7 +868,6 @@ <h1>Transform exclusive scan</h1>
791868

792869
<cxx-function>
793870
<cxx-signature>
794-
<ins>
795871
template&lt;class InputIterator, class OutputIterator,
796872
class UnaryOperation,
797873
class T, class BinaryOperation&gt;
@@ -800,41 +876,30 @@ <h1>Transform exclusive scan</h1>
800876
OutputIterator result,
801877
UnaryOperation unary_op,
802878
T init, BinaryOperation binary_op);
803-
</ins>
804879
</cxx-signature>
805880

806881
<cxx-effects>
807-
<ins>
808882
Assigns through each iterator <code>i</code> in <code>[result,result + (last - first))</code> the value of
809883
<code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(binary_op, init, unary_op(*first), ..., unary_op(*(first + (i - result) - 1)))</code>.
810-
</ins>
811884
</cxx-effects>
812885

813886
<cxx-returns>
814-
<ins>
815887
The end of the resulting range beginning at <code>result</code>.
816-
</ins>
817888
</cxx-returns>
818889

819890
<cxx-requires>
820-
<ins>
821891
Neither <code>unary_op</code> nor <code>binary_op</code> shall invalidate iterators or subranges, or modify elements in the
822892
ranges <code>[first,last)</code> or <code>[result,result + (last - first))</code>.
823-
</ins>
824893
</cxx-requires>
825894

826895
<cxx-complexity>
827-
<ins>
828896
O(<code>last - first</code>) applications each of <code>unary_op</code> and <code>binary_op</code>.
829-
</ins>
830897
</cxx-complexity>
831898

832899
<cxx-notes>
833-
<ins>
834900
The difference between <code>transform_exclusive_scan</code> and <code>transform_inclusive_scan</code> is that <code>transform_exclusive_scan</code>
835901
excludes the ith input element from the ith sum. If <code>binary_op</code> is not mathematically associative, the behavior of
836902
<code>transform_exclusive_scan</code> may be non-deterministic. <code>transform_exclusive_scan</code> does not apply <code>unary_op</code> to <code>init</code>.
837-
</ins>
838903
</cxx-notes>
839904
</cxx-function>
840905
</cxx-section>
@@ -844,7 +909,6 @@ <h1>Transform inclusive scan</h1>
844909

845910
<cxx-function>
846911
<cxx-signature>
847-
<ins>
848912
template&lt;class InputIterator, class OutputIterator,
849913
class UnaryOperation,
850914
class BinaryOperation&gt;
@@ -862,43 +926,32 @@ <h1>Transform inclusive scan</h1>
862926
OutputIterator result,
863927
UnaryOperation unary_op,
864928
BinaryOperation binary_op, T init);
865-
</ins>
866929
</cxx-signature>
867930

868931
<cxx-effects>
869-
<ins>
870932
Assigns through each iterator <code>i</code> in <code>[result,result + (last - first))</code> the value of
871933
<code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(binary_op, unary_op(*first), ..., unary_op(*(first + (i - result))))</code> or
872934
<code><em>GENERALIZED_NONCOMMUTATIVE_SUM</em>(binary_op, init, unary_op(*first), ..., unary_op(*(first + (i - result))))</code>
873935
if <code>init</code> is provided.
874-
</ins>
875936
</cxx-effects>
876937

877938
<cxx-returns>
878-
<ins>
879939
The end of the resulting range beginning at <code>result</code>.
880-
</ins>
881940
</cxx-returns>
882941

883942
<cxx-requires>
884-
<ins>
885943
Neither <code>unary_op</code> nor <code>binary_op</code> shall invalidate iterators or subranges, or modify elements in the ranges <code>[first,last)</code>
886944
or <code>[result,result + (last - first))</code>.
887-
</ins>
888945
</cxx-requires>
889946

890947
<cxx-complexity>
891-
<ins>
892948
O(<code>last - first</code>) applications each of <code>unary_op</code> and <code>binary_op</code>.
893-
</ins>
894949
</cxx-complexity>
895950

896951
<cxx-notes>
897-
<ins>
898-
The difference between <code>transform_exclusive_scan</code> and <code>transform_inclusive_scan</code> is that <code>transform_inclusive_scan</code>
899-
includes the ith input element from the ith sum. If <code>binary_op</code> is not mathematically associative, the behavior of
900-
<code>transform_inclusive_scan</code> may be non-deterministic. <code>transform_inclusive_scan</code> does not apply <code>unary_op</code> to <code>init</code>.
901-
</ins>
952+
The difference between <code>transform_exclusive_scan</code> and <code>transform_inclusive_scan</code> is that <code>transform_inclusive_scan</code>
953+
includes the ith input element from the ith sum. If <code>binary_op</code> is not mathematically associative, the behavior of
954+
<code>transform_inclusive_scan</code> may be non-deterministic. <code>transform_inclusive_scan</code> does not apply <code>unary_op</code> to <code>init</code>.
902955
</cxx-notes>
903956
</cxx-function>
904957
</cxx-section>

execution_policies.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ <h1>Execution policies</h1>
44
<h1>In general</h1>
55
<p>
66
This clause describes classes that are <dfn>execution policy</dfn> types. An object
7-
of an execution policy type indicates <ins>the kinds of parallelism allowed in the execution
8-
of</ins> <del>to</del> an algorithm <del>whether it is allowed to execute
9-
in parallel</del> and expresses the <ins>consequent</ins> requirements on the element
7+
of an execution policy type indicates the kinds of parallelism allowed in the execution
8+
of an algorithm and expresses the consequent requirements on the element
109
access functions.
1110
</p>
1211

1312
<cxx-example>
1413
<pre>std::vector&lt;int&gt; v = ...
1514

1615
// standard sequential sort
17-
std::sort(v<del>ec</del>.begin(), v<del>ec</del>.end());
16+
std::sort(v.begin(), v.end());
1817

1918
using namespace std::experimental::parallel;
2019

@@ -89,11 +88,9 @@ <h1>Execution policy type trait</h1>
8988
<pre>
9089
</pre>
9190

92-
<ins>
93-
<cxx-note>
94-
This provision reserves the privilege of creating non-standard execution policies to the library implementation.
95-
</cxx-note>
96-
</ins>
91+
<cxx-note>
92+
This provision reserves the privilege of creating non-standard execution policies to the library implementation.
93+
</cxx-note>
9794

9895
<p>The behavior of a program that adds specializations for <code>is_execution_policy</code> is undefined.</p>
9996
</cxx-section>
@@ -141,6 +138,7 @@ <h1>Dynamic execution policy</h1>
141138
template&lt;class T&gt; execution_policy&amp; operator=(const T&amp; exec);
142139

143140
<cxx-ref insynopsis="" to="parallel.execpol.access"></cxx-ref>
141+
<ins>const type_info&amp; type() const noexcept;</ins>
144142
template&lt;class T&gt; T* get() noexcept;
145143
template&lt;class T&gt; const T* get() const noexcept;
146144
};

front_matter.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<cxx-titlepage stage="draft">
2-
<cxx-docnum>N4310</cxx-docnum>
2+
<cxx-docnum>NXXX</cxx-docnum>
33
<cxx-project-number>19570</cxx-project-number>
4-
<time pubdate="">2014-11-21</time>
5-
<cxx-revises><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4104.html">N4104</a></cxx-revises>
4+
<time pubdate="">2015-01-06</time>
5+
<cxx-revises><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4310.html">N4310</a></cxx-revises>
66
<cxx-editor>
77
Jared Hoberock<br/>
88
NVIDIA Corporation<br/>

0 commit comments

Comments
 (0)