NVCC not working

After going through the toolkit download on my Jetson AGX Orin here:

NVCC isn’t recognized as a command. “which nvcc” doesn’t pull up anything. I tried looking for the cuda toolkit download location, but couldn’t find it.
I also tried “export PATH=/opt/local/NVIDIA/cuda-10.0/bin:$PATH”
but that didn’t work.
What else should I do?

Hi,

We have JetPack 6 GA release which contains CUDA 12 so you don’t need to upgrade it manually.

If you prefer to do so, the upgradable CUDA uses compat lib.
Please check the below topic to export the path accordingly.

Thanks.

So how do I use NVCC on my Orin board if it isn’t a recognized command?

Hi,

Please check the topic to export some global variables and nvcc will work normally.
Thanks.

After running export PATH=/usr/local/cuda-12/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-12.0/compat
nvcc works, however when i try to use cudaMalloc I get the following error: “CUDA driver version is insufficient for CUDA runtime version”
How can I fix that?

Hi,

It looks like you are using CUDA 12.4.
So please upgrade the path to 12.4.

$ export LD_LIBRARY_PATH=/usr/local/cuda-12.4/compat

More, the package is built for Ubuntu 22.04.
Do you use the r36 branch that comes from JetPack 6?

Thanks.

Things are working for nvcc now, but when I use the following makefile I get an error.
NVCC=nvcc

###################################

These are the default install

locations on most linux distros

###################################

OPENCV_LIBPATH=/usr/lib
OPENCV_INCLUDEPATH=/usr/include

###################################################

On Macs the default install locations are below

###################################################

#OPENCV_LIBPATH=/usr/local/lib
#OPENCV_INCLUDEPATH=/usr/local/include

or if using MacPorts

#OPENCV_LIBPATH=/opt/local/lib
#OPENCV_INCLUDEPATH=/opt/local/include

OPENCV_LIBS=-lopencv_core -lopencv_imgproc -lopencv_highgui

CUDA_INCLUDEPATH=/opt/local/cuda-10.0/include

######################################################

On Macs the default install locations are below

#CUDA_INCLUDEPATH=/usr/local/cuda/include
#CUDA_LIBPATH=/usr/local/cuda/lib

NVCC_OPTS=-O3 -arch=sm_61 -Xcompiler -Wall -Xcompiler -Wextra -m64

GCC_OPTS=-O3 -Wall -Wextra -m64

student: main.o student_func.o compare.o reference_calc.o Makefile
$(NVCC) -o HW1 main.o student_func.o compare.o reference_calc.o -L $(OPENCV_LIBPATH) $(OPENCV_LIBS) $(NVCC_OPTS)

main.o: main.cpp timer.h utils.h reference_calc.cpp compare.cpp HW1.cpp
g++ -c main.cpp $(GCC_OPTS) -I $(CUDA_INCLUDEPATH) -I $(OPENCV_INCLUDEPATH)

student_func.o: student_func.cu utils.h
nvcc -c student_func.cu $(NVCC_OPTS)

compare.o: compare.cpp compare.h
g++ -c compare.cpp -I $(OPENCV_INCLUDEPATH) $(GCC_OPTS) -I $(CUDA_INCLUDEPATH)

reference_calc.o: reference_calc.cpp reference_calc.h
g++ -c reference_calc.cpp -I $(OPENCV_INCLUDEPATH) $(GCC_OPTS) -I $(CUDA_INCLUDEPATH)

clean:
rm -f *.o *.png hw

Error: g++ -c main.cpp -O3 -Wall -Wextra -m64 -I /opt/local/cuda-10.0/include -I /usr/include
g++: error: unrecognized command line option ‘-m64’
make: *** [Makefile:43: main.o] Error 1

How can I fix that?

Hi,

Could you remove the -m64 config and try it again?

GCC_OPTS=-O3 -Wall -Wextra

Thanks.

Now the error I get is:
In file included from main.cpp:4:
timer.h:4:10: fatal error: cuda_runtime.h: No such file or directory
4 | include <cuda_runtime.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.

Hi,

You should find the file under /usr/local/cuda/include/.
Please add the path to the included path.

Thanks.

This is what is already in the makefile: #CUDA_INCLUDEPATH=/usr/local/cuda/include
should I update the path in my #include statement instead?

Hi,

Could you share the complete compiling log so we can check if the path added to the compiling flag?

Thanks.

Where do I find that?

Hi,

Usually it will show on the console.
Please run $make clean and $make. Then share the complete log with us.

Thanks.

Ok. here’s what I got.

g++ -c main.cpp -O3 -Wall -Wextra -I /opt/local/cuda-10.0/include -I /usr/include
In file included from main.cpp:4:
timer.h:4:10: fatal error: cuda_runtime.h: No such file or directory
    4 | #include <cuda_runtime.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:44: main.o] Error 1

Hi

It looks like you are using an incorrect path.
The cuda_runtime.h is located at /usr/local/cuda/include, not the /opt/local/cuda-10.0/include.

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.