Closed connorsoohoo closed 6 years ago
nvcc is the CUDA compiler. It is typically located in /usr/local/cuda/bin /usr/local/cuda/bin is an alias for the the installed version of CUDA. e.g. /usr/local/cuda-9.0/bin It is usually set in the PATH environment variable; /usr/local/cuda-9.0/bin
Are you using a tagged version of these install scripts?
SET(CMAKE_CUDA_COMPILER /usr/local/cuda-8.0/bin)
and SET(CMAKE_CUDA_COMPILER_ENV_VAR /usr/local/cuda-8.0/bin)
when using your CMake 3.11 do not work for me. It says the CUDA compiler is not able to compile a simple example.
Yes I am using a tagged version of the script. Right now I'm using the version compatible with 2.13.0. So I am able to get part of the way through the installation if I change the CMake dependency back down to 3.5 and change CMake file in librealsense. However I am getting an issue linking the .so file with the CUDA files. It is telling me that there is an undefined reference to an rscuda:: function that is defined within cuda_conversion.cu from the librealsense2.so shared library.
In the librealsense CMakeLists.txt, I modified project(librealsense2 LANGUAGES C CXX CUDA) to just project(librealsense 2). I then added the following lines so the program can find CUDA:
find_package(CUDA QUIET REQUIRED)
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
SET(CUDA_HOST_COMPILER /usr/bin/g++)
LIST(APPEND CUDA_NVCC_FLAGS "--compiler-options -fno-strict-aliasing -use_fast_math")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++11")
add_definitions(-DRS2_USE_CUDA)
Perhaps it's because I am using CUDA 8.0 instead of CUDA 9.0? I don't see how that would create that much of a difference
Which version of L4T are you using, and which tag version revision? Did you recompile the kernel? Is it actually able to find nvcc now, and call it?
I am using L4T 28.2. Tag version revision 2.13.0 on librealsense 2, but I'm using the master branch of jetson hacks. I exported the cuda file path locations before so I was already able to see nvcc. The way I was able to get rid of the cuda cmake compiler error was to move the enable_language(CUDA) command until after I called the following commands.
SET(CMAKE_CUDA_COMPILER_ENV_VAR /usr/local/cuda-8.0/bin)
SET(CMAKE_CUDA_COMPILER /usr/local/cuda-8.0/bin)
But then I get the following error... Looks like the compiler environment variable / file path is somehow wrong or not recognizing it. I am calling the install script with sudo so I dont know why it is giving me permission denied.
Now changing the CMakeLists.txt file to use the older CMake 3.5.1 I am able to build the librealsense2.so shared library, but in linking rs-software-device I get an undefined reference to rscuda::deproject_depth_cuda.
This is rather strange. The version of CUDA you should be using is version 9.0 if you are using L4T 28.2. Did you manually install CUDA 8.0? Version 2.13.0 of librealsense requires CMake version 3.8 or above, which may account for this issue. It would appear that it is missing the rscuda CUDA object files.
Yes I manually installed CUDA 8.0. I was able to install OpenCV and my SLAM algorithm that both use CUDA. I manually changed the librealsense CMake file to be compatible with 3.5.1, which is how I arrived at the second issue, which doesnt link the .cu files correctly to the shared librealsense2.so library. But even if I revert their CMake file back to the original and use your CMake 3.11, I will arrive at the first issue documented above.
It looks like you set the path, but not the program: SET(CMAKE_CUDA_COMPILER_ENV_VAR /usr/local/cuda-8.0/bin) SET(CMAKE_CUDA_COMPILER /usr/local/cuda-8.0/bin)
I would try:
SET(CMAKE_CUDA_COMPILER_ENV_VAR /usr/local/cuda-8.0/bin/nvcc) SET(CMAKE_CUDA_COMPILER /usr/local/cuda-8.0/bin/nvcc)
Compiles now with CUDA. Thanks!
If you prefer to not change CMakeLists.txt, you can set CUDACXX with the environment by editing
/etc/environment CUDACXX=CUDACXX=/usr/local/cuda-9.0/bin/nvcc
setting it in .bashrc does not work because you need to run the scripts as sudo, which does not carry over your environment variables. Oddly, running sudo with the -E flag also did not work. But setting it in /etc/environment makes it globally available.
I have installed CUDA 8.0 on the Jetson Tx2 and am trying to install Librealsense using the jetson hacks script. I can install the library fine without CUDA, but whenever I enable the CUDA flag, I am getting an issue that the CMAKE_CUDA_COMPILER flag is not found. I can compile other applications using CUDA just fine, but for some reason Librealsense cannot detect my version of CUDA. I've been trying to manually set the CMAKE_CUDA_COMPILER flag to /usr/bin/cc but that just throws another error during build.
I am using jetson hacks install Librealsense package for the installation, and updating the SDK version to 2.14.1 instead of 2.13.0. But both SDK versions return the same error for me.