Ubuntu 18.04 Deep Learning Environment Configuration: Machine Environment Part

Keywords: sudo Ubuntu Linux shell

Ubuntu 18.04 Deep Learning Environment Configuration

1. Hardware configuration and basic environment description

  1. ASUS notebook model: FL5900U
  2. Video card: Intel Corporation Skylake GT2
  3. Memory: 8G
  4. Display memory: 2G
  5. CPU: 4 Intel® Core™ i7-6500U CPU @ 2.50GHz
  6. System: ubuntu18.04

2. Install graphics card driver

1. Delete old drivers

The graphics card driver installed on ubuntu was not the driver of Nvidia, so the driver was removed first.
shell # delete sudo apt-get purge nvidia*
If you choose the smallest installation when installing Ubuntu 18.04, you can ignore this step.

2. Disable the nouveau nvidia driver

Edit the / etc/modprobe.d/blacklist.conf file and add it at the end
shell blacklist nouveau options nouveau modeset=0
Update configuration file:
shell sudo update-initramfs -u
Restart after successful disabling.
Using the command lsmod | grep nouveau for verification, the wisdom of linux tells us that no news is the best news.

3. Official start of installation

# Add ppa
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
# View the appropriate driver version
ubuntu-drivers devices
# Installation Drive
# The recommended version is installed here.
sudo apt-get install nvidia-driver-430

View installation gpu information:
Explain that the installation has been successful, if you encounter the following

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

It may be that the nouveau driver has not been disabled successfully and needs to be unloaded and reloaded after being disabled.

3. Installing Dependency Libraries

I do not understand, in line with the principle of conflict, just pretend.

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-devlibgl1-mesa-glx libglu1-mesa libglu1-mesa-dev

4. GCC reduced version

CUDA 9.0 requires GCC version to be 5.x or 6.x. Other versions are not allowed. You need to configure them yourself. You can modify the GCC version only by following commands.

sudo apt-get install gcc-5
sudo apt-get install g++-5

Replace to the original version:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 50

5. Install CUDA9.0

  1. Download address: https://developer.nvidia.com/cuda-toolkit-archive
  2. I chose linux x86-64, Ubuntu 17.04, runfile(local) versions and downloaded Base Installer and four Patch es.
    Note: During the installation process, you will be prompted whether you need to install the graphics card driver. Here, choose n, other options y or return key to install:
    sudo sh cuda_9.0.176_384.81_linux.run
    
    sudo sh cuda_9.0.176.1_linux.run
    
    sudo sh cuda_9.0.176.2_linux.run
    
    sudo sh cuda_9.0.176.3_linux.run
    
    sudo sh cuda_9.0.176.4_linux.run
    
  3. Configuring environment variables
    exportPATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} 
    exportLD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    
    Make it effective.
  4. Verification
    If the corresponding graphics card performance information is output, Result = PASS indicates that the CUDA installation is successful.
    cd ~/NVIDIA_CUDA-9.0_Samples/1_Utilities/deviceQuery 
    make -j4  
    sudo ./deviceQuery
    

6. Install CUDNN

  1. Download address: https://link.zhihu.com/?target=https%3A//developer.nvidia.com/rdp/cudnn-download
  2. Download: Download cuDNN v7.4.1 (Nov 8, 2018), for CUDA 9.0 -- CuDNN Library for Linux
  3. Installation:
    tar -zxvf cudnn-9.0-linux-x64-v7.4.1.5.tgz
    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*
    
    Error-free installation is over
    Is it a bit mysterious? When you install it, you must pay attention to the combination of versions.

7. End

  1. This is the end of the machine environment, the control between these versions still need to go to the official website to understand the following.
  2. The compatible version is installed in this article, not the most matched version, so there are hidden dangers.
  3. Follow-up may wait for a new version with the 18.04 official website.

Posted by alfonsomr on Fri, 23 Aug 2019 04:23:32 -0700