..

context

platform定义

  • In OpenCL, a context identifies a set of devices—not every possible device, but only those selected to work together. Contexts make it possible to create command queues, the structures that allow hosts to send kernels to devices.
  • A context object manages a set of OpenCL resources including memory buffers and program objects. Before allocating memory on the device or executing kernels you must set up a context object.
  • 就是执行环境。

创建

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

// create a context for the device
boost::compute::context context(gpu);

接口说明

device get_device() const;

Returns the device for the context. If the context contains multiple devices, the first is returned.

该接口就说明了,context下可能有多个device。


Nothing