I have a program that uses the CUDA Driver API. It builds and works fine on a machine with GPU.
The problem is the pipeline used on GitLab where we store the code does not use a GPU. Is there a way to compile CUDA Driver API code without a GPU? For the CUDA Runtime API, the toolkit is enough, but not for this.
I believe the CUDA toolkit (at least recent versions of it) should install enough to compile for the driver API codes as well. You might give an example of the problem you are having with a non-GPU machine compiling for driver API usage. I guess one of the key touchpoints is the driver API library itself provided by libcuda (i.e. libcuda.so)
This would normally get installed by the GPU driver installer, and so on a non-GPU machine that won’t work. Instead, the toolkit installer provides a “stub” library to serve the need. If you direct appropriately at the stub library location (with -L
) then your link against -lcuda
should just work.
For example, I happen to have an install of CUDA 12.2 I am looking at on linux. I see that the CUDA toolkit installed things at /usr/local/cuda
. The usual library link path is /usr/local/cuda/lib64
, and there is no libcuda.so
there. But there is a “stubs” directory /usr/local/cuda/lib64/stubs
that does contain a libcuda.so
. So I can link against that stub library by
nvcc ... -L/usr/local/cuda/lib64/stubs -lcuda
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.