Check for CUDA installation during my software installation

Hi,

I’m developing a software that is capable of running calculations either on a CUDA-capable or non-CUDA-capable GPU. Since, to my knowledge, CUDA can only be installed on a computer with a CUDA-capable GPU and I cannot know for certain that my customer will have such a computer.

Thus, how can I check if CUDA is installed from within my installer?

I guess I can make a bat file with “where nvcc” and “nvcc --version” and extract the version. Is that the only way?

That wouldn’t be the recommended way. That is testing for installation of the CUDA toolkit. That isn’t normally a requirement for GPU application deployment.

Instead, you want to test for GPU support. One possible method to do this is to run a simple app that uses the driver API, and tests a simple call like cuInit() for success/failure, then sets a return code upon app exit to indicate the result. If you also wish version information, follow a methodology similar to the deviceQuery or deviceQueryDrv sample codes.

Alternatively, you can build similar functionality into your application. By statically linking any needed libraries, the app can test for GPU support itself, and behave accordingly.

The following may also be of interest:

https://docs.nvidia.com/deploy/cuda-compatibility/index.html
https://docs.nvidia.com/cuda/eula/index.html#attachment-a