-
Notifications
You must be signed in to change notification settings - Fork 204
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
Correct test_segmented_reduce.py::test_segmented_reduce #4197
Comments
oleksandr-pavlyk
added a commit
to oleksandr-pavlyk/cccl
that referenced
this issue
Mar 19, 2025
… offsets To resolve NVIDIAgh-4197, use `cupy.cumsum` to accumulate over random partition sizes to form correct offsets sequence. Add assertions to verify that `offsets` is a non-decreasing sequence, and that its last element equals the size of the input array. Perform the test for several plausible offset data types.
2 tasks
caugonnet
pushed a commit
to caugonnet/cccl
that referenced
this issue
Mar 25, 2025
* Fix logic in test_segmented_reduce, also test over different types of offsets To resolve NVIDIAgh-4197, use `cupy.cumsum` to accumulate over random partition sizes to form correct offsets sequence. Add assertions to verify that `offsets` is a non-decreasing sequence, and that its last element equals the size of the input array. Perform the test for several plausible offset data types. * Changes per PR review comments 1. Use `cupy.random` to draw random sample on GPU, rather than on CPU followed by a transfer 2. Use `cp.empty` to allocate output, rather than `cp.zeros`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The test is meant to create partition of input array into random-size segments, call
segmented_reduce
and verify against sequential calls tosum
over segments.The test does not correctly form offsets associated with such partition. It samples random sizes from multinomial distribution, but fails to scan over these sizes, hence producing a sequence which is not guaranteed to be non-decreasing.
The test should be modified to perform meaningful acceptance testing.
The text was updated successfully, but these errors were encountered: