Visible to Intel only — GUID: GUID-31C846F0-F332-41A1-A904-6CC422032AD0
Creating Shared Context
OpenCL™ Runtime and Compiler for Intel® Processor Graphics
Intel implementation of the OpenCL™ standard supports context for multiple devices, also called “shared context”. An OpenCL context of an Intel® processor and Intel Graphics device enables memory and events to share different device facilities. This feature eases development of workloads that run across the platform (CPU and GPU).
To create a shared context for all devices:
shared_context = clCreateContextFromType(prop, CL_DEVICE_TYPE_ALL, …);
Do not specify CL_DEVICE_TYPE_ALL if the application targets a single device context, either Intel CPU or Intel Graphics.
To create a shared context for a single device, specify CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_GPU explicitly:
cl_device_id devices[2] = {cpuDeviceId , gpuDeviceId}; cl_context shared_context = clCreateContext(prop, 1, devices, …);
For more information on the functionality of a shared context, self-management and application-level management, see the OpenCL™ 1.2 specification.
You do not need to worry about memory object mirroring or migration between different context devices, just avoid concurrent “Write” access to the same memory object by the different devices, as stated in the OpenCL 1.2 Specification.
The following extensions are not supported in the shared context:
- cl_khr_gl_sharing
- cl_khr_d3d10_sharing
- cl_khr_d3d11_sharing
- cl_intel_dx9_media_sharing
- cl_intel_d3d11_nv12_media_sharing
See Also
OpenCL 1.2 Specification at http://www.khronos.org/registry/cl/specs/opencl-1.2.pdf