当前位置: 首页 > news >正文

redhat配置caffe

参考网站:

http://caffe.berkeleyvision.org/install_yum.html(bvlc官网说明)

https://www.zybuluo.com/hanxiaoyang/note/364680

http://blog.sina.com.cn/s/blog_990865340102vewt.html (主要参考)

http://stackoverflow.com/questions/31395729/how-to-enable-multithreading-with-caffe

(多核训练)

redhat配置caffe

1.安装依赖

  1. $ sudo yum install protobuf-devel   
  2. $ sudo yum install level-devel   
  3. $ sudo yum install snappy-devel   
  4. $ sudo yum install opencv-devel   
  5. $ sudo yum install boost-devel   
  6. $ sudo yum install hdf5-devel   
  7. $ sudo yum install atlas-devel   
  8.  
  9. $ sudo yum install gflags-devel   
  10. $ sudo yum install glog-devel   
  11. $ sudo yum install lmdb-devel   

某些源可能找不到

可以先安装以下命令

  1. $ sudo yum install epel-release

其中glog仍然找不到,则需要进行手动安装

  1. # glog
  2. wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/google-glog/glog-0.3.3.tar.gz
  3. tar zxvf glog-0.3.3.tar.gz
  4. cd glog-0.3.3
  5. ./configure
  6. make && make install

2.安装opecv-2.4.13

redhat配置opencv

3.编译配置boost_1_59_0

  1. Tar –zxvf boost_1_59_0.tar.gz
  2. cd boost boost_1_59_0
  3. ./boostrap.sh
  4. ./b2
  5. sudo ./b2 install –prefix=/usr/local/boost_hy

配置参数

/usr/local/include

/usr/local/lib

可以将配置文件写到

  1. echo "/usr/local/lib" >> /etc/ld.so.conf
  2. ldconfig

3.下载源码

  1. $ git clone https://github.com/bvlc/caffe.git
  2. $ cd caffe/
  3. $ mv Makefile.config.example Makefile.config

4.修改Makefile.config

CPU_ONLY := 1

 

BLAS := atlas

BLAS_INCLUDE := /usr/include/atlas

BLAS_LIB := /usr/lib64/atlas

 

BOOST_ROOT := /usr/local/boost_hy

 

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/boost_hy/include

LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib64 /usr/local/boost_hy/lib

5.编译

  1. make all

问题1:

./include/caffe/util/io.hpp: In function 'void caffe::MakeTempDir(std::string_)':

./include/caffe/util/io.hpp:27: error: 'temp_directory_path' is not a member of 'boost::filesystem'

./include/caffe/util/io.hpp:29: error: 'unique_path' is not a member of 'boost::filesystem'

应该是boost版本问题,要1.59.0以上的。但说明是1.54以上版本就行。

明明装了1.59版本的boost还是不行。

  1. rpm –qa boost*

发现许多包还是1.41版本的,可能是系统依赖的包。因此,重新安装boost,指定安装路径,如果不指定的话,lib会放在 /usr/local/lib, include会放在/usr/local/include

  1. ./b2 install –prefix=/usr/local/boost_hy

Boost_hy下回出现includelib

caffe目录下Makefile.config中添加如下配置:

BOOST_BOOT:=/usr/local/boost_hy

INCLUDE_DIRS:=/usr/local/boost_hy/include

LIB_DIRS:=/usr/local/boost_hy/lib

https://groups.google.com/forum/#!topic/caffe-users/h_hXnUbrurk

https://github.com/BVLC/caffe/issues/3686

问题2

使用命令

  1. sudo make all

时,出现以下问题:

.build_release/src/caffe/proto/caffe.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
.build_release/src/caffe/proto/caffe.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
.build_release/src/caffe/proto/caffe.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.

/usr/bin/protoc –version发现是1.4.*版本的。而至少需要1.5版本的。

如果不用sudo的话,可能用到的是本目录下的protoc

  1. make all //不要用sudo执行

问题3

/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for –lc

This typically arises due to an architecture mismatch - in this case it seems that the build system attempts to link a 64bit object files with a 32bit library

问题是64为系统编译,却到32位的lib包中去寻找,解决:

更改caffe目录下Makelist.config

将所有的/usr/lib都改为/usr/lib64

  1. make clean
  2. make all

终于编译成功,截图如下:

 

6. 训练mnist

