编译Caffe时打开cudnn常见问题

运行时找不到cudnn库

caffe: error while loading shared libraries: libcudnn.so.5

解决办法

修改LD_LIBRARY_PATH

export LD_LIBRARY_PATH=(your path that contains libcudnn.so)

编译时inline函数出错

/usr/include/string.h: In functionvoid* __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; ^ /usr/include/string.h: In functionvoid* __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; ^ /usr/include/string.h: In functionvoid* __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; ^ /usr/include/string.h: In functionvoid* __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; ^ /usr/include/string.h: In functionvoid* __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; ^ /usr/include/string.h: In functionvoid* __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; ^ /usr/include/string.h: In functionvoid* __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_sgd_solver.cu.o.cmake:266 (message): Error generating file /opt/caffe/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_sgd_solver.cu.o

解决办法

Change the $(CXXFLAGS) and $(CFLAGS) in Makefile:

CXXFLAGS+= -D_FORCE_INLINES
CFLAGS+= -D_FORCE_INLINES

编译Python出错

fatal error: numpy/arrayobject.h: No such file or directory ; when 'make pycaffe' command given

解决办法

  1. 检查numpy是否正确安装 sudo apt-get install python-numpy
  2. 如果numpy已经安装,修改Makefile.config, 检查numpy库的安装Path是否一致,例如我的python numpy安装path要改为:
PYTHON_INCLUDE := /usr/include/python2.7 \
        /usr/local/lib/python2.7/dist-packages/numpy/core/include

你可能感兴趣的:(Machine,Learning)