Hi Andreas, 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 itself?
On Tue, May 27, 2014 at 2:22 PM, Andreas Kloeckner <[email protected]> wrote: > 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 _______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
