1 Introduction
A lightweight deep learning framework, it seems to be used a lot in commercial projects, not much nonsense, let's see how to install it
2. Installation
The official website process should be very detailed, and the official website link should be given directly, and supplements ( ) should be given for some problematic places
算了,我还是写一下
. The platforms I useUbuntu 16.04
,CUDA
,CUDNN
,OPENCV
are already installed
Caffe2 official website
3. Install the dependency library first
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
libgoogle-glog-dev \
libgtest-dev \
libiomp-dev \
libleveldb-dev \
liblmdb-dev \
libopencv-dev \
libopenmpi-dev \
libsnappy-dev \
libprotobuf-dev \
openmpi-bin \
openmpi-doc \
protobuf-compiler \
python-dev \
python-pip
sudo pip install \
future \
numpy \
protobuf
4. Download the code
Since the domestic download is very slow, I will upload the downloaded code to CSDN, and the link will be attached.
# Clone Caffe2's source code from our Github repository
git clone --recursive https://github.com/pytorch/pytorch.git && cd pytorch
git submodule update --init
5. Compile
# 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
6. There is a problem when compiling
It means that the version of Eigen is too low
#error "Caffe2 requires Eigen to be at least 3.3.0.";
#error "Caffe2 requires Eigen to be at least 3.3.0.";
Solution:
1. First check your own Eigen
version :
cat /usr/include/eigen3/Eigen/src/Core/util/Macros.h | grep VERSION
Mine looks like this, the version is lower than 3.3.0
EIGEN_WORLD_VERSION 3
EIGEN_MAJOR_VERSION 2
EIGEN_MINOR_VERSION 92
2. Go to download the high version of Eigen
Download the latest
github
version, do not download the official website, the project has been migrated togithub
it.
If you can't get under the wall, click this CSDN
If it is on the official website, the following error may be reported, which should
cuda9
be supported by a higher version
usr/local/cuda-9.0/include/crt/common_functions.h:64:24: error: token ""__CUDACC_VER__ is no longer supported. Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
#define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported. Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
^
/usr/local/cuda-9.0/include/crt/common_functions.h:64:24: note: in definition of macro '__CUDACC_VER__'
#define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported. Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/cuda-9.0/include/crt/common_functions.h:64:24: error: token ""__CUDACC_VER__ is no longer supported. Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
#define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported. Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
^
/usr/local/cuda-9.0/include/crt/common_functions.h:64:24: note: in definition of macro '__CUDACC_VER__'
#define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported. Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
Then unzip and rename to
eigen3
3. Remove the old oneEigen
cd /usr/include
sudo rm -rf eigen3/
4. Move the downloaded file Eigen
to the original path
sudo mv path/of/eigen3 /usr/include/
5. Check the downloaded Eigen
version :
cat /usr/include/eigen3/Eigen/src/Core/util/Macros.h | grep VERSION
Mine looks like this:
EIGEN_WORLD_VERSION 3
EIGEN_MAJOR_VERSION 3
EIGEN_MINOR_VERSION 90
Then you can go back and recompile
sudo make install