cudaGLSetGLDevice issues


i know that the function cudaGLSetGLDevice has to be the first call to the runtime API except stuff like cudaGetDeviceProp etc.

I’m using this call in a QGlWidget class, since it’s recommended to call it after the GL intialisation. But it fails with the well known “setonactiveprocess”. No GPU function has been used before.
So i placed it right after the void main(), where it succeeds. But when i try to register buffer objects, i get the unspecified driver error, just like cudaGLSetGLDevice has never been called.

I’m really tired trying without getting a success, does anyone know how to avoid the last error?

Did You created GL context properly? I would check it first.


Since it’s i QGLWidget I assumed the context gets created by the initializeGL function of the widget. But how can i check the status of the gl context?

PS: everything works fine with opencl :)

Ok…is there a way to find out if any cuda context has been created before, any indicator. As i wrote, i did not call any cuda function before.
Strange behaviour: When i call cudaGLSetGLDevice after main(), no function works after it. It’s a Qt Widget Application, but the Thread is always the same.