An application compiled using `nvcc` does not show its dependency on the `` library with `ldd` linux command

Suppose I have a program say and I compile it using nvcc as follows:

$ nvcc -o toy

The executable that is created does not seem to have a dependency on the CUDA driver API: (found at /usr/lib/x86_64-linux-gnu/

As reported by ldd:

$ ldd toy (0x00007fff99554000) => /lib/x86_64-linux-gnu/ (0x00007fa42a200000) => /lib/x86_64-linux-gnu/ (0x00007fa429fe1000) => /lib/x86_64-linux-gnu/ (0x00007fa429ddd000) => /usr/lib/x86_64-linux-gnu/ (0x00007fa429a54000) => /lib/x86_64-linux-gnu/ (0x00007fa42983c000) => /lib/x86_64-linux-gnu/ (0x00007fa42944b000)
        /lib64/ (0x00007fa42a67d000) => /lib/x86_64-linux-gnu/ (0x00007fa4290ad000)

There is no mention of

However, when I compile the same program using nvcc but with cudart (CUDA runtime API library) as shared:

$ nvcc -o toy --cudart shared

and try to do ldd, the dependency on is reported:

$ ldd toy (0x00007ffd09d7c000) => /usr/local/cuda-10.1/targets/x86_64-linux/lib/ (0x00007f1a11829000) => /usr/lib/x86_64-linux-gnu/ (0x00007f1a114a0000) => /lib/x86_64-linux-gnu/ (0x00007f1a11288000) => /lib/x86_64-linux-gnu/ (0x00007f1a10e97000) => /lib/x86_64-linux-gnu/ (0x00007f1a10c78000) => /lib/x86_64-linux-gnu/ (0x00007f1a10a70000) => /lib/x86_64-linux-gnu/ (0x00007f1a106d2000)
        /lib64/ (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?

this is expected behavior.

Runtime API applications generally do not show a runtime-linker dependency on (regardless of whether you link statically or dynamically against cudart - there is no dependence on reported by ldd in either of your cases).

Also, and are not the same thing.

libcudart provides the runtime API.
libcuda provides the driver API.

Although the runtime API (usage) might use the driver API “under the hood” in some cases, such dependency is not evident using the linux runtime-dynamic-linking method, because apparently libcudart uses a different method to load and make use of that library (

You can find various other related questions on these forums. Such as here

1 Like

Runtime API applications generally do not show a dependency on

@Robert_Crovella is this behavior specific to

I don’t really understand the question. The statement you excerpted from my answer is most definitely specific to - it states “on” directly in the excerpt.

1 Like

@Robert_Crovella Thanks got the point.