installing Tensorflow on Ubuntu 16.04 with GPU support It will take about two hours just before "$ bazel build ...". Bazel building will take about one or two hours.
- BIOS setting: diable Secure Boot, which contradicts with CUDA
- CUDA Toolkit 8.0
pre-installation actions can be skipped (for Ubuntu 16.04, Nvidia Geforce GTX 1080 Ti)
select to download "deb(local)" file and install by Package Manager (since runfile is difficult to install) (proxy_server of aptitude and wget needs not be worried about)
And, install the patch from CUDA download page if exists: ex: sudo dpkg -i /home/autosem/Downloads/cuda-repo-ubuntu1604-8-0-local-cublas-performance-update_8.0.61-1_amd64.deb sudo apt-get update sudo apt-get install cuda (<== maybe this line is not necessary)
post-installation actions cuda environment variables is also to be contained in .bashrc see below
cuda samples are copied in ~/cuda/
I didn't install driver: so driver is not verified
to test: try to compile the cuda samples copied as above error for cudaDecodeGL for some library problem -> ignore
$ ~/cuda/NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release/deviceQuery check it shows GTX 1080 Ti and Result = PASS $ ~/cuda/NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release/bandwidthTest check it shows Result = PASS
- Nvidia driver may have been installed during installing CUDA Toolkit
- cuDNN v5.1 Or v6.0 (cf. tried v7.0.1, with error during bazel building)
You have to sign up as an Nvidia developer
from https://developer.nvidia.com/cudnn
download "cuDNN vX.X Library for Linux" (for compatible CUDA version) move and extract as eg. ~/cuda/cuDNNLib/cuda/
Or
download "cuDNN vX.X Runtime Library for Ubuntu 16.04 (Deb), cuDNN vX.X Developer Library for Ubuntu 16.04 (Deb), cuDNN vX.X Code Samples and User Guide for Ubuntu 16.04 (Deb)"
$ sudo dpkg -i ./Downloads/libcudnn6_6.0.21-1+cuda8.0_amd64.deb $ sudo dpkg -i ./Downloads/libcudnn6-dev_6.0.21-1+cuda8.0_amd64.deb $ sudo dpkg -i ./Downloads/libcudnn6-doc_6.0.21-1+cuda8.0_amd64.deb libcudnn.so and etc. will be found in /usr/lib/x86_64-linux-gnu/
set environment variables as in .bashrc (or .profile) export CUDA_HOME="/usr/local/cuda-8.0" export LD_LIBRARY_PATH="$HOME/cuda/cuDNNLib/cuda/lib64:$HOME/cuda/cuDNNLib/cuda:${CUDA_HOME}/lib64" (Or for the case of installing Runtime, Developer Library: export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:${CUDA_HOME}/lib64") export PATH="/usr/local/cuda-8.0/bin:$HOME/bin:$HOME/.local/bin:$PATH"
"Add to your build and link process by adding -I to your compile line and -L -lcudnn to your link line." => how ???
- $ sudo apt-get install libcupti-dev
- install Tensorflow from sources
prepare install git, curl, bazel, pip3, numpy and etc. (python3 (for python3.5) is already installed in Ubuntu 16.04)
$ sudo apt-get install git $ sudo apt-get install curl
$ sudo apt-get install openjdk-8-jdk $ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list $ curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - $ sudo apt-get update && sudo apt-get install bazel $ sudo apt-get upgrade bazel
$ sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel
download tensorflow directory $ git clone https://github.com/tensorflow/tensorflow
configure: $ cd ~/tensorflow $ ./configure select default except select python3.5 enable CUDA: y cuDNN lib version is 5.1.10 (Or 6.0.21) cuDNN lib directory is /home/soh/cuda/cuDNNLib/cuda (Or /usr/lib/x86_64-linux-gnu) compute capability is 6.1
build the pip package with bazel for gcc 5, append --cxxopt... $ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
install pip package $ ls /tmp/tensorflow_pkg/ $ sudo pip3 install /tmp/tensorflow_pkg/tensorflow-1.2.0-cp35-cp35m-linux_x86_64.whl
test $ cd $ mkdir tf $ cd tf $ python3 /* to test 4-line program */
------- history ------- sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb sudo apt-get update sudo apt-get install cuda vi .bashrc /* insert as follow export CUDA_HOME="/usr/local/cuda-8.0" export LD_LIBRARY_PATH="$HOME/cuda/cuDNNLib/cuda/lib64:$HOME/cuda/cuDNNLib/cuda:${CUDA_HOME}/lib64" export PATH="/usr/local/cuda-8.0/bin:$HOME/bin:$HOME/.local/bin:$PATH" */
source .bashrc mkdir cuda cd cuda cuda-install-samples-8.0.sh . cd NVIDIA_CUDA-8.0_Samples/ make cd ~/cuda/NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release/deviceQuery ~/cuda/NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release/bandwidthTest cd cuda cp ../Downloads/cudnn-8.0-linux-x64-v5.1.tgz . tar xvzf cudnn-8.0-linux-x64-v5.1.tgz mkdir cuDNNLib mv cuda cuDNNLib/ mv cudnn-8.0-linux-x64-v5.1.tgz ../Downloads/
sudo apt install git sudo apt install curl git clone https://github.com/tensorflow/tensorflow echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - sudo apt-get update && sudo apt-get install bazel sudo apt-get upgrade bazel sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel
ls /* tensorflow repository is in directory tensorflow now */ cd tensorflow ./configure gcc --version /* and then I found it is 5.0 or newer */ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_ package --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg ls /tmp/tensorflow_pkg/ sudo pip3 install /tmp/tensorflow_pkg/tensorflow-1.2.0-cp35-cp35m-linux_x86_64.whl cd mkdir tf cd tf python3 /* to test 4-line program */ |