Created
November 8, 2018 07:33
-
-
Save BIGBALLON/c428cb75767d40e92be667ee20c4f0c1 to your computer and use it in GitHub Desktop.
caffe2 install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == remove & install cuda == | |
sudo apt-get update | |
sudo apt-get install vim screen htop curl -y | |
sudo apt-get purge cuda* -y | |
sudo apt-get autoremove -y | |
sudo apt-get autoclean -y | |
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run | |
sudo bash cuda_8.0.61_375.26_linux-run --silent --toolkit | |
# == install cudnn 7.1.4 == | |
curl -L -o libcudnn7-rt.deb "https://drive.google.com/uc?id=1THigUGayuc7TI8MlkPEz4zMoCMf1PtCK&export=download" | |
curl -L -o libcudnn7-dev.deb "https://drive.google.com/uc?id=1Fe2Pzwp07eVl7I_eU5j1uTarmTkKOy2m&export=download" | |
sudo dpkg -i libcudnn7-rt.deb | |
sudo dpkg -i libcudnn7-dev.deb | |
# == add path and check version == | |
echo 'export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}' >> ~/.bashrc | |
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc | |
source ~/.bashrc | |
nvcc --version | |
# cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2 | |
cat /usr/include/x86_64-linux-gnu/cudnn_v*.h | grep CUDNN_MAJOR -A 2 | |
# == install eigen3 == | |
sudo apt install libeigen3-dev -y | |
cd /tmp | |
wget http://bitbucket.org/eigen/eigen/get/3.3.5.zip | |
unzip 3.3.5.zip | |
mv eigen-eigen-b3f3d4950030/ eigen3 | |
cd /usr/include | |
sudo rm -rf eigen3/ | |
sudo mv /tmp/eigen3 /usr/include/ | |
cat /usr/include/eigen3/Eigen/src/Core/util/Macros.h | grep VERSION | |
# install caffe2 dependencies | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
build-essential \ | |
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 \ | |
python3-dev \ | |
python3-pip \ | |
libgflags-dev \ | |
python-setuptools \ | |
cmake | |
sudo pip3 install -U pip | |
sudo pip3 install setuptools | |
sudo pip3 install future \ | |
numpy \ | |
protobuf \ | |
typing \ | |
hypothesis \ | |
pyyaml | |
# == install pydot graphviz == | |
sudo apt install python-pydot python-pydot-ng graphviz -y | |
sudo pip3 install pydot | |
# == install caffe2 tag v0.4.0 == | |
git clone https://github.com/pytorch/pytorch && cd pytorch | |
git checkout v0.4.0 | |
git submodule update --init --recursive | |
mkdir build && cd build | |
cmake .. -DPYTHON_EXECUTABLE=/usr/bin/python3.5m \ | |
-DPYTHON_LIBRARY=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5m.so \ | |
-DPYTHON_INCLUDE_DIR=/usr/include/python3.5m | |
sudo make install -j | |
== export python path and LD_LIBRARY path == | |
echo 'export PYTHONPATH=/usr/local:$PYTHONPATH' >> ~/.bashrc | |
echo 'export PYTHONPATH=$PYTHONPATH:/home/cgilab/pytorch/build' >> ~/.bashrc | |
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc | |
# == success == | |
source ~/.bashrc | |
cd ~ && python3 -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure" | |
rm cuda_8.0.61_375.26_linux-run libcudnn7-dev.deb libcudnn7-rt.deb -f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment