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 …”
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.
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?
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 (https://codeblue.umich.edu/hoomd-blue/trac/browser/trunk/libhoomd/data_structures/ExecutionConfiguration.cc) to see how I do it in my production code.