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

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
CL_DEVICE_TYPE_ALL
. 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
CL_DEVICE_TYPE_CPU
or
CL_DEVICE_TYPE_GPU
explicitly. In this case, the context you create is optimized for the target device.
Note
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

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804