安装OpenCV时遇到问题:nvcc fatal : Unsupported gpu architecture 'compute_30' ,bug如下:
[ 19%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o
nvcc fatal : Unsupported gpu architecture 'compute_30'
CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.Release.cmake:220 (message):
Error generating
/home/yyx/packages/opencv-4.1.0/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:77: modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4193: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
我找到文件cuda_compile_1_generated_gpu_mat.cu.o.Release.cmake ,里面设置NVCC_FLAGS的部分是这样的:
set(CUDA_NVCC_FLAGS -gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-D_FORCE_INLINES;-Xcompiler;-DCVAPI_EXPORTS;-Xcompiler;-fPIC;--std=c++11 ;; )
然后我把-gencode;arch=compute_30,code=sm_30;删掉了,重新make。
但是重新make还是报一样的错。
我又检查了cuda_compile_1_generated_gpu_mat.cu.o.Release.cmake文件,
发现重新make以后-gencode;arch=compute_30,code=sm_30;设置又回来了!恢复原状!
改也改不掉,我没办法了,各位有什么经验吗,谢谢大家