问题
OS: ubuntu 16.04 CUDA: 7.5 Cudnn: 5
I am following this tutorial for installing caffe with gpu. In here, I wanted an installation of opencv 3.1. But the compilation of opencv is giving error when CUDA is already installed in the system.
The error I get on trying to make
opencv 3.1 is :
/usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
return (char *) memcpy (__dest, __src, __n) + __n;
^
CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:266 (message):
Error generating file
/home/cortana/Downloads/opencv-3.1.0/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o
modules/core/CMakeFiles/opencv_core.dir/build.make:63: recipe for target 'modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o' failed
make[2]: *** [modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o] Error 1
CMakeFiles/Makefile2:1505: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I have tried changing CMakeLists.txt of opencv 3.1 by adding the line set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES")
to it. Also, I checked the suggestion for changing the /usr/include/string.h
provided here. But I already have the updated version of the file.
I am unable to build opencv 3.1 and hence, Caffe.
回答1:
Try with CUDA 8. It worked for me with GeForce GTX 960M on Ubuntu 16.04
来源:https://stackoverflow.com/questions/39364802/having-difficulties-installing-caffe-in-ubuntu-16-04