cuda11.2 nvidia 3090 ubuntu 18.04 编译安装opencv 3.4.0

1、修改cmake/OpenCVDetectCUDA.cmake:
查找cuda_arch 关键字 把3.0 及3.0 以下的去掉
在这里插入图片描述
cuda11.2 nvidia 3090 ubuntu 18.04 编译安装opencv 3.4.0_第1张图片
cuda11.2 nvidia 3090 ubuntu 18.04 编译安装opencv 3.4.0_第2张图片cuda11.2 nvidia 3090 ubuntu 18.04 编译安装opencv 3.4.0_第3张图片

在这里插入图片描述

这个解决nvcc fatal : Unsupported gpu architecture ‘compute_30’ 问题 和 CUDA_nppi_LIBRARY (ADVANCED) CMake Error: The following variables are used in this project, but they are set to NOTFOUND. 的问题

2、mkdir build cd build
cmake -DBUILD_opencv_cudacodec=OFF -DCUDA_NVCC_FLAGS=–expt-relaxed-constexpr …
解决 /vec_math.hpp(205): error: calling a constexpr host function(“abs”) from a device function(“abs”) is not allowed. The experimental flag ‘–expt-relaxed-constexpr’ can be used to allow this.
3 、make -j

另外还尝试cuda9.0:
需要把OpenCVDetectCUDA.cmake cuda_arch<=2.0 的去掉
cmake -D CUDA_ARCH_BIN=“6.1” VERBOSE=1 -D CUDA_NVCC_FLAGS=–expt-relaxed-constexpr …
make -j

你可能感兴趣的:(opencv,python)