Bogdan Opanchuk <[email protected]> writes:

> Hello,
>
> Does PyCUDA support struct arguments to kernels? From the Python side
> it means an element of an array with a struct dtype (a numpy.void
> object), e.g.
>
> dtype = numpy.dtype([('first', numpy.int32), ('second', numpy.int32)])
> pair = numpy.empty(1, dtype)[0]
>
> See https://gist.github.com/Manticore/15383a1ae367bfc6efe8 for an
> example of the functionality in question. It fails on ``get_second()``
> call complaining about the second argument (the structure).
>
> An analogous code in PyOpenCL works fine, but as far as I understand
> from its source, it uses a somewhat different mechanism of argument
> passing as compared to what is employed by PyCUDA.

The following minor variant works:

https://gist.github.com/inducer/88ac86874112b0e126ce

(The point is that the argument has to be an array to be recognized. A
'scalar' of a derived dtype will not work.)

Andreas

Attachment: pgpYLZ48hUAfk.pgp
Description: PGP signature

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

Reply via email to