Skip to content

Instantly share code, notes, and snippets.

@ravi9
Last active August 31, 2017 22:27
Show Gist options
  • Save ravi9/d5fbb78a80f75f26224942778387537f to your computer and use it in GitHub Desktop.
Save ravi9/d5fbb78a80f75f26224942778387537f to your computer and use it in GitHub Desktop.
Install script for installing Intel-Caffe on RHEL 7.x
#This script is tested on AWS instance RHEL - Red Hat Enterprise Linux (RHEL) 7 (HVM) https://aws.amazon.com/marketplace/pp/B00KWBZVK6
#This installs Intel Caffe with python dependencies.
#This script is suited for SSD example. Uncomment Line#49 for general use. See https://github.com/intel/caffe/issues/65
sudo yum group install -y "Development Tools"
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
sudo yum -y install python-devel python-pip tkinter gtk2-2.24.28-8.el7.x86_64 gtk2-devel
sudo yum -y install wget cmake git &&
sudo yum -y install boost-devel &&
sudo yum -y install gflags-devel glog-devel lmdb-devel leveldb-devel hdf5-devel
#INSTALL SNAPPY
sudo yum -y install http://mirror.centos.org/centos/7/os/x86_64/Packages/snappy-devel-1.1.0-3.el7.x86_64.rpm
#INSTALL ATLAS
sudo yum -y install http://mirror.centos.org/centos/7/os/x86_64/Packages/atlas-devel-3.10.1-10.el7.x86_64.rpm
#INSTALL OPENCV
wget https://github.com/Itseez/opencv/archive/2.4.13.zip
unzip 2.4.13.zip
cd opencv-2.4.13/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..
make all -j$(nproc)
sudo make install -j$(nproc)
#INSTALL PROTOBUF
wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar -xzvf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1
./configure
make -j$(nproc)
sudo make install
#DONWLOAD AND BUILD INTELCAFFE
cd
git clone https://github.com/intel/caffe intelcaffe
cd intelcaffe
echo "export CAFFE_ROOT=`pwd`" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
source ~/.bashrc
cp Makefile.config.example Makefile.config
#EDIT Makefile.config
#commenting the flag USE_MKL2017_AS_DEFAULT_ENGINE for SSD only. See https://github.com/intel/caffe/issues/65
sed -i 's@USE_MKL2017_AS_DEFAULT_ENGINE@# USE_MKL2017_AS_DEFAULT_ENGINE@g' Makefile.config
#Add additional include dir for building Python dependencies.
sed -i '/^PYTHON_INCLUDE :/a \/usr\/lib64\/python2.7\/site-packages\/numpy\/core\/include \\' Makefile.config
make all -j$(nproc)
#Test SSD
./build/tools/caffe time -model models/intel_optimized_models/ssd/VGGNet/VOC0712/SSD_300x300/deploy.prototxt
#INSTALL PYTHON DEPENDICIES
cd $CAFFE_ROOT/python
sudo yum -y install python-devel
sudo yum -y install python-pip
sudo pip install --upgrade pip
for req in $(cat requirements.txt); do sudo -E pip install $req; done
sudo pip install scikit-image
cd $CAFFE_ROOT
make pycaffe
echo "export PYTHONPATH=$CAFFE_ROOT/python" >> ~/.bashrc
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment