..

command queue

command queue 定义

  • Command queues provide the interface for interacting with compute devices. The command_queue class provides methods to copy data to and from a compute device as well as execute compute kernels.

  • Command queues are created for a compute device within a compute context.
  • 最大的任务,数据的搬运工。

创建

#include <boost/compute/core.hpp>

// get the default compute device
boost::compute::device device = boost::compute::system::default_device();

// set up a compute context and command queue
boost::compute::context context(device);
boost::compute::command_queue queue(context, device);

1个特点

  • Data transfer operations may convey data to or from a device, but commands in a command queue move in one direction only: from the host to a device. The device doesn’t send commands to the host.

API

event enqueue_task(const kernel & kernel, 
                   const wait_list & events = wait_list());
Enqueues a kernel to execute using a single work-item.

See the documentation for clEnqueueTask() for more information.

其他

When you create a kernel, you don’t have to identify a target device—it can be sent to any device in the context. Instead, you identify the target device when you create a command queue. Then when you deploy kernels to the queue, they will be sent to the device associated with the queue. kernel execution is only one type of command that can be dispatched to a command queue. A command is a message sent from the host that tells a device to perform an operation. Besides kernel execution, many OpenCL command operations involve data transfer: reading data from the device to the host, writing data from the host to the device, and copying data between devices


Nothing