diff options
author | Johannes Singler <singler@kit.edu> | 2010-06-08 09:11:49 +0000 |
---|---|---|
committer | Johannes Singler <singler@gcc.gnu.org> | 2010-06-08 09:11:49 +0000 |
commit | 736cc331c60f5ce97001b386d5af44076549f086 (patch) | |
tree | 9129229778941484eeb985061e9bde666e88d58c | |
parent | a9429e29f506f5b8c28b28ab387fc2d261a4220c (diff) | |
download | gcc-736cc331c60f5ce97001b386d5af44076549f086.zip gcc-736cc331c60f5ce97001b386d5af44076549f086.tar.gz gcc-736cc331c60f5ce97001b386d5af44076549f086.tar.bz2 |
2010-06-08 Johannes Singler <singler@kit.edu>
* include/parallel/partial_sum.h
(__parallel_partial_sum_linear):
Correctly calculate part lengths for partial_sum_dilation!=1.0f.
From-SVN: r160428
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/include/parallel/partial_sum.h | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0f24ab4..3ebfd13 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2010-06-08 Johannes Singler <singler@kit.edu> + + * include/parallel/partial_sum.h + (__parallel_partial_sum_linear): + Correctly calculate part lengths for partial_sum_dilation!=1. + 2010-06-07 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/44417 diff --git a/libstdc++-v3/include/parallel/partial_sum.h b/libstdc++-v3/include/parallel/partial_sum.h index 966d9db..d398c45 100644 --- a/libstdc++-v3/include/parallel/partial_sum.h +++ b/libstdc++-v3/include/parallel/partial_sum.h @@ -127,10 +127,13 @@ namespace __gnu_parallel equally_split(__n, __num_threads + 1, __borders); else { + _DifferenceType __first_part_length = + std::max<_DifferenceType>(1, + __n / (1.0f + __s.partial_sum_dilation * __num_threads)); _DifferenceType __chunk_length = - ((double)__n - / ((double)__num_threads + __s.partial_sum_dilation)), - __borderstart = __n - __num_threads * __chunk_length; + (__n - __first_part_length) / __num_threads; + _DifferenceType __borderstart = + __n - __num_threads * __chunk_length; __borders[0] = 0; for (_ThreadIndex __i = 1; __i < (__num_threads + 1); ++__i) { |