Steps to install cuda10.1 on Ubuntu 20.04 (graphic tutorial)

Steps to install cuda10.1 on Ubuntu 20.04 (graphic tutorial)

Pre-installation preparation

The main purpose of CUDA is deep learning, and the current mainstream deep learning framework Tensorflow2 supports up to CUDA 10.1. Therefore, this article explains the main process of installing CUDA 10.1 on Ubuntu 20.04 system.

First, check whether your NVIDIA graphics card driver supports cuda10.1 version.
Execute the following command in the terminal:
nvidia-smi

If the version number of CUDA Version: ... is greater than or equal to 10.1 (mine is 10.2), you can install cuda10.1.

Key point: gcc downgrade

Because the gcc version that comes with Ubuntu 20.04 is 9.3, and cuda 10.1 does not support gcc-9, gcc-7 must be installed manually. The command is as follows:

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

After installing gcc-7, there are two versions of gcc in the system, so to set the default gcc, the command is as follows:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 1

This command can set the priority of each version of gcc through update-alternatives. The highest priority is the system default version. The following command can be used to display its priority:

sudo update-alternatives --display gcc

The same is true for setting the default g++:

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 1

Display g++ priority:

sudo update-alternatives --display g++

Download and install CUDA 10.1 according to the installation steps on the official website

CUDA Toolkit 10.1 update2 Archive

As shown in the figure above, it is recommended to choose the run file installation, which is relatively simple.

  • When the installation screen launches, select continue.
  • Then enter accept and press Enter.
  • Since you already have the NVIDIA graphics driver in your system, if you do not want to install the driver included with CUDA 10.1, move to the Driver option and press the space bar to cancel it. As shown below.


Move to the Install option, press Enter, and wait for the installation to complete.

Configure executable file and library path

After the installation is complete, you need to configure the environment for CUDA 10.1.

First open the .bashrc file in your home directory: gedit ~/.bashrc

Add the following to the end of the file:

export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Save and close the file to complete the configuration.

Update the environment: source ~/.bashrc

Install cuDNN

Download cuDNN

Download cuDNN

After opening the link, the website will ask you to log in. If you don’t have an NVIDIA account, register and then log in.


Select the version corresponding to CUDA 10.1 (7.6.5), click it, select cuDNN Library for Linux, and click Download. (It is best to choose cuDNN Library for Linux as this file format is easier to install)

Install cuDNN

Switch to the directory where the downloaded file is located and unzip the downloaded cuDNN compressed file to the current directory:

tar zxvf ./cudnn-10.1-linux-x64-v7.6.5.32.tgz -C ./

Decompress the

Copy the cuda/include/cudnn.h file to the /usr/local/cuda/include folder

Copy all files under cuda/lib64/ to the /usr/local/cuda/lib64 folder

Add read and execute permissions to the above files:

sudo chmod 755 /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

Installation complete

References:

How to install CUDA and cuDNN on Ubuntu 20.04
Ubuntu: Install cuda10.1 driver

This is the end of this article about the steps to install cuda10.1 on Ubuntu20.04 (graphic tutorial). For more information about installing cuda10.1 on Ubuntu20.04, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed solution to the problem of "Unable to start the program, the system cannot find the specified file" when writing C program or CUDA program in VS2019
  • Installation of CUDA10.0 and problems in Ubuntu
  • Detailed configuration of win10+VS2017+Cuda10.0 environment
  • Detailed explanation of the correspondence between different Tensorflow version requirements and CUDA and CUDNN versions
  • Implementation of installing and uninstalling CUDA and CUDNN in Ubuntu
  • Detailed tutorial on installing CUDA9.0 on Ubuntu16.04
  • Ubuntu 20.04 CUDA & cuDNN Installation Method (Graphical Tutorial)
  • Manjaro installation CUDA implementation tutorial analysis

<<:  Solution to the problem that Navicat cannot remotely connect to MySql server

>>:  Detailed explanation of MySQL transactions and MySQL logs

Recommend

Example code for implementing background transparency and opaque text with CSS3

Recently, I encountered a requirement to display ...

H tags should be used reasonably in web page production

HTML tags have special tags to handle the title of...

Div exceeds hidden text and hides the CSS code beyond the div part

Before hiding: After hiding: CSS: Copy code The co...

Use crontab to run the script of executing jar program regularly in centOS6

1. Write a simple Java program public class tests...

MySQL series 15 MySQL common configuration and performance stress test

1. Common MySQL configuration All the following c...

IE6 space bug fix method

Look at the code: Copy code The code is as follows...

Rainbow button style made with CSS3

Result: Implementation code: html <div class=&...

Vue data responsiveness summary

Before talking about data responsiveness, we need...

Detailed steps to install Nginx on Linux

1. Nginx installation steps 1.1 Official website ...

Detailed tutorial on building a local idea activation server

Preface The blogger uses the idea IDE. Because th...

Implementation steps for installing RocketMQ in docker

Table of contents 1. Retrieve the image 2. Create...

Tips for writing concise React components

Table of contents Avoid using the spread operator...