Install Tensorflow-GPU and work on RTX 2080-Ti

Man-Ju
4 min readFeb 12, 2019

--

How to install Tensorflow on RTX 2080-Ti and Ubuntu 16.04

Hi, I’m Juta. This is my first time sharing my learning history. In the process of sharing, if the grammar is wrong, I hope you will not mind it. The following are my computer and toolkits specifications:

  • Operating System: Ubuntu 16.04
  • Graphics card: GeForec RTX 2080 Ti
  • Cuda version: cuda-10.0
  • cuDNN version: cudnn 7.4.2
  • Tensorflow version: 1.13.0
  • Python version: python 2.7

Next, I will describe in detail the steps of each installation and hope that my sharing will help you. OK. Let’s get started.

Install cuda-10.0

STEP 1. We need to download cuda-10.0 package. For me it is Linux / x86_64 / Ubuntu / 16.04 /deb (local)

STEP 2. Follow the steps on the web page to install

$ sudo dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install cuda

After installing cuda, run the command nvidia-smiand confirm that the nvidia driver is successfully installed.

STEP 3. After that, we add following PATH variable line to the bashrc by running

$ vim ~/.bashrc

Adding following line to the bashrc at the end of file.

$ export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}

Read bashrc directly

$ source ~/.bashrc

STEP 4. We build cuda samples and run it.

$ cd /usr/local/cuda-10.0/samples/
$ sudo make

Construction completed and go to built sources

$ cd /usr/local/cuda-10.0/samples/bin/x86_64/linux/release
$ ./deviceQuery
$ ./bandwidthTest

The above illustration represents the completion of the cuda installation.

Install cuDNN 7.4.2

STEP 1. In order to download cuDNN, we need to login on NVIDIA cuDNN web and download cuDNN Library for Linux .

Unzip the cuDNN Library.

$ cp cudnn-10.0-linux-x64-v7.4.2.24.solitairetheme8 cudnn-10.0-linux-x64-v7.4.2.24.tgz
$ tar -xvf cudnn-10.0-linux-x64-v7.4.2.24.tgz

And copy the following files into the CUDA Toolkit directory, and then change the file permissions.

$ sudo cp cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

After changing the permissions, update the cuDNN.

$ cd /usr/local/cuda/lib64/
$ sudo chmod +r libcudnn.so.7.4.2
$ sudo ln -sf libcudnn.so.7.4.2 libcudnn.so.7
$ sudo ln -sf libcudnn.so.7 libcudnn.so
$ sudo ldconfig

STEP 2. Download other deb files

Run following commands to install with deb files:

$ sudo dpkg -i libcudnn7_7.4.2.24-1+cuda10.0_amd64.deb
$ sudo dpkg -i libcudnn7-dev_7.4.2.24-1+cuda10.0_amd64.deb
$ sudo dpkg -i libcudnn7-doc_7.4.2.24-1+cuda10.0_amd64.deb

STEP 3. To verify that the installation is successful and running properly. We compile the mnistCUDNN sample.

  1. Copy the cuDNN sample to Home directory.
$ cp -r /usr/src/cudnn_samples_v7/ $HOME

2. Go to Home directory and Compile the mnistCUDNN sample.

$ cd  $HOME/cudnn_samples_v7/mnistCUDNN
$ make clean && make

3. Run the mnistCUDNN sample. We will see a message Test passed! represents that it can be successfully run.

$ ./mnistCUDNN

Install and Build TensorFlow

STEP 1. Check pip and python environment to ensure installation completed. Install the tensorflow package.

$ pip install tf-nightly-gpu
$ pip install --upgrade tensorflow-gpu

STEP 2. To verify that the installation is successful. The information related to GPU indicates successful installation.

$ python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"

Finally, TensorFlow-gpu can be used.

--

--