Context with different vendors


I tried create a context colaborative with 2 differents vendors. Because, my machine have a CPU INTEL and a NVidia GPU, but when run, a execution error occurs.

Below follow my code:

cl_platform_id plataforma[2];
cl_uint total_de_plataformas;

clGetPlatformIDs(2, plataforma, &total_de_plataformas);

cl_device_id dispositivo[2];
cl_uint num_devices;

clGetDeviceIDs(plataforma[0], CL_DEVICE_TYPE_GPU, 1, dispositivo[0], &num_devices);
clGetDeviceIDs(plataforma[1], CL_DEVICE_TYPE_CPU, 1, dispositivo[1], &num_devices);

cl_context contexto;

int err;
contexto = clCreateContext(NULL, 2, dispositivo, NULL, &err ); //In this line the execution error occurs.


Hello Luizdrumond,

If I look at the OpenCL UML class diagram, it seems that there can be only one platform per context.

Unfortunately you must create two separate contexts per platform.


Very thanks for you help.