"=?UTF-8?Q?marcus.desto?=" <marcus.desto(a)o2.pl> writes:
I have been reading your documentation of pyopencl and I am
whether it is possible to pass a list of structs to a gpgpu device
using pyopencl or whether the possibility of passing lists of structs
does not exist in pyopencl.
Wrote a howto for you, since I agree that that area of PyOpenCL is
I tried to pass structs in several ways, but I failed. I was
wondering pythons struct did not accept a list of tuples (see example), meaning it
expected more elements to pack.
Example (no code):
A list containing two 2-tuples elements (x,y) and (a,b) has to be packed. Assume x,a are
strings with length 10 and y,b are integers - so
struct.Struct('10sI'*len(ourlist)) should be used. But as python starts packing
the *list using pack_into(), the function says, it expected 4 arguments, but 2 are given -
which actually are four: [(x,y),(a,b)].
Maybe I am wrong or not smart enough, I do not know.
It is easy to pass one struct as ctype string buffer, but since lists of structs could
improve speed of applications, which need lot of data managed in custom data types, it
might be a good idea to add a feature, if there is no way to pass a list of struct to the
devices using pyopencl.
Also, next time, please ask questions like this on the PyOpenCL list ,
which I've cc'd on my reply.