今天F8开发者大会上,Facebook正式发布Caffe2.经过一天的折腾,终于在ubuntu14.04上成功配置caffe2,现将经验分享如下:

1.ubuntu14.04系统下caffe2所需依赖包安装,很多依赖包在安装caffe时已经安装,这个我们不需要管,安装过得依赖包会自动跳过:

sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
libgoogle-glog-dev \
libprotobuf-dev \
protobuf-compiler \
python-dev \
python-pip
sudo pip install numpy protobuf

2.GPU(可选择)

如果时caffe老用户,那么这一步自行跳过,安装命令如下:

2.1 CUDA安装

sudo apt-get update && sudo apt-get install wget -y --no-install-recommends
wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_8.0.61-1_amd64.deb"
sudo dpkg -i cuda-repo-ubuntu1404_8.0.61-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda

2.2  CUDNN安装

CUDNN_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-8.0-linux-x64-v5.1.tgz"
wget ${CUDNN_URL}
sudo tar -xzf cudnn-8.0-linux-x64-v5..tgz -C /usr/local
rm cudnn-8.0-linux-x64-v5..tgz && sudo ldconfig

3.可选择的依赖包(这个可以在后期需要时再安装)

sudo apt-get install -y --no-install-recommends \
libgtest-dev \
libiomp-dev \
libleveldb-dev \
liblmdb-dev \
libopencv-dev \
libopenmpi-dev \
libsnappy-dev \
openmpi-bin \
openmpi-doc \
python-pydot
sudo pip install \
flask \
graphviz \
hypothesis \
jupyter \
matplotlib \
pydot python-nvd3 \
pyyaml \
requests \
scikit-image \
scipy \
setuptools \
tornado
# for Ubuntu 14.04
sudo apt-get install -y --no-install-recommends libgflags2

4.clone&build

git clone --recursive https://github.com/caffe2/caffe2.git && cd caffe2
make && cd build && sudo make install
python -c 'from caffe2.python import core' >/dev/null && echo "Success" || echo "Failure"

之后,运行以下代码,验证GPU是否安装成功

python -m caffe2.python.operator_test.relu_op_test

在我运行之后出现如下报错:

Traceback (most recent call last):
File "/home/hzz/anaconda2/lib/python2.7/runpy.py", line , in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/home/hzz/anaconda2/lib/python2.7/runpy.py", line , in _run_code
exec code in run_globals
File "/home/hzz/caffe2/build/caffe2/python/operator_test/relu_op_test.py", line , in <module>
from hypothesis import given
ImportError: No module named hypothesis

针对提示错误,缺少hypothesis库,运行以下命令

pip install hypothesis

然后再次输入之前测试命令,运行成功,结果如下:

Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([[-0.86028236,  .        ,  0.61849821, -0.7184248 ,  0.89307433],
[ 0.92490983, . , 0.90946507, -0.37061477, -0.67617983],
[ 0.07383067, 0.55851477, 0.90312296, -0.94337231, 0.95312852],
[-0.50963259, 0.83218467, 0.86731863, 0.63752574, 0.0466823 ],
[ 0.87043667, -. , 0.66159999, 0.10338549, . ]], dtype=float32), gc=, dc=[, device_type: ], engine=u'')
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([ -2.72050470e-01, -1.68155816e-44, 1.22070059e-01], dtype=float32), gc=, dc=[, device_type: ], engine=u'')
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([[-0.27205047],
[-. ],
[ 0.81497574],
[ . ]], dtype=float32), gc=, dc=[, device_type: ], engine=u'')
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([ .], dtype=float32), gc=device_type: , dc=[, device_type: ], engine=u'CUDNN')
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([ 0.80068815, 0.1997007 , . , -0.46049505], dtype=float32), gc=, dc=[, device_type: ], engine=u'CUDNN')
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([ 0.73503637, -0.1312747 , -0.06368257], dtype=float32), gc=device_type: , dc=[, device_type: ], engine=u'CUDNN')
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([ .], dtype=float32), gc=, dc=[, device_type: ], engine=u'CUDNN')
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([-0.8335939 , -0.67032146], dtype=float32), gc=device_type: , dc=[, device_type: ], engine=u'CUDNN')
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([ 0.05724426, . ], dtype=float32), gc=device_type: , dc=[, device_type: ], engine=u'')
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([-0.66229254, 0.59582025, -0.85684592], dtype=float32), gc=device_type: , dc=[, device_type: ], engine=u'CUDNN')
.
----------------------------------------------------------------------
Ran test in .661s OK

5.环境变量设置

echo $PYTHONPATH
# export PYTHONPATH=/usr/local:$PYTHONPATH
# export PYTHONPATH=$PYTHONPATH:/home/hzz/caffe2/build
echo $LD_LIBRARY_PATH
# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

然后就可以开心的跑caffe2上自带的例子了。

