Run-Time Detection of Cuda Availability GPU/Driver combos for cuda

We have many systems with many differnt GPUs (most not G80s yet) and different drivers etc.

At runtime, I’d like to be able to determine if the host upon which my app is running can support cuda (hw & drivers etc). I presume I cannot just call something like cudaGetDeviceCount and I don’t want to have to have X started (?) to query the card and driver etc, but I would like to simply know if it is going to be safe to load and use a dso that will rely on the device being there (symbols linked in etc).

My current hack is an oracle that simply returns true if gethostname returns a machine that is on a list of machines that I know have the card - I’d have to maintain that list. This is revolting but I don’t know how else to do this.

I suppose I could query the host’s driver version number (RHEL4) in /proc/driver/nvidia/version and maintain a list of drivers that would allow a cudaGetDeviceCount call etc. A little better but still seems ugly.

This must have come up before…

Thoughts or suggestions?


Take a look at the CHECK_DEVICE macro from the cutil in the SDK. It tries to find a CUDA compatible card and exits if there is none. You should be able to do exactly the same in your check routine.