Hi,
I am trying to switch from regular cuda to nvhpc cuda.
In order to manage my prokject I am using cmake which based on the next tutorial
after the line " project(cmake_and_cuda LANGUAGES CXX CUDA)"
Which gives me the following errors:
/opt/clion-2022.2.1/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/opt/clion-2022.2.1/bin/ninja/linux/ninja -DNVHPC_ENABLE=ON -G Ninja -S /home/Yehonatans/work/nlircloud/src -B /home/Yehonatans/work/nlircloud/src/cmake-build-debug
Cmake version 3.23.2
NVHPC_ENABLE is active
-- The CUDA compiler identification is NVIDIA 11.7.64
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - failed
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - broken
CMake Error at /opt/clion-2022.2.1/bin/cmake/linux/share/cmake-3.23/Modules/CMakeTestCUDACompiler.cmake:56 (message):
The CUDA compiler
"/usr/local/cuda/bin/nvcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/Yehonatans/work/nlircloud/src/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/opt/clion-2022.2.1/bin/ninja/linux/ninja cmTC_77f8c && [1/2] Building CUDA object CMakeFiles/cmTC_77f8c.dir/main.cu.o
[2/2] Linking CUDA executable cmTC_77f8c
FAILED: cmTC_77f8c
: && /bin/g++ CMakeFiles/cmTC_77f8c.dir/main.cu.o -o cmTC_77f8c -lcudadevrt -lcudart_static -lrt -lpthread -ldl -L"/usr/local/cuda/targets/x86_64-linux/lib/stubs" -L"/usr/local/cuda/targets/x86_64-linux/lib" && :
/bin/ld: cannot find -lcudadevrt
/bin/ld: cannot find -lcudart_static
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
In order to use CUDA property I relink the cuda at
/usr/local to :
While in order to find the cuda lib I just linked :
cuda → /opt/nvidia/hpc_sdk/Linux_x86_64/22.7/cuda
- What I am doing wrong and how to solve it?
2.How to use Cmake + cuda + nvhppc while keep compatibility with regullar cuda?
3.How to use cmake with nvhpc?
Regards Yehonatan