ubuntu14.04_caffe2安装的更多相关文章

  1. Ubuntu14.04安装配置web/ftp/tftp/dns服务器

    目录: 1.安装ftp服务器vsftpd --基于tcp,需要帐号密码 2.安装tftp服务器tftpd-hpa,tftp-hpa --udp 3.web服务器--使用Apache2+Mysql+PH ...

  2. Ubuntu14.04安装intel集显驱动

    Ubuntu14.04安装intel集显驱动 标签(空格分隔): ubuntu linux 驱动安装 1.查看本机显卡型号 使用lspci命令来获取PCI接口硬件信息 o@o-pc:~$ lspci ...

  3. Ubuntu14.04安装中文输入法以及解决Gedit中文乱码问题

    1 设置中文显示环境 1. 打开System Settings 2. 打开Personal-> Language Support. 会弹出如下对话框,提示你“语言支持没安装完整”. 点击“Rem ...

  4. Ubuntu14.04安装配置ndnSIM

    Ubuntu14.04安装配置ndnSIM 预环境 Ubuntu14.04官方系统 请先使用sudo apt-get update更新一下源列表 安装步骤 安装boost-lib sudo apt-g ...

  5. Ubuntu14.04 安装QQ国际版wine-qqintl

    Ubuntu14.04安装qq国际版方式: 首先下载,链接为:  https://pan.baidu.com/s/1boPitVD 密码:jp1j 也可去Ubuntu中文的Kylin(优麒麟)官网下载 ...

  6. 在ubuntu14.14 安装php扩展扩展出现的问题

    我是在ubuntu14.14 安装的 lnmp. 部分扩展.均已安装好,但是我用apt-get 方式安装 redis和curl扩展时,我的配置都设置但是从phpinfo里面看没有响应的配置项. 于是我 ...

  7. 一.ubuntu14.04安装、亮度设置、显卡设置等一体化讲解

    一.ubuntu14.04安装 安装步骤很简单的,相信你只要知道并且决定安装ubuntu,你就不会在安装上有问题,下载网址 http://www.ithome.com/html/soft/81539. ...

  8. Ubuntu14.04安装samba

    Ubuntu14.04安装samba 按照惯例,首先介绍Samba.Samba是在Linux系统上实现的SMB(Server Messages Block,信息服务块)协议的一款免费软件.它实现在局域 ...

  9. Ubuntu14.04安装有道词典

    Ubuntu14.04安装有道词典之前要更新系统: sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade 在有道官网下载 ...

随机推荐

  1. TreeMap集合特点、排序原理

    TreeMap特点(类似于TreeSet): 1.无序,不允许重复(无序指元素顺序与添加顺序不一致) 2.TreeMap集合默认会对键进行排序,所以键必须实现自然排序和定制排序中的一种 3..底层使用 ...

  2. Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]

    linux中的JDK为JDK8,tomcat为tomcat8 加入dubbo.war包 启动报错! Caused by: org.springframework.beans.factory.BeanC ...

  3. Web前端性能优化全攻略

    网页制作poluoluo文章简介:Web 前端性能优化是个大话题,是个值得运维人员持续跟踪的话题,是被很多网站无情忽视的技术. Web 前端性能优化是个大话题,是个值得运维人员持续跟踪的话题,是被很多 ...

  4. 使用SQL Server 发送邮件

    在很多数据分析和集成的场景下,我们需要了解数据库中关键的脚本或者job的执行情况.这个时候邮件提醒是一种比较不错的通知方式.本文从零开始,一步一步的介绍如何使用SQL Server来发送邮件. 环境: ...

  5. 备份Rhythmbox播放器的曲目和播放列表信息

    Rhythmbox音乐播放器只能保存单个播放列表,如果在rhythmbox下建了很多播放列表(比如按歌手名分类),每个播放列表下包含一些歌曲,为了避免重装系统后重新建这些播放列表,可以备份下面的文件. ...

  6. Angular JS从入门基础 mvc三层架构 常用指令

    Angular JS从入门基础  mvc模型 常用指令 ★ 最近一直在复习AngularJS,它是一款优秀的前端JS框架,已经被用于Google的多款产品当中.AngularJS有着诸多特性,最为核心 ...

  7. docker registry私有仓库部署

    私有仓库服务端:12.40[root@centos7_golang ~]# docker run -d -p 5000:5000 -v /opt/data/registry:/tmp/registry ...

  8. java源码学习(五)LinkedList

    LinkedList [TOC] 一.定义 public class LinkedList<E> extends AbstractSequentialList<E> imple ...

  9. TCP札记

    协议对于通信就像算法对于计算一样.算法允许人们在不必知道特定的CPU指令集的情况下指定或理解具体的计算形式.同样地,通信协议允许人们不依赖特定厂家的网络硬件来指定或理解数据通信. 网络协议通常分不同层 ...

  10. linux+tomcat+jdk环境验证码无法显示

    我的环境配置:RHEL6.5+tomcat6+jdk1.6 今天遇到一个奇怪的现象,我的tomcat启动起来之后,网站无法显示验证码,导致无法登陆.我的tomcat启动过程是这样的: 我有一个进程守护 ...