OpenGL OpenCL interop on Multy GPUs

Discussion created by Kieren on Mar 1, 2011
Latest reply on Sep 6, 2011 by Kieren
GL_INTEROP is not working if OpenCL and OpenGL contexts are on differed devices


Hi there


I'm trying to get the best performance out of my multi-GPU system.

The idea was to have both GPUs work at the same time

There for I tired to modify the oclSimpleGl example form the NVIDIA developer page in the way that one GPU is doing the OpenGL load an the other GPU is modifying the VBO via OpenCL.


As long as I'm not using GL_INTEROP everything is working fine.

The first GPU (OpenGL) is on 50% load and the second GPU(OpenCL) 25%.

Without GL_ INTEROP the Data has to be copied in each update cycle.

It is really slow only ~280fps.

With only one GPU I get also 280fps with 70% GPU load.
(GPU laod checkt with GPU-Z)



So no the fun stuff.

Enabling GL_INTEROP and using only the first GPU leads to round about 1200fps (!) with 54% load. Yes really 1,2k fps.


And now the problem.

Using GL_INTEROP with two GPUs sounds like a good idea.

But it seams as the Buffer is not transferred between the GPUs.

Both GPUs ware working. GPU0(OpenGL) 29%, GPU1(OpenCL) 25% and still the windows says 1,2 fps but stays black.


If I check the buffer via

glBindBufferARB(GL_ARRAY_BUFFER, vbo);

float* ptr = (float*)glMapBufferARB(GL_ARRAY_BUFFER, GL_WRITE_ONLY_ARB);


the content stays at 0.0 all over the array.


Neither OpenGL nor OpenCL are reporting any errors. The OCLcontext is created with no problems clEnqueueAcquireGLObjects works fine.



Am I doing anything wrong? Or is the driver not aware that the data it modifies is on the other device.

It looks a little like clCreateFromGLBuffer() does not check if the OpenGl and OpenCL contexts are on the same device. And just a pointer to the actual position of the OpenGL-Buffer is promoted not the device. As there are two identical GPUs the pointer is reachable and some random memory on GPU1(OpenCL) is modified.


Thank you for any suggestions how to fix this problem.




System Info:
Alienware M17XR2
Two ATI Mobility Radeon HD 5870 (CrossFireX enabled)
Intel(R) i7 CPU M620

(I'm german so sorry for the bad english )