How tell if Cuda Capable Graphic Card installed? I'm trying to figure out how I can tell from my

I’m trying to figure out how I can tell from my program if a CUDA capable graphics card is installed. That way I can branch and execute different code.

I was looking at the deviceQuery example project that comes with SDK 2.0 (which I’m using). It looks like this.
main( int argc, char** argv)
int deviceCount;
if (deviceCount == 0)
printf(“There is no device supporting CUDA\n”);
int dev;
for (dev = 0; dev < deviceCount; ++dev) {

If I build and run the Debug (not EmuDebug) version of this code on my laptop PC, which does not support CUDA, I expected that I would see
“There is no device supporting CUDA” but instead I get…
C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\bin\win32\Debug>deviceQuery.exe
Cuda error in file ‘’ in line 53 : feature is not yet implemented.

It looks like the program dies before it can execute the “There is no device supporting CUDA” printf statement.
Am I missing something? How can I do this without killing the main program?

Thanks in advance,
Paul Jackson

Remove the CUDA_SAFE_CALL macro and check the return value of cudaGetDeviceCount() yourself.

As tmurray is fond of reminding us: Macros from the SDK, like CUDA_SAFE_CALL, are a bad idea to use in production code because they instantly terminate your program as soon as trouble arises. (That said, I find the macros very useful on experimental code, where the best approach is fail immediately so I can go find the problem.)