Discriminate between system with no CUDA GPU and system with CUDA GPU and inssufficient driver

I want to discriminate (using CUDA runtime API functions only) in my GPU-accelerated applicaton (which uses a certain toolkit version) between the two cases

a) a system with NO cuda-capable GPU
b) a system with a cuda-capable GPU and where the installed graphc driver is not sufficient for the Cuda Toolkit which is used by the application

How can I do that (using CUDA runtime API only) ?
I am using currently the function ‘cudaGetDevicecount’ for that, but it seems to return ‘cudaInsufficientDriver’ also for the case a) which is not what I expected.

should be a strong correlation between gpu architecture/ cc and whether the gpu is cuda-capable

cudaGetDeviceCount() returns cudaSuccess, cudaErrorNoDevice, cudaErrorInsufficientDriver

b) would take priority over a) in that b) is tested before a)

I would assume to get ‘cudaErrorNoDevice’ for case a) and ‘cudaErrorInsufficientDriver’ for case b) , and my code assumes this. But it looks like I get the ‘cudaErrorInsufficientDriver’ error also for case a). (I have to debug more in detail into the application). I use Cuda Toolkit 5.0, 64-bit windows 7.

To make clear, in case a) I include also systems which do NOT have a GPU at all. Actually, the behaviour was observed on such a system which does not have a GPU at all.

“To make clear, in case a) I include also systems which do NOT have a GPU at all”

i presume such a system at least has cuda installed, to be able to make the cudaGetDeviceCount() call in the first place

this leaves me with a question: if you install cuda without a device present, does this then count as a driver resident, or not?

i think cudaGetDeviceCount() would internally first attempt to locate a driver, and would then resume getting a device count from the driver - locating a driver should occur before getting a count
hence, conditional on the answer to the mentioned question, attempting to locate a driver in a system wouthout gpus might result in cudaErrorInsufficientDriver

CUDA Toolkit is never installed in the systems where our application is deployed. The users of our GPU-accelerated application don`t care about CUDA, they just want to run our application :-)

I just want to distinguish between systems with no GPU (or no cuda-capable GPU) and systems with cuda-capable GPU but insufficient driver. Because in the second case I want to notify the user of the application that he/she shall install a newer graphics driver …

“CUDA Toolkit is never installed in the systems where our application is deployed. The users of our GPU-accelerated application don`t care about CUDA, they just want to run our application :-)”

i completely forgot about this possible use case
if no gpu is installed, no driver is probably installed too, but i suppose one can not count on this

perhaps you should consider a system call, rather than a cuda api call, to determine whether there are any cuda capable devices installed

seemingly, cudaGetDeviceCount() determines whether there are any cuda devices, by testing for devices with cc greater than 1
thus, use system calls to determine whether there are any gpus installed, and whether the gpus are nvidia gpus
based on this, you could better differentiate the output of cudaGetDeviceCount()

a) cuda gpus installed; no (nvidia) driver
cudaGetDeviceCount() should return cudaErrorInsufficientDriver
b) no cuda gpus installed; no (nvidia) driver
cudaGetDeviceCount() should return cudaErrorInsufficientDriver
c) no cuda gpus installed; nvidia driver installed [not actually sure whether this is actually possible]
cudaGetDeviceCount() should return cudaErrorNoDevice

you would likely need system calls to differentiate between a) and b)

I think I found a way, for windows. For determining whether a CUDA GPU is present on the system I can try to load the ‘nvcuda.dll’ via the WIndows ‘LoadLibrary’ function. According to my understanding it must be present if the graphics driver of a cuda-capable GPU was installed on the system.

The other check for insufficient driver I can do then with the Cuda Runtime API functions.

i dont know about windows, and frankly i do not care

for linux, i would probably call/ run a script/ system command from within my application, to manipulate the output of lspci
one can specify vendor ids and so forth with lspci