OpenGL interoperability and CPU multithreading

I’m working on a CUDA application that uses OpenGL for rendering. The application runs seperate CPU threads for the CUDA code and the OpenGL code (this IS necessary). This means that the CUDA context and OpenGL context are in different CPU threads. Is it possible to use the OpenGL interoperability in this situation? I suspect that it may at least be possible with CUDA 4.0, but I have not yet had a chance to read the CUDA 4.0 programming guide.

I can certainly find out myself by going through the CUDA programming guide, but I’m hoping that someone here already knows the answer. A pointer to the relevant section of the programming guide would be much appreciated.

The application runs on a Windows 7 64-bit machine with a GTX 590 & CUDA 3.2. I can upgrade to 4.0 if necessary. I cannot post any of the code because it is proprietary.


For OpenGL API functions, the OpenGL context must be current to the calling thread. The OpenGL interop CUDA functions (cudaGraphicsGLRegisterImage, cudacudaGraphicsMapResources, etc) exist in the intersection of the CUDA and OpenGL APIs, so the OpenGL context must be current to the calling thread. All other CUDA functions (kernel launches, etc, etc) may be called from any threads.