Hi all,
Recarrays on the GPU (i.e., arrays with named fields), which previously
worked in PyCUDA by passing in a custom dtype to GPUArray, seem to be
broken now. Currently, retrieving them from the GPU loses their fields.
Here is code that illustrates the problem (this example actually works
with earlier versions of PyCUDA):
-----
import numpy
import pycuda.autoinit
import pycuda.gpuarray
t = numpy.dtype({'names': ['a', 'b'], 'formats': [numpy.float64,
numpy.float64]}, align = True)
a = numpy.zeros(10, dtype = t)
a_gpu = pycuda.gpuarray.to_gpu(a)
print a
print a_gpu.get()
-----
I have done some testing, and the issue appears to be that
numpy.lib.stride_tricks.as_strided does not handle recarrays properly.
Since GPUArray.get() runs the array through as_strided, this introduces
the problem. I already filed a numpy bug request at
http://projects.scipy.org/numpy/ticket/1873.
In the meantime, maybe it is worth only using as_strided if the
dtype.isnative flag is True.
Cheers,
Irwin
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda