fix: speed up test_3136_cuda_reducers.py - #3934
Conversation
ianna
left a comment
There was a problem hiding this comment.
@ariostas and @maxymnaumchyk - this should speedup the tests a bit.
|
The documentation preview is ready to be viewed at http://preview.awkward-array.org.s3-website.us-east-1.amazonaws.com/PR3934 |
|
It's the |
|
yeah, the |
|
Hmm... there is a discrepancy between CPU and GPU reducers -- the former return a NumPy array while the latter a NumpyArray layout: prod_expected = array([0, 1, 0, 0])
prod_gpu = <NumpyArray dtype='int64' len='4'>[0 1 0 0]</NumpyArray>
sum_expected = array([1, 0, 1, 0])
sum_gpu = <NumpyArray dtype='int64' len='4'>[1 0 1 0]</NumpyArray>In 2.9.0 I get a high level Array: >>> import numpy as np
>>> array = np.array([[True, False, False], [True, False, False]])
>>> content = ak.contents.NumpyArray(array.reshape(-1))
>>> offsets = ak.index.Index64(np.array([0, 3, 3, 5, 6], dtype=np.int64))
>>> depth = ak.contents.ListOffsetArray(offsets, content)
>>> depth
<ListOffsetArray len='4'>
<offsets><Index dtype='int64' len='5'>[0 3 3 5 6]</Index></offsets>
<content><NumpyArray dtype='bool' len='6'>
[ True False False True False False]
</NumpyArray></content>
</ListOffsetArray>
>>> ak.sum(depth, axis=-1)
<Array [1, 0, 1, 0] type='4 * int64'>
>>> ak.prod(depth, axis=-1)
<Array [0, 1, 0, 0] type='4 * int64'> |
|
It looks like in the tests here, GPU kernels are called with |
Re-write the tests in a GPU friendly way.
@maxymnaumchyk - FYI