I recorded the work when CUDA and cuDNN corresponding to the version of tensorflow were installed locally for machine learning with tensorflow.
This article has set up CUDA 10.1 and cuDNN 7.6 to use tensorflow 2.3.0.
Ubuntu 20.04
https://codelabo.com/posts/20200229081221
https://medium.com/@exesse/cuda-10-1-installation-on-ubuntu-18-04-lts-d04f89287130
--1: NDIVIA driver installation -2: CUDA Setup --3: cuDNN Setup
Find out what CUDA, cuDNN version you need for the version of tensorfow you want to use. You can check it on tensorfow's Official Site.
Installing CUDA is actually installing the CUDA toolkit. Don't confuse CUDA with CUDA toolkit.
Only the latest version of cuda can be downloaded from the regular download on the official website, so download it from the archive.
You can choose the version you want to download at NVIDIA CUDA Archived Documentation. Click here for documentation for each version (https://docs.nvidia.com/cuda/archive/)
Select the desired CUDA from Archived Releases
CUDA 10.1
Select Target Platform
Linux
Architecutre
x86_64
Distribution
Ubuntu
Version
18.04
Installer Type
runfile [local]
Execute the wget command that has been checked in the above selection items in the terminal.
wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run
In the official documentation Quick start guide before running the installer Since the necessary work is listed, execute it sequentially.
--Confirmation command
#Check if nouveau is loaded(If nothing comes out, you may not have to do the invalidation work)
$ lsmod | grep nouveau
in etc / modprobe.d / blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
To describe and adapt.
$ cd /etc/modprobe.d
$ sudo touch blacklist-nouveau.conf
$ sudo chmod 777 blacklist-nouveau.conf
$ echo blacklist nouveau > blacklist-nouveau.conf
$ echo options nouveau modeset=0 >> blacklist-nouveau.conf
$ cat blacklist-nouveau.conf #Check the contents
Regenerate kernel initramfs
sudo update-initramfs -u
--3 Multi-user mode (text login) --5 Multi-user mode (graphical login)
Check the current runlevel
$ runtime
N 5
--Change to level 3
$ systemctl set-default multi-user.target
--Change to level 5
$ systemctl set-default graphical.target
If it doesn't appear even if you shift it, you should set it to display the grub menu every time you start it. grub menu How to put out: https://qiita.com/ricrowl/items/1d038d6b4412feedb25e
runlevel 3 means don't start the Xserver, nomodeset blocks the loading of nouveau modules This is to allow the nvidia modules to be loaded after the build.
$ sudo nvidia-xconfig
When I restarted after doing this, the HDMI signal from the motherboard disappeared. Deal with it by connecting to other video ports on the GPU. I haven't investigated the meaning of this command, so I need to investigate it later.
Existing gcc version 9.3 is supported, so the latest gcc version will cause an error running .run
udo apt -y install gcc-8 g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8
Reference: https://askubuntu.com/questions/1236188/error-unsupported-compiler-version-9-3-0-when-installing-cuda-on-20-04 The tensorflow documentation recommends gcc 7.3.1, but I could run it with gcc 8.
sudo sh cuda_10.1.243_418.87.00_linux.run #--silent
When running .run, you have the option to install the versino.418 driver as well. If you execute it with the --silent option of the Quick Start guide, the driver for versino.418 will be installed automatically, so an error will occur due to a conflict with the driver you installed earlier. Execute without any options.
echo -e "\n## CUDA and cuDNN paths" >> ~/.bashrc
echo 'export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashr
source ~/.bashrc
nvcc -V
Recommended Posts