Tensorflow with GPU
High level steps
1. Installation of CUDA Toolkit (9.0)
2. Installation of cuDNN v7.0
3. Installation of libcupti-dev library (7.5.18-0ubuntu1)
4. Installation of Tensorflow-GPU
http://docs.nvidia.com/cuda/cuda-installation-guide-linux/#axzz4VZnqTJ2A
[abasar@einext02 ~]$ lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GM107GL [Quadro K620] (rev a2)
01:00.1 Audio device: NVIDIA Corporation Device 0fbc (rev a1)
[abasar@einext02 ~]$
[abasar@einext02 ~]$ uname -m && cat /etc/*release
x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"
NAME="Ubuntu"
VERSION="16.04.4 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.4 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
[abasar@einext02 ~]$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[abasar@einext02 ~]$ uname -r
4.4.0-109-generic
[abasar@einext02 ~]$ sudo apt-get install linux-headers-$(uname -r)
[sudo] password for abasar:
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-headers-4.4.0-109-generic is already the newest version (4.4.0-109.132).
linux-headers-4.4.0-109-generic set to manually installed.
The following packages were automatically installed and are no longer required:
bbswitch-dkms cuda-command-line-tools-8-0 cuda-core-8-0 cuda-cublas-8-0 cuda-cublas-dev-8-0 cuda-cudart-8-0
cuda-cudart-dev-8-0 cuda-cufft-8-0 cuda-cufft-dev-8-0 cuda-curand-8-0 cuda-curand-dev-8-0 cuda-cusolver-8-0
cuda-cusolver-dev-8-0 cuda-cusparse-8-0 cuda-cusparse-dev-8-0 cuda-documentation-8-0 cuda-driver-dev-8-0 cuda-license-8-0
cuda-misc-headers-8-0 cuda-npp-8-0 cuda-npp-dev-8-0 cuda-nvgraph-8-0 cuda-nvgraph-dev-8-0 cuda-nvml-dev-8-0 cuda-nvrtc-8-0
cuda-nvrtc-dev-8-0 cuda-samples-8-0 cuda-toolkit-8-0 cuda-visual-tools-8-0 freeglut3 freeglut3-dev lib32gcc1 libc6-i386
libdrm-dev libgl1-mesa-dev libglu1-mesa-dev libice-dev libjansson4 libllvm4.0 libpthread-stubs0-dev libqmi-glib1 libsm-dev
libx11-dev libx11-doc libx11-xcb-dev libxau-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev
libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb1-dev libxdamage-dev
libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxmu-dev libxmu-headers libxnvctrl0 libxshmfence-dev libxt-dev
libxxf86vm-dev linux-headers-4.4.0-89 linux-headers-4.4.0-89-generic linux-headers-4.4.0-91 linux-headers-4.4.0-91-generic
linux-headers-4.4.0-92 linux-headers-4.4.0-92-generic linux-image-4.4.0-87-generic linux-image-4.4.0-89-generic
linux-image-4.4.0-91-generic linux-image-4.4.0-92-generic linux-image-extra-4.4.0-87-generic
linux-image-extra-4.4.0-89-generic linux-image-extra-4.4.0-91-generic linux-image-extra-4.4.0-92-generic
linux-signed-image-4.4.0-87-generic linux-signed-image-4.4.0-89-generic linux-signed-image-4.4.0-91-generic
linux-signed-image-4.4.0-92-generic mesa-common-dev screen-resolution-extra x11proto-core-dev x11proto-damage-dev
x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev
x11proto-xf86vidmode-dev xorg-sgml-doctools xserver-xorg-legacy xtrans-dev
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
Install the latest NVDIA driver
www.nvidia.com/drivers
[abasar@einext02 ~]$ chmod +x Downloads/NVIDIA-Linux-x86_64-390.48.run
[abasar@einext02 ~]$ sudo Downloads/NVIDIA-Linux-x86_64-390.48.run
[sudo] password for abasar:
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 390.48........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
$ sudo apt-key add 7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install cuda
Download CudaDNN from https://developer.nvidia.com/rdp/cudnn-download
$ sudo dpkg -i libcudnn7_7.1.2.21-1+cuda9.1_amd64.deb
$ sudo dpkg -i libcudnn7-dev_7.1.2.21-1+cuda9.1_amd64.deb
$ sudo dpkg -i libcudnn7-doc_7.1.2.21-1+cuda9.1_amd64.deb
$ sudo apt-cache search cuda-command-line-tool
cuda-command-line-tools-8-0 - CUDA command-line tools
cuda-command-line-tools-9-1 - CUDA command-line tools
$ sudo apt install cuda-command-line-tools-9-1
abasar@einext02:~/Downloads$ pip install --upgrade tensorflow-gpu
Collecting tensorflow-gpu
Downloading tensorflow_gpu-1.7.0-cp36-cp36m-manylinux1_x86_64.whl (256.2MB)
100% |████████████████████████████████| 256.2MB 7.2kB/s
Requirement already up-to-date: astor>=0.6.0 in /opt/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu)
Collecting protobuf>=3.4.0 (from tensorflow-gpu)
Downloading protobuf-3.5.2.post1-cp36-cp36m-manylinux1_x86_64.whl (6.4MB)
100% |████████████████████████████████| 6.4MB 301kB/s
Requirement already up-to-date: grpcio>=1.8.6 in /opt/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu)
Collecting tensorboard<1.8.0,>=1.7.0 (from tensorflow-gpu)
Downloading tensorboard-1.7.0-py3-none-any.whl (3.1MB)
100% |████████████████████████████████| 3.1MB 605kB/s
Requirement already up-to-date: six>=1.10.0 in /opt/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu)
Requirement already up-to-date: numpy>=1.13.3 in /opt/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu)
Requirement already up-to-date: termcolor>=1.1.0 in /opt/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu)
Collecting absl-py>=0.1.6 (from tensorflow-gpu)
Downloading absl-py-0.1.13.tar.gz (80kB)
100% |████████████████████████████████| 81kB 7.6MB/s
Requirement already up-to-date: wheel>=0.26 in /opt/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu)
Requirement already up-to-date: gast>=0.2.0 in /opt/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu)
Requirement already up-to-date: setuptools in /opt/anaconda3/lib/python3.6/site-packages (from protobuf>=3.4.0->tensorflow-gpu)
Requirement already up-to-date: markdown>=2.6.8 in /opt/anaconda3/lib/python3.6/site-packages (from tensorboard<1.8.0,>=1.7.0->tensorflow-gpu)
Requirement already up-to-date: html5lib==0.9999999 in /opt/anaconda3/lib/python3.6/site-packages (from tensorboard<1.8.0,>=1.7.0->tensorflow-gpu)
Requirement already up-to-date: werkzeug>=0.11.10 in /opt/anaconda3/lib/python3.6/site-packages (from tensorboard<1.8.0,>=1.7.0->tensorflow-gpu)
Requirement already up-to-date: bleach==1.5.0 in /opt/anaconda3/lib/python3.6/site-packages (from tensorboard<1.8.0,>=1.7.0->tensorflow-gpu)
Building wheels for collected packages: absl-py
Running setup.py bdist_wheel for absl-py ... done
Stored in directory: /home/abasar/.cache/pip/wheels/76/f7/0c/88796d7212af59bb2f496b12267e0605f205170781e9b86479
Successfully built absl-py
Installing collected packages: protobuf, tensorboard, absl-py, tensorflow-gpu
Found existing installation: protobuf 3.5.1
Uninstalling protobuf-3.5.1:
Successfully uninstalled protobuf-3.5.1
Found existing installation: tensorboard 1.6.0
Uninstalling tensorboard-1.6.0:
Successfully uninstalled tensorboard-1.6.0
Found existing installation: absl-py 0.1.10
Uninstalling absl-py-0.1.10:
Successfully uninstalled absl-py-0.1.10
Found existing installation: tensorflow-gpu 1.3.0
Uninstalling tensorflow-gpu-1.3.0:
Successfully uninstalled tensorflow-gpu-1.3.0
Successfully installed absl-py-0.1.13 protobuf-3.5.2.post1 tensorboard-1.7.0 tensorflow-gpu-1.7.0
[abasar@einext02 ~]$ nvidia-smi
Sat Mar 31 19:44:44 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 387.34 Driver Version: 387.34 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Quadro K620 Off | 00000000:01:00.0 Off | N/A |
| 34% 46C P8 1W / 30W | 223MiB / 2000MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1227 G /usr/lib/xorg/Xorg 148MiB |
| 0 18620 G ...-token=635AF995164F45D45C73AD20894A118B 70MiB |
+-----------------------------------------------------------------------------+