pyCuda and gpuarray.maximum differs from numpy

156 views Asked by At

Perhaps I'm missing something. I'm using pycuda and I have the following matrix m_gpu:

>>> m_gpu
array([[ 0., 2., 4., 1., 3.],
       [ 2., 0., 5., 2., 1.],
       [ 4., 5., 0., 3., 2.],
       [ 1., 2., 3., 0., 4.],
       [ 3., 1., 2., 4., 0.]], dtype=float32)

I print out the first column and second row for a sanity check:

>>> m_gpu[:,1]
array([ 2., 0., 5., 2., 1.], dtype=float32)
>>> m_gpu[2,:]
array([ 4., 5., 0., 3., 2.], dtype=float32)

Then I do an element-wise comparison to return an array of max values, which is wrong as the 3rd element should be a '5' but it is a '1':

>>> gpuarray.maximum(m_gpu[:,1], m_gpu[2,:])
array([ 4., 5., 1., 3., 2.], dtype=float32)

Could be a bug in gpuarray.maximum? Seems unlikely. I do the same operation using regular numpy and it returns the correct values.. Using pycuda-2017.1.1+cuda8061-cp27 on windows. Help? Thanks.

0

There are 0 answers