Reputation: 3
I am trying to build OpenCV 2.4 with Cuda-10.2 which is installed on Jetson AGX Xavier. I have followed this blog post in order to change the files so that opencv is able to find all cuda libraries.
I am running the following command to generate cmake cache:
cmake -DCMAKE_INSTALL_PREFIX=~/lib/opencv_2.4/installed -DCMAKE_BUILD_TYPE="Release" -DWITH_CUDA=ON -DCUDA_GENERATION=Volta -D OPENCV_DNN_CUDA=ON -DCUDA_ARCH_BIN=7.5 -DCUDA_HOST_COMPILER=/usr/bin/gcc-8 -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 ..
I am getting the following error when I do make or make -j8
[ 56%] Linking CXX executable ../../bin/opencv_perf_photo
[ 56%] Built target opencv_perf_photo
[ 56%] Built target opencv_gpu_pch_dephelp
[ 57%] Built target pch_Generate_opencv_gpu
[ 58%] Building NVCC (Device) object modules/gpu/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_bf_knnmatch.cu.o
In file included from /home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/functional.hpp:50:0,
from /home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/vec_distance.hpp:47,
from /home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu:49:
/usr/local/cuda-10.2/include/device_functions.h:54:2: warning: #warning "device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." [-Wcpp]
#warning "device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead."
^~~~~~~
In file included from /home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/functional.hpp:50:0,
from /home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/vec_distance.hpp:47,
from /home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu:49:
/usr/local/cuda-10.2/include/device_functions.h:54:2: warning: #warning "device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." [-Wcpp]
#warning "device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead."
^~~~~~~
In file included from /home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/functional.hpp:50:0,
from /home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/vec_distance.hpp:47,
from /home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu:49:
/usr/local/cuda-10.2/include/device_functions.h:54:2: warning: #warning "device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." [-Wcpp]
#warning "device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead."
^~~~~~~
In file included from /home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/functional.hpp:50:0,
from /home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/vec_distance.hpp:47,
from /home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu:49:
/usr/local/cuda-10.2/include/device_functions.h:54:2: warning: #warning "device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." [-Wcpp]
#warning "device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead."
^~~~~~~
/home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/detail/../warp_shuffle.hpp(60): error: identifier "__shfl" is undefined
/home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/detail/../warp_shuffle.hpp(71): error: identifier "__shfl" is undefined
/home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/detail/../warp_shuffle.hpp(92): error: identifier "__shfl_down" is undefined
/home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/detail/../warp_shuffle.hpp(103): error: identifier "__shfl_down" is undefined
/home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/detail/../warp_shuffle.hpp(124): error: identifier "__shfl_up" is undefined
/home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/detail/../warp_shuffle.hpp(135): error: identifier "__shfl_up" is undefined
/home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/detail/../warp_shuffle.hpp(84): error: identifier "__shfl_down" is undefined
detected during:
instantiation of "T cv::gpu::device::shfl_down(T, unsigned int, int) [with T=float]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(75): here
instantiation of "void cv::gpu::device::bf_knnmatch::findBestMatch<BLOCK_SIZE>(float &, float &, int &, int &, float *, int *) [with BLOCK_SIZE=16]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(401): here
instantiation of "void cv::gpu::device::bf_knnmatch::matchUnrolledCached<BLOCK_SIZE,MAX_DESC_LEN,Dist,T,Mask>(cv::gpu::PtrStepSz<T>, cv::gpu::PtrStepSz<T>, Mask, int2 *, float2 *) [with BLOCK_SIZE=16, MAX_DESC_LEN=64, Dist=cv::gpu::device::L1Dist<cv::gpu::device::uchar>, T=unsigned char, Mask=cv::gpu::device::SingleMask]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(420): here
instantiation of "void cv::gpu::device::bf_knnmatch::matchUnrolledCached<BLOCK_SIZE,MAX_DESC_LEN,Dist,T,Mask>(const cv::gpu::PtrStepSz<T> &, const cv::gpu::PtrStepSz<T> &, const Mask &, const cv::gpu::PtrStepSz<int2> &, const cv::gpu::PtrStepSz<float2> &, cudaStream_t) [with BLOCK_SIZE=16, MAX_DESC_LEN=64, Dist=cv::gpu::device::L1Dist<cv::gpu::device::uchar>, T=unsigned char, Mask=cv::gpu::device::SingleMask]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(852): here
instantiation of "void cv::gpu::device::bf_knnmatch::match2Dispatcher<Dist,T,Mask>(const cv::gpu::PtrStepSz<T> &, const cv::gpu::PtrStepSz<T> &, const Mask &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, cudaStream_t) [with Dist=cv::gpu::device::L1Dist<cv::gpu::device::uchar>, T=unsigned char, Mask=cv::gpu::device::SingleMask]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(1149): here
instantiation of "void cv::gpu::device::bf_knnmatch::matchDispatcher<Dist,T,Mask>(const cv::gpu::PtrStepSz<T> &, const cv::gpu::PtrStepSz<T> &, int, const Mask &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzf &, cudaStream_t) [with Dist=cv::gpu::device::L1Dist<cv::gpu::device::uchar>, T=unsigned char, Mask=cv::gpu::device::SingleMask]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(1166): here
instantiation of "void cv::gpu::device::bf_knnmatch::matchL1_gpu<T>(const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, int, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzf &, cudaStream_t) [with T=cv::gpu::device::uchar]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(1172): here
/home/nvidia/opencv-2.4/modules/gpu/include/opencv2/gpu/device/detail/../warp_shuffle.hpp(84): error: identifier "__shfl_down" is undefined
detected during:
instantiation of "T cv::gpu::device::shfl_down(T, unsigned int, int) [with T=int]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(77): here
instantiation of "void cv::gpu::device::bf_knnmatch::findBestMatch<BLOCK_SIZE>(float &, float &, int &, int &, float *, int *) [with BLOCK_SIZE=16]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(401): here
instantiation of "void cv::gpu::device::bf_knnmatch::matchUnrolledCached<BLOCK_SIZE,MAX_DESC_LEN,Dist,T,Mask>(cv::gpu::PtrStepSz<T>, cv::gpu::PtrStepSz<T>, Mask, int2 *, float2 *) [with BLOCK_SIZE=16, MAX_DESC_LEN=64, Dist=cv::gpu::device::L1Dist<cv::gpu::device::uchar>, T=unsigned char, Mask=cv::gpu::device::SingleMask]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(420): here
instantiation of "void cv::gpu::device::bf_knnmatch::matchUnrolledCached<BLOCK_SIZE,MAX_DESC_LEN,Dist,T,Mask>(const cv::gpu::PtrStepSz<T> &, const cv::gpu::PtrStepSz<T> &, const Mask &, const cv::gpu::PtrStepSz<int2> &, const cv::gpu::PtrStepSz<float2> &, cudaStream_t) [with BLOCK_SIZE=16, MAX_DESC_LEN=64, Dist=cv::gpu::device::L1Dist<cv::gpu::device::uchar>, T=unsigned char, Mask=cv::gpu::device::SingleMask]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(852): here
instantiation of "void cv::gpu::device::bf_knnmatch::match2Dispatcher<Dist,T,Mask>(const cv::gpu::PtrStepSz<T> &, const cv::gpu::PtrStepSz<T> &, const Mask &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, cudaStream_t) [with Dist=cv::gpu::device::L1Dist<cv::gpu::device::uchar>, T=unsigned char, Mask=cv::gpu::device::SingleMask]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(1149): here
instantiation of "void cv::gpu::device::bf_knnmatch::matchDispatcher<Dist,T,Mask>(const cv::gpu::PtrStepSz<T> &, const cv::gpu::PtrStepSz<T> &, int, const Mask &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzf &, cudaStream_t) [with Dist=cv::gpu::device::L1Dist<cv::gpu::device::uchar>, T=unsigned char, Mask=cv::gpu::device::SingleMask]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(1166): here
instantiation of "void cv::gpu::device::bf_knnmatch::matchL1_gpu<T>(const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, int, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzb &, const cv::gpu::PtrStepSzf &, cudaStream_t) [with T=cv::gpu::device::uchar]"
/home/nvidia/opencv-2.4/modules/gpu/src/cuda/bf_knnmatch.cu(1172): here
8 errors detected in the compilation of "/tmp/tmpxft_000021a9_00000000-7_bf_knnmatch.compute_72.cpp1.ii".
CMake Error at cuda_compile_generated_bf_knnmatch.cu.o.cmake:264 (message):
Error generating file
/home/nvidia/opencv-2.4/build/modules/gpu/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_bf_knnmatch.cu.o
modules/gpu/CMakeFiles/opencv_gpu.dir/build.make:503: recipe for target 'modules/gpu/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_bf_knnmatch.cu.o' failed
make[2]: *** [modules/gpu/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_bf_knnmatch.cu.o] Error 1
CMakeFiles/Makefile2:4741: recipe for target 'modules/gpu/CMakeFiles/opencv_gpu.dir/all' failed
make[1]: *** [modules/gpu/CMakeFiles/opencv_gpu.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
I have also tried it with -DCUDA_ARCH_BIN=7.2. I get the same error. How can I resolve this error?
Upvotes: 0
Views: 706
Reputation: 104555
OpenCV 2.4 will not work with CUDA Toolkit 10.2. It was originally designed for both versions 4.1 and 4.2. You might be able to get that code to compile and run if you can downgrade to CUDA 9. Otherwise you would have to rewrite those kernels to remove usage of deprecated instructions which are no longer supported and can't work on your Volta GPU.
Reference: OpenCv Compiling with Cuda
Upvotes: 1