首先,如果我尝试编译不带CUDA的OpenCV,则一切正常。
之后,我在CMake中添加了“WITH CUDA”选项,并提供了所有正确的路径,但是Visual Studio给出了以下错误:
9>------ Build started: Project: opencv_world, Configuration: Release x64 ------
9>Building NVCC (Device) object modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Release/cuda_compile_generated_gpu_mat.cu.obj
9>nvcc fatal : Unsupported gpu architecture 'compute_20'
9>CMake Error at cuda_compile_generated_gpu_mat.cu.obj.cmake:206 (message):
9> Error generating
9> C:/OpenCV-3.3.0/opencv-3.3.0/build/modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Release/cuda_compile_generated_gpu_mat.cu.obj
考虑到这可能是一个"ARCH"问题,我尝试在CMake中进行更改:
CUDA_ARCH_BIN : 2.0 3.0 3.5 3.7 5.0 5.2 6.0 6.1
致:
CUDA_ARCH_BIN : 6.0 6.1
因为我使用的是1080,Visual Studio现在给我报这个错误:
6>------ Build started: Project: opencv_world, Configuration: Release x64 ------
6>Building NVCC (Device) object modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Release/cuda_compile_generated_gpu_mat.cu.obj
6>gpu_mat.cu
6>'bin' is not recognized as an internal or external command,
6>operable program or batch file.
6>CMake Error at cuda_compile_generated_gpu_mat.cu.obj.cmake:206 (message):
6> Error generating
6> C:/OpenCV-3.3.0/opencv-3.3.0/build/modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Release/cuda_compile_generated_gpu_mat.cu.obj
我不知道这个“bin”来自哪里,也不知道该怎么做才能使它工作。谢谢您的回复!