Hello Andrew,

to_device() constructs Array instance, which is a wrapper around the
actual memory chunk and cannot be passed directly to the kernel. You
have to pass it as a_device.data (and don't forget to allocate output
arrays b, c, d on device too).

Best regards,
Bogdan

On Sat, Oct 1, 2011 at 2:43 AM, andrew cooke <[email protected]> wrote:
> I don't want to be that guy who keeps asking dumb questions, but I fixed that
> and I am now getting a different error that I don't understand:
>
> pyopencl.LogicError: when processing argument #1 (1-based): Kernel.set_arg
> failed: invalid value - invalid kernel argument
>
> The code is:
>
>    a = n.zeros(3, dtype=n.uint8)
>    a[0] = 32
>    a[1] = 43
>    a[2] = 129
>
>    ctx = cl.create_some_context()
>    queue = cl.CommandQueue(ctx)
>
>    prg = cl.Program(ctx, """
>        __kernel void test1(__global const uchar *a,
>                            __global int *b,
>                            __global int *c,
>                            __global int *d) {
>            *b = a[0];
>            *c = a[1];
>            *d = a[2];
>        }
>        """).build()
>
>    b, c, d = map(n.int32, [0, 0, 0])
>    #print(a,b,c,d)
>    a_device = cla.to_device(queue, a)
>    event = prg.test1(queue, 1, None, a_device, b, c, d)
>
> And any further help would be appreciated...
>
> Thanks,
> Andrew
>

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

Reply via email to