diff --git a/doc/source/misc.rst b/doc/source/misc.rst index 9165d474224b7ec034f08bb1ee172e3af1373b8c..52b19906a7d6163a977cb95d614ef5562a46180a 100644 --- a/doc/source/misc.rst +++ b/doc/source/misc.rst @@ -75,6 +75,7 @@ Version 0.92 * Add support for the `cl_khr_gl_sharing `_ extension. +* Add :meth:`pyopencl.Kernel.set_args`. Version 0.91.5 -------------- diff --git a/doc/source/runtime.rst b/doc/source/runtime.rst index 1bee111511a34042d3fc4bacc48d0757ade22626..276ca34b311579045885b8ab1179db252771a1c8 100644 --- a/doc/source/runtime.rst +++ b/doc/source/runtime.rst @@ -577,6 +577,10 @@ Programs and Kernels * An instance of :class:`LocalMemory`. * An instance of :class:`Sampler`. + .. method:: set_args(self, *args) + + Invoke :meth:`set_arg` on each element of *args* in turn. + .. method:: __call__(queue, global_size, *args, global_offset=None, local_size=None, wait_for=None) Use :func:`enqueue_nd_range_kernel` to enqueue a kernel execution, after using diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py index 7f869dbae5e35a3dbb9dc51a8c392bc0eff8cf89..e58c934c923fc60350d70b73c7128801174ededd 100644 --- a/pyopencl/__init__.py +++ b/pyopencl/__init__.py @@ -169,7 +169,12 @@ def _add_functionality(): return enqueue_nd_range_kernel(queue, self, global_size, local_size, global_offset, wait_for) + def kernel_set_args(self, *args): + for i, arg in enumerate(args): + self.set_arg(i, arg) + Kernel.__call__ = kernel_call + Kernel.set_args = kernel_set_args # ImageFormat ------------------------------------------------------------- def image_format_repr(self):