This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 756
reduce
fail due to integer overflow.
#1315
Labels
P1: should have
Necessary, but not critical.
thrust
type: bug: functional
Does not work as intended.
Comments
Probably related to NVIDIA/cccl#744. |
Confirmed the bug is still there with CUDA11.8 compiler with THRUST/CUB 1.17.2. It produces GPU hang issue with INT_MAX elements #include <limits>
#include <iostream>
#include <thrust/reduce.h>
#include <thrust/execution_policy.h>
#include <thrust/iterator/constant_iterator.h>
int main() {
auto begin = thrust::make_constant_iterator<size_t>(1);
auto r = thrust::reduce(thrust::device,
begin,
begin + std::numeric_limits<int32_t>::max(),
static_cast<size_t>(0));
std::cout << r << std::endl;
return 0;
} However, the result is correct with INT_MAX + 1 #include <limits>
#include <iostream>
#include <thrust/reduce.h>
#include <thrust/execution_policy.h>
#include <thrust/iterator/constant_iterator.h>
int main() {
auto begin = thrust::make_constant_iterator<size_t>(1);
auto r = thrust::reduce(thrust::device,
begin,
begin + std::numeric_limits<int32_t>::max() +1 ,
static_cast<size_t>(0));
std::cout << r << std::endl;
return 0;
} This looks like NOT the same issue (exceeds 2^31) tracked by NVIDIA/cccl#744 |
Hello @lilohuang! Recently, I've made changes to cub/thrust reduction related to offsets computation. On 2.X branch (that contains the changes), your code works fine for me, could you please verify? |
Hi @senior-zero , confirmed the bug has been fixed on the latest thrust/cub branch. Looking forward to seeing a new release with the fix soon. It would be great if you can also backport the fix to thrust/cub 1.x. Thanks! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
P1: should have
Necessary, but not critical.
thrust
type: bug: functional
Does not work as intended.
Platform
Reproduce
The text was updated successfully, but these errors were encountered: