-
-
Save vitasiku/163394227a34c9114fca389f78d518ab to your computer and use it in GitHub Desktop.
Install CUDA Toolkit v8.0 and cuDNN v6.0 on Ubuntu 16.04
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
#!/bin/bash | |
# install CUDA Toolkit v8.0 | |
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network)) | |
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb" | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG} | |
sudo dpkg -i ${CUDA_REPO_PKG} | |
sudo apt-get update | |
sudo apt-get -y install cuda | |
# install cuDNN v6.0 | |
CUDNN_TAR_FILE="cudnn-8.0-linux-x64-v6.0.tgz" | |
wget http://developer.download.nvidia.com/compute/redist/cudnn/v6.0/${CUDNN_TAR_FILE} | |
tar -xzvf ${CUDNN_TAR_FILE} | |
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-8.0/include | |
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-8.0/lib64/ | |
sudo chmod a+r /usr/local/cuda-8.0/lib64/libcudnn* | |
# set environment variables | |
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}} | |
#export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | |
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | |
#To build | |
bazel clean | |
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package | |
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-msse4.1 --copt=-msse4.2 //tensorflow/tools/pip_package:build_pip_package | |
#To install | |
bazel-bin/tensorflow/tools/pip_package/build_pip_package ~/tensorflow_pkg | |
#Remove the ~/tensorflow_pkg | |
rm -rf ~/tensorflow_pkg/* | |
#Remove sudo if in a virtualenv | |
sudo pip3 install ~/tensorflow_pkg/tensorflow-0.12.1-cp27-cp27mu-linux_x86_64.whl | |
#Test installation | |
$ python # or python3 | |
>>> import tensorflow as tf | |
>>> sess = tf.Session() | |
#install to create virtualenvs in python3.6 | |
sudo apt install python3.6-venv | |
#Check this links | |
http://deeplearning.lipingyang.org/2017/01/18/install-gpu-tensorflow-ubuntu-16-04/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment