From 671ad7f11b964d325fe980c1025af10ae91096c5 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Sun, 23 Aug 2015 19:19:05 -0500 Subject: [PATCH] Add undocumented capture_as kwarg to ElementwiseKernel --- pyopencl/elementwise.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyopencl/elementwise.py b/pyopencl/elementwise.py index 91e3774c..60cc8856 100644 --- a/pyopencl/elementwise.py +++ b/pyopencl/elementwise.py @@ -245,6 +245,7 @@ class ElementwiseKernel: range_ = kwargs.pop("range", None) slice_ = kwargs.pop("slice", None) + capture_as = kwargs.pop("capture_as", None) use_range = range_ is not None or slice_ is not None kernel, arg_descrs = self.get_kernel(use_range) @@ -310,6 +311,12 @@ class ElementwiseKernel: invocation_args.append(repr_vec.size) gs, ls = repr_vec.get_sizes(queue, max_wg_size) + if capture_as is not None: + kernel.set_args(*invocation_args) + kernel.capture_call( + capture_as, queue, + gs, ls, *invocation_args, wait_for=wait_for) + kernel.set_args(*invocation_args) return cl.enqueue_nd_range_kernel(queue, kernel, gs, ls, wait_for=wait_for) -- GitLab