Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: thrust::min_element / max_element fail with numItems close to int_max #330

Open
1 task done
fkallen opened this issue Aug 15, 2023 · 2 comments
Open
1 task done
Labels
cub For all items related to CUB thrust For all items related to Thrust.

Comments

@fkallen
Copy link

fkallen commented Aug 15, 2023

Is this a duplicate?

Type of Bug

Runtime Error

Component

Thrust

Describe the bug

terminate called after throwing an instance of 'thrust::system::system_error'
what(): extrema failed to synchronize: cudaErrorIllegalAddress: an illegal memory access was encountered
Aborted (core dumped)

I assume it happens because the sum in this loop overflows for int.

while (block_offset + ITEMS_PER_TILE <= num_items)

How to Reproduce

#include <thrust/device_vector.h>
#include <thrust/extrema.h>

int main() {
  size_t N = std::numeric_limits<int>::max();
  thrust::device_vector<int> dArr(N, 1);
  thrust::max_element(dArr.begin(),dArr.end());
  return 0;
}

Expected behavior

No error

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

@github-actions
Copy link
Contributor

Hi @fkallen!

Thanks for submitting this issue - the CCCL team has been notified and we'll get back to you as soon as we can!
In the mean time, feel free to add any relevant information to this issue.

@github-actions github-actions bot added the needs triage Issues that require the team's attention label Aug 15, 2023
@gevtushenko
Copy link
Collaborator

Hello @fkallen and thank you for reporting this! Similar issue was addressed in CUB (1, 2). The thrust implementation is due to be replaced with the CUB one. This should address the issue. One note. The transition to CUB implementation is currently blocked by #548.

@gevtushenko gevtushenko moved this from Todo to Blocked in CCCL Aug 15, 2023
@gevtushenko gevtushenko added thrust For all items related to Thrust. cub For all items related to CUB and removed needs triage Issues that require the team's attention labels Aug 15, 2023
@miscco miscco removed their assignment Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cub For all items related to CUB thrust For all items related to Thrust.
Projects
Status: Blocked
Development

No branches or pull requests

3 participants