CUDA not found


I am trying to run the TensorRT YOLO example and I need to install all the dependencies.
However, when I try to install pycuda I see errors that cuda.h not found.
I would like to ask how I can get the cuda libraries installed in my Xavier NX.

It may help to know that the CUDA headers are not in a default search location even if installed. Do you have any “cuda” directory in “/usr/local/”? For example:
ls -ld /usr/local/cuda*

If not, there can be some differences in what is needed to add CUDA content based on version. In some cases you can use the apt mechanism, but in all cases you can use the SDK Manager (of the same release as the Jetson, never cross releases…it’s a bit like “never cross the beams” in the original Ghostbusters movie :P ) to add those packages. In the case of using SDKM you can deselect flash and deselect install of packages to host PC, and then just add the content to a running Jetson via SDKM on the host PC.


I can see cuda-10.2 in /usr/local

$ ls -ld /usr/local/cuda*
lrwxrwxrwx 1 root root 9 Sep 1 08:27 /usr/local/cuda -> cuda-10.2
drwxr-xr-x 12 root root 4096 Sep 1 08:27 /usr/local/cuda-10.2

This means you have the content (I am tempted to say “these are the droids you are after…”), but the content is not in your standard search path, and thus the software simply did not know where to look for the CUDA content.

There is different software which may need different cuda.h header files, and I don’t know enough to give you the correct location. However, if you have sufficient debug messages and can see the #include of the header error, see if one of these will work:

#include <linux/cuda.h>

Or adding “/usr/local/cuda-10.2/targets/aarch64-linux/include” to your standard search path, and then:

#include <cuda.h>

In the first example “linux/cuda.h” is appended to the standard path, and so it finds “/usr/include/linux/cuda.h”. In the latter example “cuda.h” is appended to all search paths, and this would be found under “/usr/local/cuda-10.2/targets/aarch64-linux/include” as “/usr/local/cuda-10.2/targets/aarch64-linux/include/cuda.h”.

Sorry I can’t be more specific, I only know the general mechanism (assuming C/C++).