Suppose I have a program say toy.cu
and I compile it using nvcc
as follows:
$ nvcc -o toy toy.cu
The executable that is created does not seem to have a dependency on the CUDA driver API: libcuda.so
(found at /usr/lib/x86_64-linux-gnu/libcuda.so)
As reported by ldd
:
$ ldd toy
linux-vdso.so.1 (0x00007fff99554000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa42a200000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa429fe1000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa429ddd000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa429a54000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa42983c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa42944b000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa42a67d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa4290ad000)
There is no mention of libcuda.so
However, when I compile the same program using nvcc
but with cudart (CUDA runtime API library) as shared:
$ nvcc -o toy toy.cu --cudart shared
and try to do ldd
, the dependency on cudart.so
is reported:
$ ldd toy
linux-vdso.so.1 (0x00007ffd09d7c000)
libcudart.so.10.1 => /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so.10.1 (0x00007f1a11829000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1a114a0000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1a11288000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1a10e97000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1a10c78000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1a10a70000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1a106d2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1a11e8e000)
If the CUDA runtime API (when linked dynamically) dependency is shown in ldd
, why isn’t the dependency on the CUDA driver API shown?