您的位置:首页 > Web前端

编译gpu版caffe遇到的问题

2017-07-09 22:43 573 查看
1、.build_release/lib/libcaffe.so:对‘gflags::ParseCommandLineFlags(int*, char***, bool)’未定义的引用

解决:

这里继续安装gflags: https://github.com/schuhschuh/gflags/archive/master.zip下载。解压
cd gflags-master
mkdir build && cd build
export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1
make
sudo make install
2、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).
解决:原因是,Makefile中采用了CUDA的compute capability 2.0和2.1,这是两种计算能力。安装的CUDA版本是8.0,但 从CUDA 8.0开始compute capability 2.0和2.1被弃用了,所以可以将Makefile.config中的-gencode arch=compute_20,code=sm_20 和-gencode arch=compute_20,code=sm_21这两行删除即可。

3、/usr/bin/ld: 找不到 -lopenblas

解决:

首先查看是否安装libopenblas-base 和libopenblas-dev,如果未安装,则命令sudo apt-get install libopenblas-base libopenblas-dev后再次编译,仍有错误查看以下解决方式。

I faced the same problem. Even adding library directory "/opt/OpenBLAS/lib/" to ldconfig cache didn't help (as my libopenblas.so is at "/opt/OpenBLAS/lib/libopenblas.so").

Using cmake helped me. Try this from caffe root directory:

mkdir buildcd buildcmake -DBLAS=open ..make allmake runtest


If you need to use make, add the symlink of libopenblas.so to /usr/lib. I did the following:

ln -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib/libopenblas.so


解决网址:https://stackoverflow.com/questions/32353509/usr-bin-ld-cannot-find-lopenblas-error-in-caffe-compilation


4、test_data_transformer.cpp(.text._ZN5caffe11MakeTempDirEPSs[_ZN5caffe11MakeTempDirEPSs]+0x4a):‘boost::filesystem::detail::temp_directory_path(boost::system::error_code*)’未定义的引用。


解决:按照赵永科《21天实战caffe》第38页安装Boost,如果安装完成后还是出现此类信息,查看caffe目录下Makefile文件里LIBRARIES内容的正确与否,楼主在调试前面的bug时错误把这里改动了,不能缺少boost-system和boost-filesystem。如下:


原来的:#LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5

现在的:LIBRARIES += glog gflags protobuf leveldb snappy lmdb
boost_system boost_filesystem hdf5_hl hdf5 m opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs openblas


5、.build_release/tools/caffe: error while loading shared libraries: libopenblas.so.0: cannot open shared object file: No such file or directory

make: *** [runtest] 错误 127


解决:sudo apt-get install libopenblas-dev
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: