0%

tutorial to install and configure deep learning environments on ubuntu 18.04

Guide

prepare ubuntu 18.04

主机支持8个口才能使用GeForce RTX 2080 Ti(11GB显存)
Ubuntu 18.04(刻录Ubuntu 18.04系统并通过U盘安装.)
Mem: 64GB
CPU: 2 core 10
GPU: RTX 2080 Ti

download

  • Anaconda3-2019.03-Linux-x86_64.sh

ssh

1
2
3
4
sudo apt-get -y install openssh-server
sudo ap-get -y install net-tools
sudo ifconfig
# 192.168.0.114

install packages

1
2
3
4
5
6
sudo apt -y install git vim tree build-essential cmake-gui
sudo apt-get -y install libleveldb-dev liblmdb-dev libsnappy-dev libhdf5-serial-dev
sudo apt-get -y install libopenblas-dev liblapack-dev libatlas-base-dev
apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

Nvidia driver

Disable the Nouveau drivers

To install the Display Driver, the Nouveau drivers must first be disabled.

1
2
3
4
5
6
7
8
9
10
11
12
13
# nouveau is loaded
lsmod | grep nouveau

vim /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0

#Regenerate the kernel initramfs:
sudo update-initramfs -u
sudo reboot

# reboot and verify that the Nouveau drivers are not loaded.
lsmod | grep nouveau

install driver by CUDA_linux.run(not)

The Runfile installation installs the NVIDIA Driver, the CUDA Toolkit, and CUDA Samples, via an interactive ncurses-based interface.

1
2
3
4
5
6
7
sudo apt-get purge nvidia-*

sudo ./cuda_10.1.243_418.87.00_linux.run --help
sudo ./cuda_10.1.243_418.87.00_linux.run --driver

# test
nvidia-smi

/var/log/nvidia-installer.log
/var/log/cuda-installer.log

ERROR: The Nouveau kernel driver is currently in use by your system. This driver is incompatible with the NVIDIA driver, and must be disabled before proceeding.

install driver by PPA(推荐)

see ubuntu_nvidia_ppa

1
2
3
4
5
6
7
8
9
sudo add-apt-repository ppa:graphics-drivers/ppa
sudp apt-get update

sudo apt-cache search nvidia-driver-*
# nvidia-driver-418
# nvidia-driver-440

sudo apt-get -y install nvidia-driver-440
sudo reboot

check dirver

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
nvidia-smi
Thu Jun 4 17:12:59 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.82 Driver Version: 440.82 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce RTX 208... Off | 00000000:17:00.0 Off | N/A |
| 30% 42C P8 19W / 250W | 1MiB / 11019MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
| 1 GeForce RTX 208... Off | 00000000:65:00.0 On | N/A |
| 31% 44C P8 10W / 250W | 80MiB / 11018MiB | 0% Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 1 1309 G /usr/lib/xorg/Xorg 21MiB |
| 1 1399 G /usr/bin/gnome-shell 56MiB |
+-----------------------------------------------------------------------------+

cuda-toolkit(9.1)

1
2
3
4
5
6
7
8
sudo apt-get install nvidia-cuda-toolkit

nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

conda

1
2
3
./Anaconda3-2019.03-Linux-x86_64.sh 
[yes]
[yes]

install torch

1
2
3
4
conda create -n py37 python==3.7
conda activate py37

conda install -y pytorch torchvision

opencv

1
2
3
4
5
6
7
8
9
pip install opencv-contrib-python

python
Python 3.7.0 (default, Oct 9 2018, 10:31:47)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.2.0'

qt

1
conda install pyqt

other libraries

1

Reference

History

  • 2020/06/04: created.