Install Ubuntu 20.04 Install NVIDIA drivers Configure Pytouch and tensorflow environment Local environment: Dell G3 3579 Install Ubuntu 20.04 1 Press F2 to enter BIOS Install NVIDIA Driver When installing the driver, first disable nouveau After restarting, nothing happened. Building pytouch Install miniconda3, Install PyCharm Click tools->create desktop entry to directly generate shortcut keys and set the compiler to pytouch 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() 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:
|
<<: Detailed explanation of MySQL string concatenation function GROUP_CONCAT
>>: Vue implements user login and token verification
1. Install a virtual machine (physical machine) Y...
background During the project development process...
During my internship in my senior year, I encount...
0. Background Hardware: Xiaomi Notebook Air 13/In...
When we introduced nginx, we also used nginx to s...
This article shares the specific code of jQuery t...
Effect screenshots: Implementation code: Copy code...
Table of contents 1. Background: 2. Design ideas:...
Table of contents 1. Help Command 2. Mirror comma...
Copy code The code is as follows: <style type=...
1.1 Introduction By enabling the slow query log, ...
This article records the graphic tutorial of MySQ...
1. Download address https://dev.mysql.com/downloa...
1. <body background=image file name bgcolor=co...
Preface innodb_data_file_path is used to specify ...