Select device for off-screen rendering

I am under Ubuntu 10.04 and have a computer with several NVIDIA GPU’s available (GT240 and 3xGTX480) and, in principal, would like to do the following for each device:

  • create an OpenGL render context
  • render something to an off-screen FBO
  • bind FBO for usage in OpenCL/CUDA and process them with some kernels
  • read back the result and save it to a file

Now for one device (the one connected to the monitor), everything is working fine. I open a (useless) window with freeglut and do everything silently in the background using FBOs and PBOs and the opencl map gl buffer functions.

But how …
A) can I select the device where my rendering and computations are done? Both should be done on the same device to be able to use gl/cl interop. I would like to do run the same code for each device independently.
B) to not create the useless graphics window? This is probably even not possible for the devices not connected to a monitor. I read something about just using glutCreateWindow and not entering glutMainLoop. But how is it possible to select the device here?
C) do I use several devices - especially several opengl and opencl/cuda contexts - in one program with multithreading? E.g. for each device one computation thread which has its own contexts. Is freeglut of use here?

If you have any hints, experiences or tutorials, this would really be of great use!

Hi, I have the same problem. have solved your question?