Is CUDA enabled on my Graphic Card?


I would like to compute a c# function to test if my graphic card is enabled with CUDA. I know that the NVIDIA site responded by the knowledge of the model of the card and by looking at a list of enabled card at “”. But I want to do it with a program. Is there an existing function with CUDA Library which does the job or not? And if not, how to do it?

Thank you very for answers :)

CUDA isn’t directly available in C#

You would either need to call a CUDA C/C++ library routine from C#, or else use one of the existing bindings like managedCuda or cudafy.

And is “CUDA C/C++ Library” owns a special routine to test if the graphic card use CUDA?

The typical methodology would be to:

  1. Statically link cudart library to your application (which is the default)
  2. Perform an innocuous CUDA runtime library call (such as cudaSetDevice(0))
  3. Check the error code from the above call. If it is cudaSuccess, a CUDA capable GPU (at least one) is available, and properly installed. If it is not cudaSuccess, then a properly installed CUDA GPU is not available.
  4. If cudaSuccess is returned in step 3 above, then you can do other cuda runtime api calls to determine how many GPUs are available, and what type they are.

The CUDA deviceQuery sample code generally covers all this.