Ubuntu 18.04 Deep Learning Environment Configuration
1. Hardware configuration and basic environment description
- ASUS notebook model: FL5900U
- Video card: Intel Corporation Skylake GT2
- Memory: 8G
- Display memory: 2G
- CPU: 4 Intel® Core™ i7-6500U CPU @ 2.50GHz
- 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
- Download address: https://developer.nvidia.com/cuda-toolkit-archive
- 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
- Configuring environment variables
Make it effective.exportPATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} exportLD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
- 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
- Download address: https://link.zhihu.com/?target=https%3A//developer.nvidia.com/rdp/cudnn-download
- Download: Download cuDNN v7.4.1 (Nov 8, 2018), for CUDA 9.0 -- CuDNN Library for Linux
- Installation:
Error-free installation is overtar -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*
Is it a bit mysterious? When you install it, you must pay attention to the combination of versions.
7. End
- 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.
- The compatible version is installed in this article, not the most matched version, so there are hidden dangers.
- Follow-up may wait for a new version with the 18.04 official website.