How to test for CUDA-compatible hardware? Testing for CUDA Hardware Availablity

I know about the deviceQuery tool to test for CUDA compatible hardware. But I need to do the same thing in my C++ code so I can run the plain-old CPU algorithm if a suitable GPU device is not present.

Is this possible? Or do I have to distribute two versions of my program; CPU-only and CPU+GPU versions?


in the sourcecode of devicequery you can see how to check if compatible devices are present. So you can ship 1 binary.