1 .安装cuda8.0及对应cudnn
2.编译cuda 例子失败
解决:
在cuda8.0/Samples/3_Imaging/cudaDecodeGL/findgllib.mk 中把61行
UBUNTU_PKG_NAME = "nvidia-384"改为本机驱动版本
查看nvidia版本命令如下:
cat /proc/driver/nvidia/version
3.caffe编译过程中的错误
cblas.h报错
./include/caffe/util/mkl_alternate.hpp:14:19: fatal error: cblas.h: 没有那个文件或目录
解决:
由于我的Makefile.config文件中BLAS为atlas.
在终端输入:
sudo make clean
sudo apt-get install libatlas-base-dev
重新进行编译就好了。
hdf5.h报错
src/caffe/layers/hdf5_data_layer.cu:10:18: fatal error: hdf5.h: 没有那个文件或目录
解决:
修改Makefile.config文件以下两行:
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/
libcaffe.so.1.0.0报错
/usr/bin/ld: 找不到 -lopenblas
collect2: error: ld returned 1 exit status
Makefile:583: recipe for target ‘.build_release/lib/libcaffe.so.1.0.0’ failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
解决:
在Makefile.config中把BLAS := oepn改为 BLAS := atlas
Makefile:554: recipe for target ‘.build_release/lib/libcaffe.so.1.0.0-rc3’ failed
修改Makefile 文件
将183行
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
改为
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
2.matcaffe配置过程中的错误
libstdc++.so.6报错
运行make mattest时可能会碰到下面这个错误:
MEX-file ‘/home/zzh/caffe/matlab/+caffe/private/caffe_.mexa64’ 无效:
/usr/local/MATLAB/R2016b/bin/glnxa64/…/…/sys/os/glnxa64/libstdc++.so.6:
version `GLIBCXX_3.4.21’ not found (required by
/home/zzh/caffe/matlab/+caffe/private/caffe_.mexa64)
解决:
将matlab的libstdc++.so.6链接到系统的库文件。
sudo rm /usr/local/MATLAB/R2016b/sys/os/glnxa64/libstdc++.so.6
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/local/MATLAB/R2016a/sys/os/glnxa64/libstdc++.so.6
mode_cpu报错
Error in caffe.set_mode_cpu (line 5)
caffe_(‘set_mode_cpu’);
Error in caffe.run_tests (line 6)
caffe.set_mode_cpu();
解决:
在当前终端输入如下内容:
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:/usr/local/cuda-7.5/lib64
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4:/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4:/usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libfreetype.so.6
在caffe目录下的Makefile中
在CXXFLAGS += -MMP -MP下面加 (426行)
CXXFLAGS += -std=c++11