dpctl.SyclQueue¶
-
class
dpctl.
SyclQueue
(*args, **kwargs)¶ Python class representing
cl::sycl::queue
. There are multiple ways to create adpctl.SyclQueue
object:Invoking the constructor with no arguments creates a context using the default selector.
- Example
import dpctl # Create a default SyclQueue q = dpctl.SyclQueue() print(q.sycl_device)
Invoking the constructor with specific filter selector string that creates a queue for the device corresponding to the filter string.
- Example
import dpctl # Create in-order SyclQueue for either gpu, or cpu device q = dpctl.SyclQueue("gpu,cpu", property="in_order") print([q.sycl_device.is_gpu, q.sycl_device.is_cpu])
Invoking the constructor with a
dpctl.SyclDevice
object creates a queue for that device, automatically finding/creating adpctl.SyclContext
for the given device.
- Example
import dpctl d = dpctl.SyclDevice("gpu") q = dpctl.SyclQueue(d) ctx = q.sycl_context print(q.sycl_device == d) print(any([ d == ctx_d for ctx_d in ctx.get_devices()]))
Invoking the constructor with a
dpctl.SyclContext
and adpctl.SyclDevice
creates a queue for given context and device.
- Example
import dpctl # Create a CPU device using the opencl driver cpu_d = dpctl.SyclDevice("opencl:cpu") # Partition the CPU device into sub-devices with two cores each. sub_devices = cpu_d.create_sub_devices(partition=2) # Create a context common to all the sub-devices. ctx = dpctl.SyclContext(sub_devices) # create a queue for each sub-device using the common context queues = [dpctl.SyclQueue(ctx, sub_d) for sub_d in sub_devices]
Invoking the constuctor with a named
PyCapsule
with the name “SyclQueueRef” that carries a pointer to asycl::queue
object. The capsule will be renamed upon successful consumption to ensure one-time use. A new named capsule can be constructed by usingdpctl.SyclQueue._get_capsule()
method.
- Parameters
ctx (
dpctl.SyclContext
, optional) – Sycl context to createdpctl.SyclQueue
from. If not specified, a single-device context will be created from the specified device.dev (str,
dpctl.SyclDevice
, capsule, optional) –Sycl device to create
dpctl.SyclQueue
from. If not specified, sycl device selected bycl::sycl::default_selector
is used. The argument must be explicitly specified if ctxt argument is provided.If dev is a named
PyCapsule
called “SyclQueueRef” and ctxt is not specified,dpctl.SyclQueue
instance is created from foreign sycl::queue object referenced by the capsule.property (str, tuple(str), list(str), optional) – Defaults to None. The argument can be either “default”, “in_order”, “enable_profiling”, or a tuple containing these.
- Raises
SyclQueueCreationError – If the
dpctl.SyclQueue
object creation failed.TypeError – In case of incorrect arguments given to constructors, unexpected types of input arguments, or in the case the input capsule contained a null pointer or could not be renamed.
Attributes:
True if SyclQueue is in-order, False if it is out-of-order.
Private methods:
Public methods:
Returns the address of the C API DPCTLSyclQueueRef pointer as a
size_t
.Returns the Sycl backend associated with the queue.
Detail¶
Attributes¶
-
SyclQueue.
is_in_order
¶ True if SyclQueue is in-order, False if it is out-of-order.
-
SyclQueue.
sycl_context
¶
-
SyclQueue.
sycl_device
¶
Public methods¶
-
dpctl.SyclQueue.
addressof_ref
()¶ Returns the address of the C API DPCTLSyclQueueRef pointer as a
size_t
.- Returns
The address of the
DPCTLSyclQueueRef
object used to create thisdpctl.SyclQueue
cast to asize_t
.
-
dpctl.SyclQueue.
get_sycl_backend
()¶ Returns the Sycl backend associated with the queue.
-
dpctl.SyclQueue.
get_sycl_context
()¶
-
dpctl.SyclQueue.
get_sycl_device
()¶
-
dpctl.SyclQueue.
mem_advise
()¶
-
dpctl.SyclQueue.
memcpy
()¶
-
dpctl.SyclQueue.
prefetch
()¶
-
dpctl.SyclQueue.
submit
()¶
-
dpctl.SyclQueue.
wait
()¶