问题:

[wuhairong@zhsw-ws02 caffe-master]$ make runtest .build_release/tools/caffe ERROR: flag 'tab_completion_word' was defined more than once (in files 'src/gflags_completions.cc' and '/home/wuhairong/gflags-master/src/gflags_completions.cc').make: *** [runtest] 错误 1

https://groups.google.com/forum/#!msg/caffe-users/bqDam0xuT3E/78wQnx3memAJ

gflags安装了两次,要将gflags文件卸载之后再安装。利用yum命令即可。

  1. sudo yum remove gflags
  2. sudo yum install gflags

然后重新编译caffe

  1. make clean
  2. make all
  3. make test
  4. make runtest
  5. make matcaffe
  6. make pycaffe

开始训练

caffe目录下执行

  1. sh data/get_mnist.sh
  2. sh examples/mnist/create_mnist.h

注意:如果出现错误,可能是因为数据下载不正确。

  1. sh examples/mnist/train_lenet.sh

静候结果。。。

多核训练

http://stackoverflow.com/questions/31395729/how-to-enable-multithreading-with-caffe

转载于:https://www.cnblogs.com/yizhichun/p/6339695.html

相关文章:

  • CCF201312-1 出现次数最多的数(100分)
  • 如何在Flutter工程中添加Android AAR文件
  • Confluence-企业知识管理与协同软件安装步骤
  • Mac下关闭Sublime Text 3的更新检查
  • AngularJS实现跨域请求
  • 云计算学习(3-3)云计算的由来-应运而生
  • 1095. Cars on Campus (30)
  • Java之戳中痛点 - (1)易变业务使用脚本语言编写
  • CENTOS查看系统磁盘使用情况
  • PHP.ini配置文件(转载)
  • ie中存在的兼容问题及解决办法
  • Elasticstack 5.1.2 集群日志系统部署及实践
  • Roslyn如何实现简单的代码提示
  • 计划
  • msfconsole邮件收集器模块
  • 【Amaple教程】5. 插件
  • Apache Pulsar 2.1 重磅发布
  • Java到底能干嘛?
  • js学习笔记
  • Puppeteer:浏览器控制器
  • Terraform入门 - 3. 变更基础设施
  • vue从入门到进阶:计算属性computed与侦听器watch(三)
  • 等保2.0 | 几维安全发布等保检测、等保加固专版 加速企业等保合规
  • 给第三方使用接口的 URL 签名实现
  • 机器学习中为什么要做归一化normalization
  • 全栈开发——Linux
  • 视频flv转mp4最快的几种方法(就是不用格式工厂)
  • 学习Vue.js的五个小例子
  • 一起来学SpringBoot | 第三篇:SpringBoot日志配置
  • # 达梦数据库知识点
  • #LLM入门|Prompt#2.3_对查询任务进行分类|意图分析_Classification
  • #图像处理
  • #周末课堂# 【Linux + JVM + Mysql高级性能优化班】(火热报名中~~~)
  • (33)STM32——485实验笔记
  • (附源码)计算机毕业设计SSM在线影视购票系统
  • (区间dp) (经典例题) 石子合并
  • (全部习题答案)研究生英语读写教程基础级教师用书PDF|| 研究生英语读写教程提高级教师用书PDF
  • (十五)devops持续集成开发——jenkins流水线构建策略配置及触发器的使用
  • (算法)N皇后问题
  • (原創) 未来三学期想要修的课 (日記)
  • (转)自己动手搭建Nginx+memcache+xdebug+php运行环境绿色版 For windows版
  • .net Application的目录
  • .NET BackgroundWorker
  • .net 微服务 服务保护 自动重试 Polly
  • .net(C#)中String.Format如何使用
  • .NetCore Flurl.Http 升级到4.0后 https 无法建立SSL连接
  • [.NET]桃源网络硬盘 v7.4
  • [2019/05/17]解决springboot测试List接口时JSON传参异常
  • [AIGC 大数据基础]hive浅谈
  • [Bzoj4722]由乃(线段树好题)(倍增处理模数小快速幂)
  • [CSS]盒子模型
  • [IM] [Webhook] Webhook实现IM平台机器人
  • [JavaWeb]——获取请求参数的方式(全面!!!)
  • [leveldb] 2.open操作介绍
  • [Socket]Unix socket 运行权限问题