How to know if a CUDA device is attaced to display?

I have searched briefly through the web and also this forum but couldn’t find useful information about it.

For apparent reason, is there a way to know which device is attached to display (monitor) and which is not?

Thanks.

No. But you can query the device properties and test whether the kernel execution timeout is enabled. In many cases, that is equivalent to being attached to a display.

Thank you, DrAnderson42.

Unfortunately all cards (a Quadro FX 4600 and a GeForce GT 220) in the box have kernel exec timeout set to false by default.

Any other ideas?

Well, if you are running a GUI of any sort (windows OS, X11) then you must have jumped through a number of hoops to disable that timeout, because it is on by default and difficult to disable. If the machine is running linux text mode w/o a timeout, does matter in any way which is attached?

I am sorry to have omitted the details.

I am writing CUDA code for Windows environment with GUI enabled (of course :) ).

In fact, I wanted to decide which GPU is connected to the monitor so that I could choose it for both CUDA and OpenGL interop, since I guess it would be faster that way without the copying of memory between GPUs.

But that is just a guess, do you have any ideas about the selection of device in OpenGL interop scenario?

Thank you.

Sorry, I don’t know anything about CUDA programming on windows (though it is odd that your kernel exec timeout is disabled…). Maybe someone else will reply. Otherwise, you may try searching the CUDA on windows forums for a more specific answer. I seem to recall some windows-specific API (external to CUDA) that allows you to query additional info on the GPUs in the system.

In Linux you can run (external program)

nvidia-smi -a

which in my case displays:

==============

[…]

Driver Version : 260.19.06

GPU 0:

Product Name		: GeForce GTX 480

PCI Device/Vendor ID	: 6c010de

PCI Location ID		: 0:1:0

Display			: Connected

Temperature		: 49 C

Fan Speed		: 44%

Utilization

	GPU			: 0%

	Memory		: 4%

[…]

==============

Maybe in windows there’s something similar