[PyOpenCL] Passing Python int to kernels
Ian Johnson
enjalot at gmail.com
Thu Jun 9 21:17:34 PDT 2011
You can simply do
prg.myKernel(queue, ... numpy.int32(some_int))
On Thu, Jun 9, 2011 at 4:35 PM, Geordan Rosario <geordan at gmail.com> 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
> PyOpenCL at tiker.net
> http://lists.tiker.net/listinfo/pyopencl
>
>
--
Ian Johnson
http://enja.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tiker.net/pipermail/pyopencl/attachments/20110609/08c75dd1/attachment.html>
More information about the PyOpenCL
mailing list