Hi Marcus,

"=?UTF-8?Q?marcus.desto?=" <[email protected]> writes:
> I have been reading your documentation of pyopencl and I am wondering,
> 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
somewhat underdocumented:

http://documen.tician.de/pyopencl/howto.html

> 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.
>
> What about?

Also, next time, please ask questions like this on the PyOpenCL list [1],
which I've cc'd on my reply.

[1] http://lists.tiker.net/listinfo/pyopencl

Andreas

Attachment: pgpmS0BMK_Jp0.pgp
Description: PGP signature

_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to