Ubuntu 18.04 Deploy GPU Environment

黃馨平
Jackycsie
Published in
3 min readNov 22, 2019

This article will used smart way install GPU environment.

Why so smart ? Because I used a rather stupid way.

This method is stupid method “deepvariant install”.

Why stupid. Because this way sometime will fall.

This is very angry.

Because we want focus deep learning or other professional field not environment issue.

About machine

We are using the D52G provided by Quanta Computer.

Environment inside:

  • 80 vCPU
  • 8 V100 GPU
  • 768 GiB RAM

Environmental configuration

  • Ubuntu 18.04 LTS
  • Nvidia driver 440.33.01
  • CUDA 10.0
  • cudnn 7.6.3
  • Tensorflow GPU 1.13

1. you need clean your environment.

If your machine is not Re-irrigation system.

You can skip this step.

apt-get remove --purge '^nvidia-.*'
apt autoremove
apt update

2. install Nvidia driver

Add repository to your apt

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.debdpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.debapt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pubapt updatewget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.debapt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb

3. Check your ubuntu-drivers

If ubuntu-drvers have nvidia drivers you can direct download.

ubuntu-drivers devices

You can choose autoinstall or own want version.

#autoinstall
ubuntu-drivers autoinstall

Reboot your system

reboot

Testing

nvidia-smi

You can see this figure show CUDA version:10.2.

It’s ok. because It’s wrong.

Finally, it will still be based on your installation.

4. Install CUDA 10 and Cudnn 7.6.3

First you need go this page download cudnn.

Then, go to you download folder.

This command will be easy to install cudnn.

apt install --no-install-recommends cuda-10-0

Add environment variables

vim ~/.bashrc
export PATH=$PATH:/usr/local/cuda/bin/;
source ~/.bashrc

Testing

nvcc -V

Install Cudnn

dpkg -i libcudnn7_7.6.3.30-1+cuda10.0_amd64.deb
dpkg -i libcudnn7-dev_7.6.3.30-1+cuda10.0_amd64.deb
dpkg -i libcudnn7-doc_7.6.3.30-1+cuda10.0_amd64.deb

5. install tensorflow-gpu 1.13.1

pip install tensorflow-gpu==1.13.1
pip show tensorflow-gpu

Testing

import tensorflow as tf
tf.test.gpu_device_name()

It’s work.

Finish

--

--

黃馨平
Jackycsie

閱讀本是尋常事,繁華靜處遇知音