Skip to content

Commit

Permalink
Remove test_reduce_struct_type from test_reduce.py
Browse files Browse the repository at this point in the history
  • Loading branch information
shwina committed Jan 14, 2025
1 parent 1ff1386 commit 75b65ef
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions python/cuda_parallel/tests/test_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import cuda.parallel.experimental.algorithms as algorithms
import cuda.parallel.experimental.iterators as iterators
from cuda.parallel.experimental.struct import gpu_struct


def random_int(shape, dtype):
Expand Down Expand Up @@ -551,30 +550,3 @@ def binary_op(x, y):
d_in = cp.zeros(size)[::2]
with pytest.raises(ValueError, match="Non-contiguous arrays are not supported."):
_ = algorithms.reduce_into(d_in, d_out, binary_op, h_init)


def test_reduce_struct_type():
@gpu_struct
class Pixel:
r: np.int32
g: np.int32
b: np.int32

def max_g_value(x, y):
return x if x.g > y.g else y

d_rgb = cp.random.randint(0, 256, (10, 3), dtype=np.int32).view(Pixel.dtype)
d_out = cp.empty(1, Pixel.dtype)

h_init = Pixel(0, 0, 0)

reduce_into = algorithms.reduce_into(d_rgb, d_out, max_g_value, h_init)
temp_storage_bytes = reduce_into(None, d_rgb, d_out, len(d_rgb), h_init)

d_temp_storage = cp.empty(temp_storage_bytes, dtype=np.uint8)
_ = reduce_into(d_temp_storage, d_rgb, d_out, len(d_rgb), h_init)

h_rgb = d_rgb.get()
expected = h_rgb[h_rgb.view("int32")[:, 1].argmax()]

np.testing.assert_equal(expected["g"], d_out.get()["g"])

0 comments on commit 75b65ef

Please sign in to comment.