Hello,
In Snow Leopard it compiles and runs, but the result is not as expected. I
found several ways to do it, the one you mention is probably the easiest
one, but you could also define the kernel as:
__kernel void demo(__global uint demo[][5])
This way you can use it as a multidimensional array without problems. Also
another solution comes up, it's the same as yours in a more complicated way
(but maybe more easy to understand):
__global uint *buffer;
buffer = &demo[gid*5];
for(i=0; i<5;i++)
{
buffer[i] = (uint) 1;
}
Thanks for the reply, Roger.
2009/9/8 Andreas Klöckner <[email protected]>
> On Samstag 05 September 2009, Roger Pau Monné wrote:
> > Hello,
> > I'm trying to pass a multidimensional array as a parameter of a kernel
> and
> > I'm having some trouble. The kernel compiles and runs fine, but it seems
> to
> > not be able to update the array (or read_buffer is not able to retrieve
> the
> > values). I've made a simple example to show this problem, it is attached
> to
> > the message. Does someone know where the problem might be?
>
> Hmm, first off, you've uncovered a bug in Nvidia's CL implementation, which
> simply fails to compile your kernel:
>
> Error:
> ptxas ptx input, line 48; error : Unknown symbol 'demo_param_0'
>
> But even if it did, n-dimensional arrays don't map to pointer-to-pointer
> structures. The easiest way is to declare them as "float *" and do the
> index
> math yourself, i.e.
>
> demo[i+5*gid] = 1;
>
> Fixed version here:
> http://git.tiker.net/pyopencl.git/blob/HEAD:/examples/narray.py
>
> Andreas
>
> _______________________________________________
> PyOpenCL mailing list
> [email protected]
> http://tiker.net/mailman/listinfo/pyopencl_tiker.net
>
>
_______________________________________________
PyOpenCL mailing list
[email protected]
http://tiker.net/mailman/listinfo/pyopencl_tiker.net