博主之前专栏中的Ubuntu都安装在虚拟机上,这里博主整了一个双系统,所以要重新配置下Ubuntu的环境,这里简单记录下过程:

1.准备好操作系统ubuntu-20.04.2.0-desktop-amd64.iso,U盘启动盘制作工具,启动盘后做好后,便可以从U盘安装。系统起来后的安装步骤和虚拟机下的过程类似,具体可以参考我的博客

2.完毕后的操作基本就输更新源、apt update和upgrade下、安装aptitude、安装一些必要库、设置下文件夹快速访问路径,常用软件添加到桌面等,可参看博客,由于也需要在此系统上写写博客啥的,所以在此基础上有安装了一个baidupingyin,觉得挺好用的,可以参考此博客

3.截图工具可以就用Ubuntu自带的Screenshot软件,画图软件可以用Kolourpaint

sudo apt-get install  kolourpaint4

打开界面如下

4. 一些常用命令如下:

ubuntu下常用命令可参考:

ubuntu下的常用的shell命令 - 我的梦想似彩虹 - 博客园

LINUX Shell常用命令_LH0912666的博客-CSDN博客_shell命令

5.微信和qq的安装可见博客Ubuntu 20.04安装微信、QQ_宏玄的专栏-CSDN博客_ubuntu 微信

解决ubuntu安装wine-QQ/wechat后出现字体乱码问题_nick_young_qu的博客-CSDN博客

ubuntu20.04 安装微信 解决中文显示问题 - 知乎

 

6.如何创建界面快捷方式见博客https://jingyan.baidu.com/article/7e440953ff08496ec0e2efda.html

 

7.安装远程工具,博主用的事ToDesk远程控制软件-免费安全流畅的远程连接电脑手机,按照官网配置即可

 8.设置背景图片

9.挂载Windows下的其它盘,可参考给双系统的ubuntu挂载windows的硬盘_show me code-CSDN博客_ubuntu 挂载windows硬盘

10. 安装Anaconda

Anaconda | The World's Most Popular Data Science Platform

官网上点击get started进入下载页面

conda、anaconda、miniconda区别和miniconda安装_jonssonyan-CSDN博客_anaconda和miniconda区别

如下网页上可以下载到旧版本的Anaconda

Index of /

 这里用的是Anaconda3-5.2.0-Linux-x86_64.sh版本,直接按照如下帖子进行安装即可

Ubuntu18.04 安装 Anaconda3_梦Dancing的博客-CSDN博客_ubuntu安装anaconda

重启之后输入python

使用update-alternatives管理多个版本的Python,以及对应版本Python的第三方库的安装_Hi, Robotics-CSDN博客

 若要卸载Anaconda,可参考2020-11-02-Ubuntu 20.04安装Anaconda3-卸载Anaconda3-笔记_贰-爺的博客-CSDN博客_ubuntu卸载anaconda3

11. 安装cuda和cudnn

cuda和cudnn这方面的介绍可以参考之前博客

深度学习中常用的网络层及Tensor RT支持的网络层_jiugeshao的专栏-CSDN博客

可以参考 Ubuntu 18.04安装CUDA和cuDNN - 知乎 来安装cuda和cudnn,也可以参考如下博客

Ubuntu16.04下安装cuda和cudnn的三种方法(亲测全部有效)_隔壁老王的博客-CSDN博客_ubuntu安装cuda

驱动的卸载参考Ubuntu 卸载nvidia驱动 - 唐淼 - 博客园

如下命令可以查询到一些信息

lspci | grep -i nvidia
sudo dpkg --list | grep nvidia-*
nvidia-smi



 执行了一个cuda自带的例子,输出如下信息,表示cuda安装成功了

 

卸载cuda可参见此博客ubuntu完全卸载CUDA_Venquieu的博客-CSDN博客_ubuntu卸载cuda

博主这里安装的cuda版本为11.0

