On Thu, 09 Jun 2011 16:35:50 -0700, Geordan Rosario <[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)
You need to do this like so: my_knl = prg.myKernel my_knl.set_scalar_arg_dtypes([None, None, numpy.int32]) my_knl(queue, n_globals, None, some_buf, another_buf, some_int) A new instance of the kernel is constructed every time you use "program.kernel", which throws away this type information. I've added a warning about this to the documentation. Andreas
pgptIwLcZsWLI.pgp
Description: PGP signature
_______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
