A step by Step Guide to Install Tensorflow GPU on Ubuntu 18.04 LTS
Following guide explain step by step tensorflow-gpu installation on Ubuntu 18.04 LTS .
1.Install / check Nvidia driver
The first we should check is that we have an Nvidia driver installed for our graphics card. Our graphics card must support at least Nvidia compute 3.0 to install tensorflow-gpu.
check here the compute capability https://developer.nvidia.com/cuda-gpus
we can check what graphics driver we have installed with the
nvidia-smicommand. we should see some output like the following:
2.CUDA Toolkit 9.0
Once you’ve finished downloading that file, navigate to where the file was downloaded in your terminal.usually it ll be in your downloads directory.So navigate to the download directory and right click there and click open terminal.
In the terminal execute following two commands one by one
sudo chmod +x cuda_9.0.176_384.81_linux.run
Accept the terms and conditions, say
yes to installing with an unsupported configuration.and
no to “Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?”. Make sure you don’t agree to install the new driver.Follow the prompts to install the toolkit using the default install locations.
3.CUDA post-install actions
So Tensorflow can find our CUDA installation and use it properly, we need to add these lines to the end of you
first in our terminal type following command to open
Then add following paths at the end of the file
finally In order to activate the installation, we should source the
Now visit https://developer.nvidia.com/cudnn to get CUDNN 7.0. Go to the downloads archive page again and find version 7.0 for CUDA 9.0 that we just installed. Download the link that says “cuDNN v7.0.5 Library for Linux”. This will download an archive that we can unpack and move the contents the correct locations.
Once downloaded,we are going to unpack the archive and move it the contents into the directory where we installed CUDA 9.0:
execute following commands in terminal of the download directory
# Unpack the archive
tar -zxvf cudnn-9.0-linux-x64-v7.tgz
# Move the unpacked contents to your CUDA directory
sudo cp -P cuda/lib64/* /usr/local/cuda-9.0/lib64/
sudo cp cuda/include/* /usr/local/cuda-9.0/include/
# Give read access to all users
sudo chmod a+r /usr/local/cuda-9.0/include/cudnn.h
simply execute following command
sudo apt-get install libcupti-dev
The best way to install Anaconda is to download the latest Anaconda installer bash script, verify it, and then run it.
Download Anaconda Distribution for 1,000+ Python and R data science packages, a package, environment, and dependency…www.anaconda.com
Navigate download directory.Now we can run the script:
follow all prompts an install.Once it’s complete we’ll receive the following output:
Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /home/kekayan/.bashrc ? [yes|no]
yes so that we can use the
In order to activate the installation, you should source the
Once we have done that, you can verify our installation by making use of the
conda command, for example with
Let’s create our virtual environment.so we can install tensorflow there
conda create --name tf
tf is the name i have for my environment.
Then we can activate it by
source activate tf
Next we intsall pip by following command
easy_install -U pip
finally install tensorflow gpu by issuing following command
pip3 install --upgrade tensorflow-gpu
follow link to check how to validate
This guide explains how to install TensorFlow on Ubuntu. Although these instructions might also work on other Linux…www.tensorflow.org
for more detail information follow below link