How to choose right device when multiGPU


I have to card in my computer under red hat 5.
One 8600 and one 8800.
My screen and so Xserver are attached to the 8600.
I would like to use the 8800 as cuda only card since there is the famous “5 seconds limitation” with X.

How can I get automatically (by program) the right device, that’s to say the card which is not attached to the xserver.
Do you know if there is a trick to get it from the xserver and then pass the right id to cudaSetDevice() ?


I’m not sure if you can get the current display adapter from X. But you can use cudaGetDeviceProperties() to find the 8800 card.

Yeah, this is a general problem. tachyon_john mentioned that he has been requesting various new CUDA functions from NVIDIA to help in the general load balancing problem. (i.e. “Which card is not being used right now?”) However, there isn’t really anything automatic available.

jimh’s suggestion is pretty much the only option at the moment.

Thanks a lot guys for these advises.
I’m going to do with jimh’s answer but I’ll go on searching.

I’ll post if i find anything.