Ubuntu 16.04 安装 caffe2

ubuntu16.04安装caffe2有四种方式,在这里我选择的使用源码安装

1:首先安装依赖环境

 sudo apt-get update

sudo apt-get install -y --no-install-recommends \

build-essential \

cmake \

git \

libgoogle-glog-dev \

libgtest-dev \

libiomp-dev \ l

ibleveldb-dev \

liblmdb-dev \

libopencv-dev \

libopenmpi-dev \

libsnappy-dev \

libprotobuf-dev \

openmpi-bin \

openmpi-doc \

protobuf-compiler \

python-dev \

python-pip

pip install --user \ future \ numpy \ protobuf

2:安装libgflags-dev(至于Ubuntu14.04对应的是libgflags2)

sudo apt-get install -y --no-install-recommends libgflags-dev

3:安装NVIDIA驱动

rboot

4:安装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

 

5:安装cudnn

       注:官方文档默认安装的是5.1版本,后续会报错要求升级,此处我安装的是7版本

首先去官网下载安装包(https://developer.nvidia.com/rdp/cudnn-download)

  1. sudo dpkg -i libcudnn7_7.0.3.11-1+cuda9.0_amd64.deb
  2. sudo dpkg -i libcudnn7-dev_7.0.3.11-1+cuda9.0_amd64.deb
  3. sudo dpkg -i libcudnn7-doc_7.0.3.11-1+cuda9.0_amd64.deb
然后验证安装是否成功


 

  1. $cp -r /usr/src/cudnn_samples_v7/ $HOME
  2. $ cd  $HOME/cudnn_samples_v7/mnistCUDNN
  3. $make clean && make
  4. $ ./mnistCUDNN

Text passed!

6:安装caffe2

# Clone Caffe2's source code from our Github repository

git clone --recursive https://github.com/pytorch/pytorch.git && cd pytorch

git submodule update --init

# Create a directory to put Caffe2's build files in

mkdir build && cd build

# Configure Caffe2's build

# This looks for packages on your machine and figures out which functionality

# to include in the Caffe2 installation. The output of this command is very

# useful in debugging.

cmake ..

# Compile, link, and install Caffe2

sudo make install

rboot(不重启的话检验时将会失败)

检验:

cd ~ && python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"

python caffe2/python/operator_test/activation_ops_test.py

 

 

你可能感兴趣的:(Ubuntu 16.04 安装 caffe2)