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
Table of contents Node connects to Mysql Install ...
This article example shares the specific code of ...
Let’s take a look at the panoramic view effect: D...
step: 1. Create a new docker-compose.yml file in ...
Preface This article mainly introduces the releva...
Grayscale release refers to a release method that...
Preface Let me share with you how to make a searc...
Use ifnull instead of isnull isnull is used to de...
1. Create the MySQL database nacos_config 2. Sele...
As a front-end novice, I tinkered with the front-e...
Originally, this seventh chapter should be a deep ...
Table of contents 1. Data Type 1.1 Why do we need...
Problem description (environment: windows7, MySql...
First, understand a method: Entering a Docker con...
The span tag is often used when making HTML web p...