cuda_opencv - Extended-Object-Detection-ROS/wiki_english GitHub Wiki
Build with CUDA
This section is not complete and structured! Contains some of my notes on this topic.
Install CUDA и cuDNN
Guide I used - https://medium.com/analytics-vidhya/installing-tensorflow-with-cuda-cudnn-gpu-support-on-ubuntu-20-04-f6f67745750a
At the moment where it is copied .h file cuDNN you need to copy all files.
Конфигурация OpenCV
There is a problem that different versions of OpenCV work with different versions of cuDNN. For my cuDNN (8.0.5) OpenCV 4.2.0 did not get up in any way, it turned out with version 4.4.0. I did not find any version matching table.
As a result, I configured this command. Here you need to keep track of the paths and versions of CUDA and cuDNN, and take the value for CUDA_ARCH_BIN from the nvid website for your specific map https://developer.nvidia.com/cuda-gpus
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_TBB=ON -D WITH_V4L=ON -D OPENCV_EXTRA_MODULES_PATH=~/Libs/opencv_contrib/modules -D OPENCV_ENABLE_NONFREE=ON -D WITH_CUDA=ON -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D CUDA_ARCH_BIN=6.1 -D WITH_CUBLAS=1 -D BUILD_EXAMPLES=ON -D CUDNN_INCLUDE_DIR=/usr/lib/cuda/include -D CUDNN_LIBRARY=/usr/lib/cuda/lib64/libcudnn_static.a -D CUDNN_VERSION=8.0.5 -DCMAKE_C_COMPILER=/usr/bin/gcc-8 ..
I got an error that cuDNN wants a version of gcc no higher than 8th, for this I need to make a simulink
sudo ln -s /usr/bin/gcc-8 /usr/local/cuda/bin/gcc
Then there was a problem with assembling some parts of cuDNN, this solution helped https://github.com/opencv/opencv/issues/18082