clEnqueueTask
clEnqueueTask
2007-2011 The Khronos Group Inc. 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.
3
clEnqueueTask Enqueues a command to execute a kernel on a device.

##

cl_int `clEnqueueTask` cl_command_queue command_queue cl_kernel kernel cl_uint num_events_in_wait_list const cl_event *event_wait_list cl_event *event

## Parameters

`command_queue`

  A valid command-queue. The kernel will be queued for execution on the device associated with `command_queue`.

`kernel`

  A valid kernel object. The OpenCL context associated with `kernel` and `command_queue` must be the same.

`num_events_in_wait_list` , `event_wait_list`

  Sspecify events that need to complete before this particular command can be executed. If `event_wait_list` is NULL, then this particular command does not wait on any event to complete. If `event_wait_list` is NULL, `num_events_in_wait_list` must be 0. If `event_wait_list` is not NULL, the list of events pointed to by `event_wait_list` must be valid and `num_events_in_wait_list` must be greater than 0. The events specified in `event_wait_list` act as synchronization points. The context associated with events in `event_wait_list` and `command_queue` must be the same. The memory associated with `event_wait_list` can be reused or freed after the function returns.

`event`

  Returns an event object that identifies this particular kernel execution instance. Event objects are unique and can be used to identify a particular kernel execution instance later on. If `event` is NULL, no event will be created for this kernel execution instance and therefore it will not be possible for the application to query or queue a wait for this particular kernel execution instance.

## Notes

The kernel is executed using a single work-item.

`clEnqueueTask` is equivalent to calling clEnqueueNDRangeKernel with `work_dim` = 1, `global_work_offset` = NULL, `global_work_size`[0] set to 1, and `local_work_size`[0] set to 1.

## Errors

Returns CL_SUCCESS if the kernel execution was successfully queued, or one of the errors below:

- CL_INVALID_PROGRAM_EXECUTABLE if there is no successfully built program executable available for device associated with `command_queue`.
- CL_INVALID_COMMAND_QUEUE if `command_queue` is not a valid command-queue.
- CL_INVALID_KERNEL if `kernel` is not a valid kernel object.
- CL_INVALID_CONTEXT if context associated with `command_queue` and `kernel` is not the same or if the context associated with `command_queue` and events in `event_wait_list` are not the same.
- CL_INVALID_KERNEL_ARGS if the kernel argument values have not been specified.
- CL_INVALID_WORK_GROUP_SIZE if a work-group size is specified for `kernel` using the `__attribute__ ((reqd_work_group_size(X, Y, Z)))` qualifier in program source and is not (`1`, `1`, `1`).
- CL_MISALIGNED_SUB_BUFFER_OFFSET if a sub-buffer object is specified as the value for an argument that is a buffer object and the `offset` specified when the sub-buffer object is created is not aligned to `CL_DEVICE_MEM_BASE_ADDR_ALIGN` value for device associated with `queue`.
- CL_INVALID_IMAGE_SIZE if an image object is specified as an argument value and the image dimensions (image width, height, specified or compute row and/or slice pitch) are not supported by device associated with `queue`.
- CL_INVALID_IMAGE_FORMAT if an image object is specified as an argument value and the image format (image channel order and data type) is not supported by device associated with `queue`.
- CL_OUT_OF_RESOURCES if there is a failure to queue the execution instance of `kernel` on the command-queue because of insufficient resources needed to execute the kernel.
- CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for data store associated with image or buffer objects specified as arguments to `kernel`.
- CL_INVALID_EVENT_WAIT_LIST if `event_wait_list` is NULL and `num_events_in_wait_list` > 0, or `event_wait_list` is not NULL and `num_events_in_wait_list` is 0, or if event objects in `event_wait_list` are not valid events.
- CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
- CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

## Specification

OpenCL Specification

## Also see

clEnqueueNDRangeKernel, clEnqueueNativeKernel

##