Tutorial on installing Ubuntu 20.04 and NVIDIA drivers

Tutorial on installing Ubuntu 20.04 and NVIDIA drivers

Install Ubuntu 20.04 Install NVIDIA drivers Configure Pytouch and tensorflow environment

Local environment: Dell G3 3579
win10, the system is on a 128 SSD

Install Ubuntu 20.04

1 Press F2 to enter BIOS
2 security boot settings disable
3 References
https://www.jb51.net/article/173277.htm

insert image description here

Install NVIDIA Driver

When installing the driver, first disable nouveau
Then uninstall the original nvidia driver (if any)
refer to:
https://www.jb51.net/article/171959.htm
But after installing this situation
There is output in nvidia-smi, and it is reflected in nvidia-settings. A shortcut icon is also generated. However, after restarting to take effect, in Settings->About: the graphics card has changed from the original integrated graphics card 630 to lvib or something. Although it does not affect the establishment of the approved learning environment, I always feel that it will hang in the future. There is another situation. After the driver is installed, in Settings->About: the graphics card shows GTX1060. However, every time I start or shut down the computer, it displays: dev/sda5 clean…dev/sda6 clean. It shuts down after 2 seconds, and the same happens when I start up.
There is another situation: the environment is set up, the drivers and so on are all ready, but a command, when installing NetEase Cloud Music, needs to get some dependencies, and then a line of command is passed, and dev/sda6 clean flashes endlessly when booting. ctro-alt-f1 can open tty, but there is no time to enter the username and password, and tty crashes in less than 1 second. Then I couldn't enter the system. Finally reinstall the system now:
After installing the Ubuntu system, do not update anything and do not disable nouveau. The first thing is to install the driver directly.

insert image description here

After restarting, nothing happened.

Building pytouch

Install miniconda3,
Change to USTC, Tsinghua source
conda create -n pytouch python=3.7
conda activate pytouch
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda install pytorch=0.4.1 torchvision cuda90

Install PyCharm

insert image description here

Click tools->create desktop entry to directly generate shortcut keys and set the compiler to pytouch
Fill in the code to test the use of GPU:

import torch
flag = torch.cuda.is_available()
print(flag)

ngpu=1
# Decide which device we want to run on
device = torch.device("cuda:0" if (torch.cuda.is_available() and ngpu > 0) else "cpu")
print(device)
print(torch.cuda.get_device_name(0))
print(torch.rand(3,3).cuda()) 
# True
# cuda:0
# GeForce GTX 1060
# tensor([[0.5772, 0.5287, 0.0946],
# [0.9525, 0.7855, 0.1391],
# [0.6858, 0.5143, 0.8188]], device='cuda:0')

Install tensorflow14

import tensorflow as tf
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
import warnings
warnings.filterwarnings("ignore")
hello = tf.constant("Hello, Tensorflow")
print(hello)
a=tf.constant([1.0,2.0]) #define constant b=tf.constant([3.4,4.0])
result1=a+b
print("a+b=",result1)
c = tf.constant([[3.0],[1.4]])
result2=a+c
sess = tf.Session()
print("result1:",result1)#The result is a tensor of "add:0", and the shape has only one element, that is, the dimension is 1
# 2 means the first dimension has two elements and they are floating point type try:
 print(sess.run(result1))
 print("result2:",result2)
 print(sess.run(result2))
 print(sess.run(hello))
except:
 #Exception handling print("Exception")
finally:
 #Close the session and release resources sess.close() 

insert image description here

Summarize

This is the end of this article about installing Ubuntu 20.04 and installing NVIDIA drivers. For more information about installing Ubuntu 20.04 NVIDIA drivers, 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:
  • How to install RTX2080 Nvidia graphics card driver in Ubuntu18.04.2
  • Install nvidia graphics driver under Ubuntu (simple installation method)
  • Detailed tutorial on installing nvidia driver + CUDA + cuDNN in Ubuntu 16.04
  • Detailed tutorial on installing Docker and nvidia-docker on Ubuntu 16.04
  • Install Nvidia driver in Ubuntu 18 to solve black screen and adjust resolution problem
  • Tutorial on installing Nvidia graphics card driver in Ubuntu 18.04 (with pictures and text)

<<:  Detailed explanation of MySQL string concatenation function GROUP_CONCAT

>>:  Vue implements user login and token verification

Recommend

VUE implements timeline playback component

This article example shares the specific code of ...

React + Threejs + Swiper complete code to achieve panoramic effect

Let’s take a look at the panoramic view effect: D...

How to install kibana tokenizer inside docker container

step: 1. Create a new docker-compose.yml file in ...

Using Nginx to implement grayscale release

Grayscale release refers to a release method that...

Implementing search box function with search icon based on html css

Preface Let me share with you how to make a searc...

A brief discussion on whether MySQL can have a function similar to Oracle's nvl

Use ifnull instead of isnull isnull is used to de...

How to configure MySQL8 in Nacos

1. Create the MySQL database nacos_config 2. Sele...

Web Design Experience: Efficiently Writing Web Code

Originally, this seventh chapter should be a deep ...

Detailed explanation of data types in JavaScript basics

Table of contents 1. Data Type 1.1 Why do we need...

Solve the problem of MySql client exiting in seconds (my.ini not found)

Problem description (environment: windows7, MySql...

How to configure nginx+php+mysql in docker

First, understand a method: Entering a Docker con...

Defining the minimum height of the inline element span

The span tag is often used when making HTML web p...