博主这边安装了tensorflow-gpu(2.4版本)

import tensorflow as tf
sess = tf.compat.v1.Session()

 执行下来,出现如下输出语句,即表示cuda和cudnn已经配置成功

tf.compat.v1.Session()
2022-02-18 23:40:05.605991: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2022-02-18 23:40:05.606716: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
2022-02-18 23:40:05.628902: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-18 23:40:05.629048: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties: 
pciBusID: 0000:01:00.0 name: NVIDIA GeForce GTX 1660 Ti with Max-Q Design computeCapability: 7.5
coreClock: 1.335GHz coreCount: 24 deviceMemorySize: 5.80GiB deviceMemoryBandwidth: 268.26GiB/s
2022-02-18 23:40:05.629064: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2022-02-18 23:40:05.631140: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2022-02-18 23:40:05.631175: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2022-02-18 23:40:05.632029: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2022-02-18 23:40:05.632223: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2022-02-18 23:40:05.634402: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2022-02-18 23:40:05.634916: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2022-02-18 23:40:05.635023: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2022-02-18 23:40:05.635107: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-18 23:40:05.635291: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-18 23:40:05.635411: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2022-02-18 23:40:05.636312: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2022-02-18 23:40:05.636406: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-18 23:40:05.636535: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties: 
pciBusID: 0000:01:00.0 name: NVIDIA GeForce GTX 1660 Ti with Max-Q Design computeCapability: 7.5
coreClock: 1.335GHz coreCount: 24 deviceMemorySize: 5.80GiB deviceMemoryBandwidth: 268.26GiB/s
2022-02-18 23:40:05.636550: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2022-02-18 23:40:05.636564: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2022-02-18 23:40:05.636576: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2022-02-18 23:40:05.636588: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2022-02-18 23:40:05.636599: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2022-02-18 23:40:05.636610: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2022-02-18 23:40:05.636621: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2022-02-18 23:40:05.636633: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2022-02-18 23:40:05.636677: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-18 23:40:05.636823: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-18 23:40:05.636932: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2022-02-18 23:40:05.636958: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2022-02-18 23:40:06.063093: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-02-18 23:40:06.063124: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]      0 
2022-02-18 23:40:06.063131: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0:   N 
2022-02-18 23:40:06.063298: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-18 23:40:06.063472: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-18 23:40:06.063609: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-02-18 23:40:06.063721: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4953 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce GTX 1660 Ti with Max-Q Design, pci bus id: 0000:01:00.0, compute capability: 7.5)
<tensorflow.python.client.session.Session object at 0x7f22082f4780>
>>> 

   可以和windows上安装cuda、cudnn、验证过程进行对比,见我之前的博客win7下cuda8.0安装跑gpu版tensorflow_jiugeshao的专栏-CSDN博客_cuda8.0 win7

 如下位置下可以看到刚安装的tensorflow-gpu的库

 

其中Cudnn的版本也可以从一些程序的运行日志信息看到(如前面所跑的FCN例子

 12.Anaconda配置虚拟环境

ultralytics/yolov3训练预测自己数据集的配置过程_jiugeshao的专栏-CSDN博客

参考上面的博客,可以用来创建conda环境

conda create -n pytorch-yolo python=3.8
activate pytorch-yolo

增加清华源的命令

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2

 其它的操作命令可见如下博客

Anaconda安装与conda的基本操作_u010206379的博客-CSDN博客_anaconda conda

13. python版本的切换

树莓派4B上多版本python切换(一)_jiugeshao的专栏-CSDN博客

树莓派4B上多版本python切换(二)_jiugeshao的专栏-CSDN博客

前面博客提到python版本的切换,在Anaconda下也可以通过上面提到的conda创建虚拟环境来切换

从上面可以看到在Ubuntu 桌面系统下的配置深度学习环境操作和windows系统下,区分不大,操作习惯是一样的。下一篇博客会在此系统环境下配置下pytorch

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