Adding optional CUDA support to an application

I am considering adding optional CUDA support to an application and I believe the only way to do this is via the Driver API?

The application must be able to start regardless of whether CUDA is installed or if there is a CUDA capable GPU etc.

I can’t seem to step through debug any of the CUDA driver API examples in NSight - is this a limitation of using the Driver API?

So I am a bit concerned my debugging experience won’t be ideal if I do attempt to use the Driver API? I haven’t come across this specific issue in the nsight or CUDA docs?

Oh for some reason I can now step through one of the DriverAPI examples in Nsight - quite possibly I did something wrong before.

And I have now found the part in the guide regards deploying applications(!):

“If cudaGetDeviceCount() reports an error, the application should fall back to an alternative code path.”

I was nervous that if there was no CUDA installed my program would fail to run (so I could choose an alternative non-CUDA path). But it appears that is not the case.

Sorry for missing that in the docs.

There’s no particular reason that adding CUDA support to an existing application needs to be done with the driver API. It could be done with the runtime API also.