Skip to content

Instantly share code, notes, and snippets.

@1duo
Last active August 9, 2018 08:10
Show Gist options
  • Save 1duo/02314e075d11546e697e8ac59caac0fe to your computer and use it in GitHub Desktop.
Save 1duo/02314e075d11546e697e8ac59caac0fe to your computer and use it in GitHub Desktop.
Install Caffe2 on CentOS 7 with GPU support.
  • Assume NVIDIA Driver and CUDA Properly Installed, to Validate:
nvidia-smi
nvcc --version
  • Install Global Dependencies
yum install -y \
    protobuf-devel \
    leveldb-devel \
    snappy-devel \
    opencv-devel \
    boost-devel \
    hdf5-devel \
    gflags-devel \
    glog-devel \
    lmdb-devel \
    cmake 
tar -xzvf cudnn-7.0-linux-x64-v4.0-prod.tgz
cp cuda/lib64/* /usr/local/cuda/lib64/
cp cuda/include/cudnn.h /usr/local/cuda/include/
# NCCL version 1.3.4
git clone https://github.com/NVIDIA/nccl.git && cd nccl
make -j$(nproc) install && cd .. && rm -rf nccl
  • Install Python Dependencies
pip install \
      flask \
      future \
      graphviz \
      hypothesis \
      jupyter \
      matplotlib \
      pydot python-nvd3 \
      pyyaml \
      requests \
      scikit-image \
      scipy \
      setuptools \
      six \
      tornado \
      protobuf
git clone --recursive https://github.com/caffe2/caffe2.git
cd caffe2 && make -j$(nproc)
cd build && make -j$(nproc) install
  • Set Environment Variables
echo $PYTHONPATH
# export PYTHONPATH=/usr/local:$PYTHONPATH
# export PYTHONPATH=$PYTHONPATH:/home/centos/caffe2/build
echo $LD_LIBRARY_PATH
# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  • Validate Installtion
python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment