What I want to do is

Render a Image using openGL
process the image using several CL devices.

OS: is XP
cards: 2x NVIDIA GTX 480
cl driver: 197.41
cl develop: cuda 3.0
Im using OSG to handle openGL calls.

However I run into problems when trying to create context that contains several devices when i create the context from OpenGL.

Code :
cl_int err;
 
    cl_platform_id platforms[10];
    cl_uint nrPlatforms;
    err = clGetPlatformIDs(10, platforms,&nrPlatforms );
    CL_REPORT_IF_ERROR(err)    
 
    cl_uint maxDevices = 100;
    cl_device_id* devices = new cl_device_id[maxDevices];
    cl_uint nrDevices;
    err = clGetDeviceIDs(platforms[0], deviceType, maxDevices, devices, &nrDevices);
    CL_REPORT_IF_ERROR(err)
 
 
    cl_context_properties props[] =
    {
        CL_GL_CONTEXT_KHR, gcAdapter->getCL_GL_CONTEXT_KHR(), // The gl context handel
        CL_WGL_HDC_KHR,  gcAdapter->getCL_WGL_HDC_KHR(), //
        0
    };
 
    cl_context gl_to_cl_context;
 
    gl_to_cl_context = clCreateContext(props, nrDevices,
        devices, NULL, NULL, &err);
 
    //Error CL_INVALID_OPERATION
    CL_REPORT_IF_ERROR(err)
 
    // Set the context
    _context = gl_to_cl_context;

if i replace

gl_to_cl_context = clCreateContext(props, nrDevices,
devices, NULL, NULL, &err);

with:

gl_to_cl_context = clCreateContext(props, 1,
devices[0], NULL, NULL, &err);

or

gl_to_cl_context = clCreateContext(props, 1,
devices[1], NULL, NULL, &err);


No error is reported and everything is working. The later option is working but with weary low performance.
But I want to use several devices.

Is it even possible to use several devices operating on gl Recourses?


Regards Ragnar