Visible to Intel only — GUID: GUID-5B21285C-553B-4734-9DE5-7998DCB70F94
Visible to Intel only — GUID: GUID-5B21285C-553B-4734-9DE5-7998DCB70F94
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.