I ended up spending some more time with structs + constant memory and got it working. I've written up a blog post because it wasn't obvious to me. Hopefully it clarifies what I was going for and maybe helps some one out.
http://enja.org/2011/03/30/adventures-in-opencl-part-3-constant-memory-structs/ On Sun, Mar 27, 2011 at 11:12 PM, Andreas Kloeckner <[email protected] > wrote: > On Sun, 27 Mar 2011 20:28:20 -0400, Ian Johnson <[email protected]> wrote: > > Hey guys, > > > > I'm trying to pass a structure to PyOpenCL (using the struct module and > the > > pack routine) but everytime i try to pass it as an arguement I get > invalid > > arg size error. > > > > I've coded up an example which fails in this way > > > https://github.com/enjalot/adventures_in_opencl/blob/master/experiments/structs/structs.py > > > > what am I missing? > > Two issues: > > - __constant refers to constant memory, AFAIK--which is a special type of > memory that I am not sure you mean. > > - I imagine you don't want to pass a pointer to your struct type, but > the struct itself. (i.e. remove the '*') > > > also, the struct in this example is 16bytes on most machines, what if i > just > > do "ffi" (12 bytes), do i need to pad it on the python side? I was a bit > > confused about the struct module documentation on alignment > > Not sure--struct.calcsize() should tell you, though. > > Andreas > > -- Ian Johnson http://enja.org
_______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
