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

Add CL2.1 timer functions

parent 20ff881e
No related branches found
No related tags found
1 merge request!124Opencl 3
Pipeline #73462 passed with warnings
......@@ -45,6 +45,8 @@ Device
.. class:: Device
Two instances of this class may be compared using *=="* and *"!="*.
.. attribute:: info
Lower case versions of the :class:`device_info` constants
......@@ -88,7 +90,19 @@ Device
.. versionadded:: 2011.2
Two instances of this class may be compared using *=="* and *"!="*.
.. method:: device_and_host_timer
:returns: a tuple ``(device_timestamp, host_timestamp)``.
Only available with CL 2.0.
.. versionadded:: 2020.3
.. method:: host_timer
Only available with CL 2.0.
.. versionadded:: 2020.3
Context
-------
......
......@@ -35,8 +35,6 @@
// CL 2.1 missing:
// clGetKernelSubGroupInfo
// clSetDefaultDeviceCommandQueue
// clGetDeviceAndHostTimer
// clGetHostTimer
// clEnqueueSVMMigrateMem
// CL 2.2 complete
......@@ -1031,6 +1029,23 @@ namespace pyopencl
}
#endif
#if PYOPENCL_CL_VERSION >= 0x2010
py::tuple device_and_host_timer() const
{
cl_ulong device_timestamp, host_timestamp;
PYOPENCL_CALL_GUARDED(clGetDeviceAndHostTimer,
(m_device, &device_timestamp, &host_timestamp));
return py::make_tuple(device_timestamp, host_timestamp);
}
cl_ulong host_timer() const
{
cl_ulong host_timestamp;
PYOPENCL_CALL_GUARDED(clGetHostTimer,
(m_device, &host_timestamp));
return host_timestamp;
}
#endif
};
......
......@@ -68,6 +68,10 @@ void pyopencl_expose_part_1(py::module &m)
.DEF_SIMPLE_METHOD(create_sub_devices)
#endif
PYOPENCL_EXPOSE_TO_FROM_INT_PTR(cl_device_id)
#if PYOPENCL_CL_VERSION >= 0x2010
.DEF_SIMPLE_METHOD(device_and_host_timer)
.DEF_SIMPLE_METHOD(host_timer)
#endif
;
}
......
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