Hello all,

I'm a bit confused about a very small, although important part of PyOpenCL.

It concerns the way you invoke the written C-method from within Python.

While searching for some examples about this module, I found this: http://git.tiker.net/pyopencl.git/blob/HEAD:/examples/benchmark-all.py Running it shows that the OpenCL-part greatly improves the performance of the calculations, but what isn't clear to me is the invocation of the sum-method, which goes like this:

prg = cl.Program(ctx, """
__kernel void sum(__global const float *a, __global const float *b, __global float *c) {
              // do stuff
               }
           }
       """).build()

       exec_evt = prg.sum(queue, a.shape, a_buf, b_buf, dest_buf) // ALERT
       exec_evt.wait()

As you can see, the line which has "// ALERT" tailing shows five parameters that are passed to the previously defined method which is shown to only accept three.

To make matters worse, I dugg into the reference op PyOpenCL and found this: http://python-opencl.next-touch.com/tutorial.html#opencl-kernels.
This code is shown in the third colored box of this part of the reference:

__kernel void vector_add (__global char *c, __global char *a, __global char *b) 
{
        // do stuff
}

prog = opencl.Program(opencl_source)
prog.vector_add(host_vec_out, host_vec_1, host_vec_2) // ALERT


Now, only three parameters are passed to the method, instead of five :-S.

Can someone explain to me why these approaches are so inconsistent? Which one is 
correct? What way is *the way to do it"?

Thx in advance,

Nick


_______________________________________________
PyOpenCL mailing list
[email protected]
http://tiker.net/mailman/listinfo/pyopencl_tiker.net

Reply via email to