Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tensorflow 1.0 Ubuntu 16.04, Cuda 8.0, CuDNN 5.1

Official TensorFlow guide: https://www.tensorflow.org/install/install_sources#ConfigureInstallation

sudo apt-get install python-pip python-dev python-virtualenv python-pycurl libffi-dev libssl-dev build-essential gfortran libatlas-base-dev

# GPU-specific depenencies
sudo apt-get install libcupti-dev
# Bazel install
sudo apt-get install software-properties-common swig 
sudo add-apt-repository ppa:webupd8team/java 
sudo apt-get update 
sudo apt-get install oracle-java8-installer 
echo "deb http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list 
curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add - 
sudo apt-get update 
sudo apt-get install bazel

See the following for CUDA compute capabilities: https://developer.nvidia.com/cuda-gpus

vim ~/.bashrc
# In .bashrc
# NOTE: /usr/local/cuda is a manually created symlink to /usr/local/cuda-8.0
export TF_NEED_CUDA=1
export TF_CUDA_VERSION=8.0
export TF_CUDNN_VERSION=5.1.10
export CUDA_TOOLKIT_PATH=/usr/local/cuda
export CUDNN_INSTALL_PATH=/usr/local/cuda
export TF_CUDA_COMPUTE_CAPABILITIES=6.1
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/lib
# Load the environment variables
source ~/.bashrc

git clone https://github.com/tensorflow/tensorflow
cd tensorflow
git checkout r1.0

# Configue build
./configure 
Please specify the location of python. [Default is /home/ubuntu/venv/cmds/bin/python]: <ENTER>
Please specify optimization flags to use during compilation [Default is -march=native]: 
Do you wish to use jemalloc as the malloc implementation? (Linux only) [Y/n] <ENTER>
jemalloc enabled on Linux
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] <ENTER>
No Google Cloud Platform support will be enabled for TensorFlow
Do you wish to build TensorFlow with Hadoop File System support? [y/N] <ENTER>
No Hadoop File System support will be enabled for TensorFlow
Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N] <ENTER>
No XLA support will be enabled for TensorFlow
Found possible Python library paths:
  /home/ubuntu/venv/cmds/lib/python2.7/site-packages
Please input the desired Python library path to use.  Default is [/home/ubuntu/venv/cmds/lib/python2.7/site-packages]
<ENTER>
Using python library path: /home/ubuntu/venv/cmds/lib/python2.7/site-packages
Do you wish to build TensorFlow with OpenCL support? [y/N] <ENTER>
No OpenCL support will be enabled for TensorFlow
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: <ENTER>

# Now build, create the package and install
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/tensorflow-1.0.1-cp27-cp27mu-linux_x86_64.whl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.