'\" t .\" Title: clCreateCommandQueue .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2021 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "CLCREATECOMMANDQUEUE" "3clc" "01/14/2021" "The Khronos Group" "OpenCL Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" clCreateCommandQueue \- Create a command\-queue on a specific device\&. .SH "" .HP \w'cl_command_queue\ clCreateCommandQueue('u .BI "cl_command_queue clCreateCommandQueue(cl_context\ " "context" ", cl_device_id\ " "device" ", cl_command_queue_properties\ " "properties" ", cl_int\ *" "errcode_ret" ");" .SH "PARAMETERS" .PP \fIcontext\fR .RS 4 Must be a valid OpenCL context\&. .RE .PP \fIdevice\fR .RS 4 Must be a device associated with \fIcontext\fR\&. It can either be in the list of devices specified when \fIcontext\fR is created using \fBclCreateContext\fR(3clc) or have the same device type as the device type specified when the \fIcontext\fR is created using \fBclCreateContextFromType\fR(3clc)\&. .RE .PP \fIproperties\fR .RS 4 Specifies a list of properties for the command\-queue\&. This is a bit\-field described in the table below\&. Only command\-queue properties specified in the table below can be set in \fIproperties\fR; otherwise the value specified in \fIproperties\fR is considered to be not valid\&. .TS allbox tab(:); lB lB. T{ Command\-Queue Properties T}:T{ Description T} .T& l l l l. T{ \fBCL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE\fR T}:T{ Determines whether the commands queued in the command\-queue are executed in\-order or out\-of\-order\&. If set, the commands in the command\-queue are executed out\-of\-order\&. Otherwise, commands are executed in\-order\&. See note below for more information\&. T} T{ \fBCL_QUEUE_PROFILING_ENABLE\fR T}:T{ Enable or disable profiling of commands in the command\-queue\&. If set, the profiling of commands is enabled\&. Otherwise profiling of commands is disabled\&. See \fBclGetEventProfilingInfo\fR(3clc) for more information\&. T} .TE .sp 1 .RE .PP \fIerrcode_ret\fR .RS 4 Returns an appropriate error code\&. If \fIerrcode_ret\fR is \fBNULL\fR, no error code is returned\&. .RE .SH "NOTES" .PP OpenCL objects such as memory, program and kernel objects are created using a context\&. Operations on these objects are performed using a command\-queue\&. The command\-queue can be used to queue a set of operations (referred to as commands) in order\&. Having multiple command\-queues allows applications to queue multiple independent commands without requiring synchronization\&. Note that this should work as long as these objects are not being shared\&. Sharing of objects across multiple command\-queues will require the application to perform appropriate synchronization\&. This is described in Appendix A of the specification\&. Out\-of\-order Execution of Kernels and Memory Object Commands.PP The OpenCL functions that are submitted to a command\-queue are enqueued in the order the calls are made but can be configured to execute in\-order or out\-of\-order\&. The \fIproperties\fR argument in \fBclCreateCommandQueue\fR can be used to specify the execution order\&. .PP If the \fBCL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE\fR property of a command\-queue is not set, the commands enqueued to a command\-queue execute in order\&. For example, if an application calls \fBclEnqueueNDRangeKernel\fR(3clc) to execute kernel A followed by a \fBclEnqueueNDRangeKernel\fR(3clc) to execute kernel B, the application can assume that kernel A finishes first and then kernel B is executed\&. If the memory objects output by kernel A are inputs to kernel B then kernel B will see the correct data in memory objects produced by execution of kernel A\&. If the \fBCL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE\fR property of a commandqueue is set, then there is no guarantee that kernel A will finish before kernel B starts execution\&. .PP Applications can configure the commands enqueued to a command\-queue to execute out\-of\-order by setting the \fBCL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE\fR property of the command\-queue\&. This can be specified when the command\-queue is created\&. In out\-of\-order execution mode there is no guarantee that the enqueued commands will finish execution in the order they were queued\&. As there is no guarantee that kernels will be executed in order, that is based on when the \fBclEnqueueNDRangeKernel\fR(3clc) calls are made within a command\-queue, it is therefore possible that an earlier \fBclEnqueueNDRangeKernel\fR(3clc) call to execute kernel A identified by event A may execute and/or finish later than a \fBclEnqueueNDRangeKernel\fR(3clc) call to execute kernel B which was called by the application at a later point in time\&. To guarantee a specific order of execution of kernels, a wait on a particular event (in this case event A) can be used\&. The wait for event A can be specified in the \fIevent_wait_list\fR argument to \fBclEnqueueNDRangeKernel\fR(3clc) for kernel B\&. .PP In addition, a wait for events (\fBclEnqueueMarkerWithWaitList\fR(3clc)) or a barrier (\fBclEnqueueBarrierWithWaitList\fR(3clc)) command can be enqueued to the command\-queue\&. The wait for events command ensures that previously enqueued commands identified by the list of events to wait for have finished before the next batch of commands is executed\&. The barrier command ensures that all previously enqueued commands in a command\-queue have finished execution before the next batch of commands is executed\&. .PP Similarly, commands to read, write, copy or map memory objects that are enqueued after \fBclEnqueueNDRangeKernel\fR(3clc), \fBclEnqueueTask\fR(3clc) or \fBclEnqueueNativeKernel\fR(3clc) commands are not guaranteed to wait for kernels scheduled for execution to have completed (if the \fBCL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE\fR property is set)\&. To ensure correct ordering of commands, the event object returned by \fBclEnqueueNDRangeKernel\fR(3clc), clEnqueueTask or \fBclEnqueueNativeKernel\fR(3clc) can be used to enqueue a wait for event or a barrier command can be enqueued that must complete before reads or writes to the memory object(s) occur\&. .SH "ERRORS" .PP \fBclCreateCommandQueue\fR returns a valid non\-zero command\-queue and \fIerrcode_ret\fR 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 \fIerrcode_ret\fR: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_CONTEXT if \fIcontext\fR is not a valid context\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_DEVICE if \fIdevice\fR is not a valid device or is not associated with \fIcontext\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if values specified in \fIproperties\fR are not valid\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_QUEUE_PROPERTIES if values specified in \fIproperties\fR are valid but are not supported by the device\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host\&. .RE .SH "SPECIFICATION" .PP \m[blue]\fBOpenCL Specification\fR\m[]\&\s-2\u[1]\d\s+2 .SH "SEE ALSO" .PP \fBclGetCommandQueueInfo\fR(3clc), \fBclReleaseCommandQueue\fR(3clc), \fBclRetainCommandQueue\fR(3clc), \fBclCreateContext\fR(3clc), \fBclCreateContextFromType\fR(3clc), \fBclassDiagram\fR(3clc) .SH "AUTHORS" .PP \fBThe Khronos Group\fR .SH "COPYRIGHT" .br Copyright \(co 2007-2011 The Khronos Group Inc. .br Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials. .sp .SH "NOTES" .IP " 1." 4 OpenCL Specification .RS 4 \%page 61, section 5.1 - Command Queues .RE