How to check if GPU supports CUDA?


How can I determine, if a graphic card supports CUDA?

I looked at the function cudaError_t cudaGetDeviceCount ( int * count ) but in the description it says
“… If there is no such device, cudaGetDeviceCount() returns 1 …”

So it’s kind of not possible using this function.

I think you’ve discovered a leftover from the days of device emulation mode that are long gone. During those days there was one device representing device emulation on the CPU that would always show up, so a computer with no CUDA capable devices would still return 1.

Just try it out, I would assume that cudaGetDeviceCount() returns 0 nowadays if no CUDA capable device is found.

Ah that’s good, thanks for your reply :)

I was now thinking what happens, if CUDA is not even installed on a computer. What will happne?
Does Visual Studio 2010 copy the cuda.dll into the executable or how is this handled? Otherwise I would have to check, if CUDA is installed first or am I wrong here?

AFAIR Nvidia recommends to ship the cuda.dll with you application. This also protects against version mismatch.

(Wondering: Why use dynamic linking at all when you are supposed to ship the DLL alongside your code?)

Don’t ship the cuda library with your code, it comes with the driver and is not compatible with other driver versions! Ship cudart, which will dynamically load cuda if the drivers have been installed.

And the whole cudaGetDeviceCount returning 1 when there are no devices is very annoying. As far as I know, CUDA still does this. You need to check the compute capability of all cards in the system to determine if there are any real GPUs or not. Check out scanGPUs and initializeGPUs here ( to see how I do it in my production code.