Skip to content
Snippets Groups Projects
runtime_queue.rst 5.11 KiB

OpenCL Runtime: Command Queues and Events

Command Queue

Create a new command queue. properties is a bit field consisting of :class:`command_queue_properties` values.

If device is None, one of the devices in context is chosen in an implementation-defined manner.

properties may be a bitwise combination of values from :class:`queue_properties` (or None which is equivalent to passing 0). This is compatible with both OpenCL 1.x and 2.x.

For OpenCL 2.0 and above, properties may also be a sequence of keys and values from :class:`queue_properties` as accepted by :c:func:`clCreateCommandQueueWithProperties` (see the OpenCL spec for details). The trailing 0 is added automatically and does not need to be included.

A :class:`CommandQueue` may be used as a context manager, like this:

with cl.CommandQueue(self.cl_context) as queue:
    enqueue_stuff(queue, ...)

:meth:`finish` is automatically called at the end of the with-delimited context, and further operations on the queue are considered an error.

|comparable|

Event

|comparable|

Event Subclasses

A subclass of :class:`Event`. Only available with OpenCL 1.1 and newer.

Transfers between host and device return events of this type. They hold a reference to the host-side buffer and wait for the transfer to complete when they are freed. Therefore, they can safely release the reference to the object they're guarding upon destruction.

A subclass of :class:`Event`.

Synchronization Functions