Perfect, thanks!

-geordan

On 6/9/11 9:17 PM, Ian Johnson wrote:
You can simply do

prg.myKernel(queue, ... numpy.int32(some_int))


On Thu, Jun 9, 2011 at 4:35 PM, Geordan Rosario <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    How do I pass a Python int to a kernel?  The docs refer to
    set_scalar_arg_dtypes but it's not exactly clear as to how it
    should be done.  I've tried this:

      prg = cl.Program(ctx, program_str).build()
      prg.myKernel.set_scalar_arg_dtypes([None, None, numpy.int32])
      prg.myKernel(queue, n_globals, None, some_buf, another_buf,
    some_int)

    But I get the error:

      pyopencl.LogicError: when processing argument #3 (1-based):
    Kernel.set_arg failed: invalid value - invalid kernel argument

    What is the correct way to do this?  (Other than creating a
    1-length buffer.)

    Thanks,
    -geordan

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




--
Ian Johnson
http://enja.org

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

Reply via email to