• 2019 Update 4
  • 03/20/2019
  • Public Content

Using Shared Context for Multiple OpenCL™ Devices

Intel OpenCL™ implementation features Common Runtime, which enables you to interface with the Intel® Graphics and the CPU devices using a single context.
You can create a “shared” context with both devices. Commands, resource sharing and synchronization instructions on the different devices should follow the OpenCL specification requirements.
The following is an example showing a specific way to create a shared context:
shared_context = clCreateContextFromType(prop, CL_DEVICE_TYPE_ALL, …);
In general avoid
. Proper way to create shared context is to provide the list of devices explicitly:
cl_device_id devices[2] = {cpuDeviceId , gpuDeviceId}; cl_context shared_context = clCreateContext(prop, 2, devices, …);
If you need a context with either CPU or GPU device, use
explicitly. In this case, the context you create is optimized for the target device.
Shared context does not imply any “shared queue”. The OpenCL specification requires you to create a separate queue per device. See the dedicated “HDR Tone Mapping for Post Processing using OpenCL - Multi-Device Version” SDK sample for examples.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.