gpt4 book ai didi

opencv - 在 Ubuntu 16.04 中使用 CUDA 9.0 编译 openCV 4.1.2 时出错

转载 作者:行者123 更新时间:2023-12-04 19:09:56 25 4
gpt4 key购买 nike

这是我的 cmake 命令:

cmake -D CMAKE_BUILD_TYPE=DEBUG\
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D CUDA_ARCH_BIN="6.1" \
-D WITH_TBB=ON \
-D WITH_CUDA=ON \
-D BUILD_opencv_cudacodec=OFF \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D WITH_V4L=ON \
-D WITH_QT=OFF \
-D WITH_OPENGL=ON \
-D WITH_GSTREAMER=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_PC_FILE_NAME=opencv.pc \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_PYTHON3_INSTALL_PATH=~/venv/lib/python3.5/site-packages \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=~/venv/bin/python \
-D PYTHON_DEFAULT_EXECUTABLE=~/venv/bin/python3.5 \
-D BUILD_EXAMPLES=ON ..

配置生成成功。但是,当我尝试编译它时。出现此错误:
...

/home/jaylo/opencv/modules/dnn/src/cuda/math.hpp(30): error: no operator "+" matches these operands
operand types are: __half2 + __half2

/home/jaylo/opencv/modules/dnn/src/cuda/math.hpp(54): error: no operator "+" matches these operands
operand types are: __half2 + __half2

/home/jaylo/opencv/modules/dnn/src/cuda/math.hpp(119): error: no operator "+" matches these operands
operand types are: __half2 + __half2

3 errors detected in the compilation of "/tmp/tmpxft_000048a8_00000000-6_activations.cpp1.ii".
CMake Error at cuda_compile_1_generated_activations.cu.o.DEBUG-D.cmake:281 (message):
Error generating file
/home/jaylo/opencv/build/modules/dnn/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_activations.cu.o


modules/dnn/CMakeFiles/opencv_dnn.dir/build.make:434: recipe for target 'modules/dnn/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_activations.cu.o' failed
make[2]: *** [modules/dnn/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_activations.cu.o] Error 1
CMakeFiles/Makefile2:4972: recipe for target 'modules/dnn/CMakeFiles/opencv_dnn.dir/all' failed
make[1]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

这里发生了什么?看来这是openCV代码本身的语法错误。

最佳答案

CUDA 10.0 为 __half2 添加了 native 矢量算术运算符数据类型。 OpenCV DNN 的 CUDA 后端利用了上述内置运算符。

您要么必须升级到 CUDA 10.0 才能使用 OpenCV DNN 的 CUDA 后端,要么通过取消标记 OPENCV_DNN_CUDA 来禁用它。在 CMake 选项中。

注意:OpenCV DNN 的 CUDA 后端在几周前被合并到 master 中,目前还没有发布。我怀疑您已经构建了主分支而不是 OpenCV 4.1.2。

关于opencv - 在 Ubuntu 16.04 中使用 CUDA 9.0 编译 openCV 4.1.2 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58667609/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com