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

Example of how to implement embedded table with vue+elementUI

During my internship in my senior year, I encount...

Install Docker for Windows on Windows 10 Home Edition

0. Background Hardware: Xiaomi Notebook Air 13/In...

How to use squid to build a proxy server for http and https

When we introduced nginx, we also used nginx to s...

jQuery implements dynamic tag event

This article shares the specific code of jQuery t...

HTML background color gradient effect achieved through CSS style

Effect screenshots: Implementation code: Copy code...

Detailed explanation of Docker common commands Study03

Table of contents 1. Help Command 2. Mirror comma...

An IE crash bug

Copy code The code is as follows: <style type=...

How to enable slow query log in MySQL

1.1 Introduction By enabling the slow query log, ...

MySQL 8.0.17 installation and configuration graphic tutorial

This article records the graphic tutorial of MySQ...

Detailed process of decompressing and installing mysql5.7.17 zip

1. Download address https://dev.mysql.com/downloa...

HTML tutorial, easy to learn HTML language

1. <body background=image file name bgcolor=co...

Some notes on modifying the innodb_data_file_path parameter of MySQL

Preface innodb_data_file_path is used to specify ...