A CUDA distribution, at least on Linux, has a "stub libraries" directory, which contains among others a libcuda.so
file - named the same as an actual NVIDIA driver library.
When build a CUDA program which makes driver API calls, on a system with both CUDA and the CUDA driver installed - when should I be linking against the driver library stub, and when should I link against the actual driver library?
Notes:
- In case it matters, assume a recent CUDA release (version 11.x or 12.x).
- The NVIDIA driver might be different than the driver version bundled with the CUDA distribution, i.e. that may be one of the factors.
- If we're using a build system generator, e.g. CMake, this question is basically moot, since you let it decide where to locate the relevant libraries - and its choice works. See this question about doing that.