C Specification
To create a host or device command-queue on a specific device, call the function
// Provided by CL_VERSION_2_0
cl_command_queue clCreateCommandQueueWithProperties(
cl_context context,
cl_device_id device,
const cl_queue_properties* properties,
cl_int* errcode_ret);
| clCreateCommandQueueWithProperties is missing before version 2.0. |
or the equivalent
// Provided by cl_khr_create_command_queue
cl_command_queue clCreateCommandQueueWithPropertiesKHR(
cl_context context,
cl_device_id device,
const cl_queue_properties_khr* properties,
cl_int* errcode_ret);
clCreateCommandQueueWithPropertiesKHR is provided by the cl_khr_create_command_queue extension.
|
Parameters
-
context must be a valid OpenCL context.
-
device must be a device or sub-device associated with context. It can either be in the list of devices and sub-devices specified when context is created using clCreateContext or be a root device with the same device type as specified when context is created using clCreateContextFromType.
-
properties specifies a list of properties for the command-queue and their corresponding values. Each property name is immediately followed by the corresponding desired value. The list is terminated with 0. The list of supported properties is described in the table below. If a supported property and its value is not specified in properties, its default value will be used. properties can be
NULLin which case the default values for supported command-queue properties will be used. -
errcode_ret will return an appropriate error code. If errcode_ret is
NULL, no error code is returned.
Description
| Queue Property | Property Value | Description |
|---|---|---|
|
|
This is a bitfield and can be set to a combination of the following values: missing before version 2.0. missing before version 2.0. If |
missing before version 2.0. |
|
Specifies the size of the device queue in bytes. This can only be specified if For best performance, this should be ≤
If |
provided by the |
|
Specifies a priority hint for command queues belonging to the same OpenCL context. NOTE: Refer to the user guide associated with each implementation supporting this extension for its priority behavior guarantees, if any. If |
provided by the |
|
Specifies a throttle hint for a command queue. NOTE: Refer to the user guide associated with each implementation supporting this extension for its throttling behavior guarantees, if any. If |
clCreateCommandQueueWithProperties returns a valid non-zero command-queue
and errcode_ret is set to CL_SUCCESS if the command-queue is created
successfully.
Otherwise, it returns a NULL value with one of the following error values
returned in errcode_ret:
-
CL_INVALID_if context is not a valid context.CONTEXT -
CL_INVALID_if device is not a valid device or is not associated with context.DEVICE -
CL_INVALID_if values specified in properties are not valid.VALUE -
CL_INVALID_if values specified in properties are valid but are not supported by the device.QUEUE_ PROPERTIES -
CL_INVALID_if theQUEUE_ PROPERTIES cl_khr_extension is supported, thepriority_ hints CL_QUEUE_property is specified, and the queue is aPRIORITY_ KHR CL_QUEUE_.ON_ DEVICE -
CL_INVALID_if theQUEUE_ PROPERTIES cl_khr_extension is supported, thethrottle_ hints CL_QUEUE_property is specified, and the queue is aTHROTTLE_ KHR CL_QUEUE_.ON_ DEVICE -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.