CentOs7下,Caffe环境安装问题解决

准备在CentOS 7 下重新安装Caffe,centos7很不错,基本上官方文档里的:

sudo yum install protobuf-devel leveldb-devel snappy-devel opencv-devel boost-devel hdf5-devel
sudo yum install gflags-devel glog-devel lmdb-devel
可以顺利执行完成,接着根据文档:

BLAS: install ATLAS by sudo yum install atlas-devel or install OpenBLAS or MKL for better CPU performance. For the Makefile build, uncomment and set BLAS_LIB accordingly as ATLAS is usually installed under /usr/lib[64]/atlas).

安装atlas-devel。

开始编译~

make all 

报错:

[root@**** caffe]# make all 
CXX/LD -o .build_release/tools/convert_imageset.bin
/bin/ld: cannot find -lcblas
/bin/ld: cannot find -latlas
collect2: error: ld returned 1 exit status

查了一下,是程序在我们配置的lib目录里找不到atlas的so文件,比对了一下ld命令的查找方式和我们已安装的atlas:

ld -latlas --verbose

显示查找路径如下:

==================================================
attempt to open /usr/x86_64-redhat-linux/lib64/libatlas.so failed
attempt to open /usr/x86_64-redhat-linux/lib64/libatlas.a failed
attempt to open /usr/lib64/libatlas.so failed
attempt to open /usr/lib64/libatlas.a failed
attempt to open /usr/local/lib64/libatlas.so failed
attempt to open /usr/local/lib64/libatlas.a failed
attempt to open /lib64/libatlas.so failed
attempt to open /lib64/libatlas.a failed
attempt to open /usr/x86_64-redhat-linux/lib/libatlas.so failed
attempt to open /usr/x86_64-redhat-linux/lib/libatlas.a failed
attempt to open /usr/local/lib/libatlas.so failed
attempt to open /usr/local/lib/libatlas.a failed
attempt to open /lib/libatlas.so failed
attempt to open /lib/libatlas.a failed
attempt to open /usr/lib/libatlas.so failed
attempt to open /usr/lib/libatlas.a failed
ld: cannot find -latlas

我看了一下我们安装的atlas,在/usr/lib64/atlas/下,内有这些so:

[root@*** caffe]# ll /usr/lib64/atlas
total 21304
lrwxrwxrwx 1 root root       17 Apr  6 04:38 libsatlas.so -> libsatlas.so.3.10
lrwxrwxrwx 1 root root       17 Mar 14 22:24 libsatlas.so.3 -> libsatlas.so.3.10
-rwxr-xr-x 1 root root 10852104 Nov 20  2015 libsatlas.so.3.10
lrwxrwxrwx 1 root root       17 Apr  6 04:38 libtatlas.so -> libtatlas.so.3.10
lrwxrwxrwx 1 root root       17 Mar 14 22:24 libtatlas.so.3 -> libtatlas.so.3.10
-rwxr-xr-x 1 root root 10959464 Nov 20  2015 libtatlas.so.3.10


我们安装的atlas的so库只有libsatlas和libtatlas两种,与caffe要的完全不匹配。

查了一些材料(https://www.centos.org/forums/viewtopic.php?t=48543),这个提问里有提到这个现象,在centOS7下,库名已改,引入方式也要改变:

Names and content of atlas libraries have changed recently. Try

-L/usr/lib64/atlas -lsatlas or -L/usr/lib64/atlas -ltatlas

instead of

-lcblas.   


但我并不想去修改caffe源码,担心引起连锁问题,且报错中并没有提示具体发生问题的文件。


解决方案

改用openblas:

yum install  openblas-devel

MakeFile.config配置如下:

BLAS := open
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
#BLAS_INCLUDE := /usr/include/atlas
#BLAS_LIB := /usr/lib64/atlas

后续一切成功。 done。


建议Caffe对CentOS 7 下atlas引用失败的问题做修复。有空提个issue。

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值