why does the code below work, but the alternative commented lines fail with
"invalid kernel argument"?  i guess i am not understanding the Array class,
but it seems like it is intended to be an easier-to-use replacement for
explicit buffers?

    ctx = cl.create_some_context()
    queue = cl.CommandQueue(ctx)

    a = n.array([0], dtype=n.int32)

    # this works
    a_dev = cl.Buffer(ctx, cl.mem_flags.WRITE_ONLY, 4)
    # this alternative (plus below) fails
    #a_dev = cla.to_device(queue, a)

    prg = cl.Program(ctx, """
        __kernel void test1(__global int* a) {
            a[0] = 1;
        }
        """).build()

    event = prg.test1(queue, (1,), None, a_dev)
    event.wait()

    # this works
    cl.enqueue_copy(queue, a, a_dev)
    # this alternative (plus above) fails
    #a = a_dev.get()
    
    print(a)

thanks,
andrew

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

Reply via email to