您的位置:首页 > Web前端

Ubuntu titanx CUDA8.0+cudnn5.1+Caffe 安装与遇到的报错

2017-07-12 19:35 375 查看
一、CUDA8.0+CUDNN.5.1
http://www.2cto.com/kf/201610/552429.html
二、anaconda安装
http://www.linuxidc.com/Linux/2016-07/132860.htm
三、参考 (CPU)http://blog.csdn.net/qq_36620489/article/details/73658151

问题汇总:

1、anaconda2/bin/../lib/libstdc++.so.6: version
`GLIBCXX_3.4.20' not found

修复

conda
install
libgcc

ImportError: No module named google.protobuf.internal

修复:

    

方法:  安装protobuf最新版本
查看:
 sudo protoc --version             libprotoc 2.6.1

 protoc --version                      libprotoc 2.6.1

命令:     ~/anaconda2/bin$ 
   pip install protobuf

2、fatal error: caffe/proto/caffe.pb.h:
bf88
No suchfileordirectory

#include "caffe/proto/caffe.pb.h"

修复:

       1)用protoc从caffe/src/caffe/proto/caffe.proto生成caffe.pb.h和caffe.pb.cc

mark@mark-Default-string-Invalid-entry-length-16-Fixed-up-to-11:~/caffe/src/caffe/proto$ protoc --cpp_out=/home/mark/caffe/include/caffe/ caffe.proto

        2)) 在caffe/include/caffe目录下新建文件夹,命名为proto,然后把编译出来的caffe.pb.h和caffe.pb.cc放进去,之后,错误消失。

3、Check failed: error == cudaSuccess (8 vs. 0) invalid device function

该错误是由于GPU的运算能力的不匹配所导致的,在makefile。config里改

# CUDA architecture setting: going with all of them.

CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \

        -gencode arch=compute_20,code=sm_21 \

        -gencode arch=compute_30,code=sm_30 \

        -gencode arch=compute_35,code=sm_35 \

         -gencode arch=compute_50,code=sm_50

1.make all -j16  编译时候出现 

make: * [.build_release/examples/siamese/convert_mnist_siamese_data.bin] Error 1 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference to TIFFReadDirectory@LIBTIFF_4.0' 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference toTIFFWriteEncodedStrip@LIBTIFF_4.0’ 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference to TIFFIsTiled@LIBTIFF_4.0' 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference toTIFFOpen@LIBTIFF_4.0’ 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference to TIFFReadEncodedStrip@LIBTIFF_4.0' 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference toTIFFSetField@LIBTIFF_4.0’ 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference to TIFFWriteScanline@LIBTIFF_4.0' 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference toTIFFGetField@LIBTIFF_4.0’ 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference to TIFFScanlineSize@LIBTIFF_4.0' 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference toTIFFNumberOfStrips@LIBTIFF_4.0’ 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference to TIFFSetWarningHandler@LIBTIFF_4.0' 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference toTIFFSetErrorHandler@LIBTIFF_4.0’ 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference to TIFFReadEncodedTile@LIBTIFF_4.0' 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference toTIFFReadRGBATile@LIBTIFF_4.0’ 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference to TIFFClose@LIBTIFF_4.0' 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference toTIFFRGBAImageOK@LIBTIFF_4.0’ 

/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.0’ 

collect2: error: ld returned 1 exit status 

解决方案:

sudo make all -j16; 

sudo make test -j16

2、sudo make runtest

.build_release/tools/caffe

.build_release/tools/caffe: error while loading shared libraries: libhdf5_hl.so.10: cannot open shared object file: No such file or directory

Makefile:532: recipe for target 'runtest' failed

make: *** [runtest] Error 127

解决方案:
将 anaconda lib 的路径添加到环境变量 LD_LIBRARY_PATH中,具体命令为:

    1). export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{anaconda_dir}/lib

    2). source ~/.bashrc

3、

AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0-rc3
/usr/bin/ld: cannot find -lhdf5_hl
/usr/bin/ld: cannot find -lhdf5
collect2: error: ld returned 1 exit status
Makefile:566: recipe for target '.build_release/lib/libcaffe.so.1.0.0-rc3' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0-rc3] Error 1 

解决方案:

将  makefile 的       

        LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

改成:

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial

sudo make all -j16

sudo make test -j16

会出现警告(nvcc warning : The 'compute_20', 'sm_20',
and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).)

make runtest

运行结果:成功!

sudo make pycaffe

添加    $ sudo gedit ~/.bashrc

export PYTHONPATH=”/home/name/caffe/python:$PYTHONPATH” 

之后编译链接库,打开ipython/python,输入:

$ import caffe


即可调用caffe相应模块了。matlab模块可以直接测试caffe/matlab/+caffe的用例。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