Is there an easy way to find out if a CUDA device is driving a display?


I am trying to developing an application that would do heavy GPU computations, but minimize the impact on the desktop.

For this I need to find out if a CUDA device is currently driving a display - or not. In the latter case I can throw larger work units at the device - and get better throughput.

Is there a reliable way to find out if the GPU is driving a monitor?


At least as i am concerned, my display never got any kinds of problems, while using cuda kernels the same time.

If you do so anyways, identify your GPUs with cuda commands and put only the GPU in place, that has no workload for display use. How this is done is shown in the Nvidia Examples on the documentation homepage…

Here is the link:

int has_timeout;
int device = 0;
error = cudaDeviceGetAttribute(&has_timeout, cudaDevAttrKernelExecTimeout, device);