Thank you for the correction. Just curious, how come in PyOpenCL it
works with rank-0 numpy arrays (which, in my opinion, is more
intuitive than implicitly casting a rank-1 array to a scalar)? Is it
just a difference between PyCUDA and PyOpenCL, or a limitation of CUDA
On Tue, May 27, 2014 at 2:22 PM, Andreas Kloeckner
Bogdan Opanchuk <mantihor(a)gmail.com> writes:
> 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',
> pair = numpy.empty(1, dtype)
> See https://gist.github.com/Manticore/15383a1ae367bfc6efe8
> 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:
(The point is that the argument has to be an array to be recognized. A
'scalar' of a derived dtype will not work.)