Hello,

I've noticed that the 'take' function doesn't seem to work for arrays with
complex dtypes (complex64, complex128). I've added to patches that allow
this to work. It requires adding texture support for these types.

As was done for double precision, it is a bit hacky. I'm not sure if there
is a much better way as there doesn't seem to be native support for these
types in cuda.

There are two patches as this requires adding some lines to
"pycuda-helpers.hpp" and "gpuarray.py", as well as some lines in the
compyte submodule to add in the mapping to the fake texture types.

Below is a small script that demonstrates this issue for my install.

import pycuda.autoinit
import numpy
from  pycuda.gpuarray import to_gpu, take

a = numpy.array([1, 2, 3, 4+2j, 5])

b = a.astype(numpy.complex64)
c = a.astype(numpy.complex128)

i = numpy.array([3, 1], dtype=numpy.int64)
i_gpu = to_gpu(i)

b_gpu = to_gpu(b)
c_gpu = to_gpu(a)

print take(b_gpu, i_gpu)
print take(c_gpu, i_gpu)

Attachment: 0004-allow-gpuarray-take-to-be-used-with-complex-types.patch
Description: Binary data

Attachment: 0001-add-fp-texref-hack-for-complex-types.patch
Description: Binary data

_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to