Skip to content
Snippets Groups Projects
Commit a0746687 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Add Kernel.clone

parent 55347473
No related branches found
No related tags found
1 merge request!124Opencl 3
......@@ -150,6 +150,12 @@ Kernel
may be used as attributes on instances of this class
to directly query info attributes.
.. method:: clone()
Only available with CL 2.1.
.. versionadded:: 2020.3
.. method:: get_info(param)
See :class:`kernel_info` for values of *param*.
......
......@@ -4258,6 +4258,28 @@ namespace pyopencl
PYOPENCL_EQUALITY_TESTS(kernel);
#if PYOPENCL_CL_VERSION >= 0x2010
kernel *clone()
{
cl_int status_code;
PYOPENCL_PRINT_CALL_TRACE("clCloneKernel");
cl_kernel result = clCloneKernel(m_kernel, &status_code);
if (status_code != CL_SUCCESS)
throw pyopencl::error("clCloneKernel", status_code);
try
{
return new kernel(result, /* retain */ false);
}
catch (...)
{
PYOPENCL_CALL_GUARDED_CLEANUP(clReleaseKernel, (result));
throw;
}
}
#endif
void set_arg_null(cl_uint arg_index)
{
cl_mem m = 0;
......
......@@ -462,6 +462,9 @@ void pyopencl_expose_part_2(py::module &m)
.def(py::init<const program &, std::string const &>())
.DEF_SIMPLE_METHOD(get_info)
.DEF_SIMPLE_METHOD(get_work_group_info)
#if PYOPENCL_CL_VERSION >= 0x2000
.DEF_SIMPLE_METHOD(clone)
#endif
.def("_set_arg_null", &cls::set_arg_null)
.def("_set_arg_buf", &cls::set_arg_buf)
#if PYOPENCL_CL_VERSION >= 0x2000
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment