Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Clarify scan non-determinism in the documentation #1614

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 102 additions & 6 deletions thrust/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ THRUST_NAMESPACE_BEGIN
* This version of \p inclusive_scan assumes plus as the associative operator.
* When the input and output sequences are the same, the scan is performed
* in-place.

*
* \p inclusive_scan is similar to \c std::partial_sum in the STL. The primary
* difference between the two functions is that \c std::partial_sum guarantees
* a serial summation order, while \p inclusive_scan requires associativity of
* the binary operation to parallelize the prefix sum.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -106,12 +110,16 @@ __host__ __device__
* This version of \p inclusive_scan assumes plus as the associative operator.
* When the input and output sequences are the same, the scan is performed
* in-place.

*
* \p inclusive_scan is similar to \c std::partial_sum in the STL. The primary
* difference between the two functions is that \c std::partial_sum guarantees
* a serial summation order, while \p inclusive_scan requires associativity of
* the binary operation to parallelize the prefix sum.
*
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first The beginning of the input sequence.
* \param last The end of the input sequence.
* \param result The beginning of the output sequence.
Expand Down Expand Up @@ -154,12 +162,16 @@ template<typename InputIterator,
* term 'inclusive' means that each result includes the corresponding
* input operand in the partial sum. When the input and output sequences
* are the same, the scan is performed in-place.
*
*
* \p inclusive_scan is similar to \c std::partial_sum in the STL. The primary
* difference between the two functions is that \c std::partial_sum guarantees
* a serial summation order, while \p inclusive_scan requires associativity of
* the binary operation to parallelize the prefix sum.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -220,6 +232,10 @@ __host__ __device__
* a serial summation order, while \p inclusive_scan requires associativity of
* the binary operation to parallelize the prefix sum.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first The beginning of the input sequence.
* \param last The end of the input sequence.
* \param result The beginning of the output sequence.
Expand Down Expand Up @@ -271,6 +287,10 @@ template<typename InputIterator,
* associative operator and \c 0 as the initial value. When the input and
* output sequences are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -326,7 +346,11 @@ __host__ __device__
* and so on. This version of \p exclusive_scan assumes plus as the
* associative operator and \c 0 as the initial value. When the input and
* output sequences are the same, the scan is performed in-place.
*
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first The beginning of the input sequence.
* \param last The end of the input sequence.
* \param result The beginning of the output sequence.
Expand Down Expand Up @@ -373,6 +397,10 @@ template<typename InputIterator,
* operator but requires an initial value \p init. When the input and
* output sequences are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -430,6 +458,10 @@ __host__ __device__
* operator but requires an initial value \p init. When the input and
* output sequences are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first The beginning of the input sequence.
* \param last The end of the input sequence.
* \param result The beginning of the output sequence.
Expand Down Expand Up @@ -478,6 +510,10 @@ template<typename InputIterator,
* operator and an initial value \p init. When the input and output
* sequences are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -545,7 +581,11 @@ __host__ __device__
* and so on. This version of the function requires both an associative
* operator and an initial value \p init. When the input and output
* sequences are the same, the scan is performed in-place.
*
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first The beginning of the input sequence.
* \param last The end of the input sequence.
* \param result The beginning of the output sequence.
Expand Down Expand Up @@ -618,6 +658,10 @@ template<typename InputIterator,
* operator used to perform the prefix sum. When the input and output sequences
* are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -687,6 +731,10 @@ __host__ __device__
* operator used to perform the prefix sum. When the input and output sequences
* are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first1 The beginning of the key sequence.
* \param last1 The end of the key sequence.
* \param first2 The beginning of the input value sequence.
Expand Down Expand Up @@ -746,6 +794,10 @@ template<typename InputIterator1,
* operator used to perform the prefix sum. When the input and output sequences
* are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -822,6 +874,10 @@ __host__ __device__
* operator used to perform the prefix sum. When the input and output sequences
* are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first1 The beginning of the key sequence.
* \param last1 The end of the key sequence.
* \param first2 The beginning of the input value sequence.
Expand Down Expand Up @@ -888,6 +944,10 @@ template<typename InputIterator1,
* \c binary_op to perform the prefix sum. When the input and output sequences
* are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -967,6 +1027,10 @@ __host__ __device__
* belong to the same segment if <tt>binary_pred(*i, *(i+1))</tt> is true, and belong to
* different segments otherwise.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* This version of \p inclusive_scan_by_key uses the associative operator
* \c binary_op to perform the prefix sum. When the input and output sequences
* are the same, the scan is performed in-place.
Expand Down Expand Up @@ -1042,6 +1106,10 @@ template<typename InputIterator1,
* belong to the same segment if <tt>*i == *(i+1)</tt>, and belong to
* different segments otherwise.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* Refer to the most general form of \p exclusive_scan_by_key for additional details.
*
* The algorithm's execution is parallelized as determined by \p exec.
Expand Down Expand Up @@ -1101,6 +1169,10 @@ __host__ __device__
* belong to the same segment if <tt>*i == *(i+1)</tt>, and belong to
* different segments otherwise.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* Refer to the most general form of \p exclusive_scan_by_key for additional details.
*
* \param first1 The beginning of the key sequence.
Expand Down Expand Up @@ -1146,6 +1218,10 @@ template<typename InputIterator1,
* This version of \p exclusive_scan_by_key uses the value \c init to
* initialize the exclusive scan operation.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -1206,6 +1282,10 @@ __host__ __device__
* This version of \p exclusive_scan_by_key uses the value \c init to
* initialize the exclusive scan operation.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first1 The beginning of the key sequence.
* \param last1 The end of the key sequence.
* \param first2 The beginning of the input value sequence.
Expand Down Expand Up @@ -1262,6 +1342,10 @@ template<typename InputIterator1,
* <tt>i+1</tt> in the range <tt>[first1, last1)</tt> belong to the same segment if
* <tt>binary_pred(*i, *(i+1))</tt> is true, and belong to different segments otherwise.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -1332,6 +1416,10 @@ __host__ __device__
* <tt>i+1</tt> in the range <tt>[first1, last1)</tt> belong to the same segment if
* <tt>binary_pred(*i, *(i+1))</tt> is true, and belong to different segments otherwise.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first1 The beginning of the key sequence.
* \param last1 The end of the key sequence.
* \param first2 The beginning of the input value sequence.
Expand Down Expand Up @@ -1397,6 +1485,10 @@ template<typename InputIterator1,
* \c binary_op to perform the prefix sum. When the input and output sequences
* are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* The algorithm's execution is parallelized as determined by \p exec.
*
* \param exec The execution policy to use for parallelization.
Expand Down Expand Up @@ -1487,6 +1579,10 @@ __host__ __device__
* \c binary_op to perform the prefix sum. When the input and output sequences
* are the same, the scan is performed in-place.
*
* Results are not deterministic for pseudo-associative operators (e.g.,
* addition of floating-point types). Results for pseudo-associative
* operators may vary from run to run.
*
* \param first1 The beginning of the key sequence.
* \param last1 The end of the key sequence.
* \param first2 The beginning of the input value sequence.
Expand Down