赞
踩
本文以 Ubuntu 20.04 操作系统为例,演示如何配置深度学习 GPU 环境。
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=runfile_local
复制箭头所指处的命令到命令行
wget https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run
如果不关,运行下面安装的命令之后会报错,装不上
systemctl isolate multi-user.target
关闭图形界面之后会重启,输入如下命令
sudo sh cuda_12.2.0_535.54.03_linux.run
稍等一会
在弹出的安装界面中选“continue”,如果选了会跳出安装,就说明安装失败,给了失败日志的路径,自己查看原因,一般是gcc版本问题,
- sudo apt-get install gcc-7 g++-7
-
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 9
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 1
-
- sudo update-alternatives --display gcc //查看默认版本
-
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 9
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 1
-
- sudo update-alternatives --display g++
如果没问题继续安装:
cuda安装包是自带显卡驱动的,所以这一步按空格去掉安装显卡驱动的选项,然后选择install
sudo systemctl start graphical.target
开始安装之前,需要修改 apt-get 的镜像源,不然国内下载速度很慢。我们这里以阿里源为例演示如何修改。
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
安装vim:
sudo apt-get install vim
运行 sudo vim /etc/apt/sources.list
打开文件,并按 i
插入以下内容,按 ESC
后再按 :wq
保存退出
sudo vim /etc/apt/sources.list
- deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
-
- deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
-
- deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
-
- # deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
- # deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
-
- deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
sudo apt-get update
安装参考 NVIDIA 官网提供的教程。
Quick Start Guide 12.3 documentation
- wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
- sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
- wget https://developer.download.nvidia.com/compute/cuda/12.3.1/local_installers/cuda-repo-ubuntu2004-12-3-local_12.3.1-545.23.08-1_amd64.deb
- sudo dpkg -i cuda-repo-ubuntu2004-12-3-local_12.3.1-545.23.08-1_amd64.deb
- sudo cp /var/cuda-repo-ubuntu2004-12-3-local/cuda-*-keyring.gpg /usr/share/keyrings/
- sudo apt-get update
- sudo apt-get -y install cuda-toolkit-12-3
sudo reboot # 非必需
执行完上述安装操作后,需要配置环境变量,让该系统下的所有用户都能使用:
sudo vi /etc/profile
- export PATH=/usr/local/cuda-12.3/bin${PATH:+:${PATH}}
- export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source /etc/profile
nvcc -V
来校验安装是否成功,若正确显示版本号则说明安装成功- $ nvcc -V
- nvcc: NVIDIA (R) Cuda compiler driver
- Copyright (c) 2005-2023 NVIDIA Corporation
- Built on Fri_Nov__3_17:16:49_PDT_2023
- Cuda compilation tools, release 12.3, V12.3.103
- Build cuda_12.3.r12.3/compiler.33492891_0
-
安装参考 NVIDIA 官方提供的教程。
2. 开始安装
- sudo dpkg -i cudnn-local-repo-ubuntu2004-8.9.7.29_1.0-1_amd64.deb
- sudo cp /var/cudnn-local-repo-ubuntu2004-8.9.7.29/cudnn-local-30472A84-keyring.gpg /usr/share/keyrings/
- cd /var/cudnn-local-repo-ubuntu2004-8.9.7.29/
- sudo dpkg -i libcudnn8_8.9.7.29-1+cuda12.2_amd64.deb
- sudo dpkg -i libcudnn8-dev_8.9.7.29-1+cuda12.2_amd64.deb
- sudo dpkg -i libcudnn8-samples_8.9.7.29-1+cuda12.2_amd64.deb
-
Test passed!
则说明安装成功)- cp -r /usr/src/cudnn_samples_v8/ $HOME
- cd $HOME/cudnn_samples_v8/mnistCUDNN
- make clean && make
- ./mnistCUDNN
-
校验安装时如果遇到下述错误:
- ```bash
- test.c:1:10: fatal error: FreeImage.h: No such file or directory
- 1 | #include "FreeImage.h"
- | ^~~~~~~~~~~~~
- compilation terminated.
- >>> WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
可通过如下方式解决,然后重新进行校验
sudo apt-get -y install libfreeimage3 libfreeimage-dev
sudo reboot
验证通过:
- wyr@ubuntu2004w1:~/cudnn_samples_v8/mnistCUDNN$ ./mnistCUDNN
- Executing: mnistCUDNN
- cudnnGetVersion() : 8401 , CUDNN_VERSION from cudnn.h : 8401 (8.4.1)
- Host compiler version : GCC 9.4.0
-
- There are 2 CUDA capable devices on your machine :
- device 0 : sms 56 Capabilities 6.0, SmClock 1328.5 Mhz, MemSize (Mb) 16280, MemClock 715.0 Mhz, Ecc=1, boardGroupID=0
- device 1 : sms 56 Capabilities 6.0, SmClock 1328.5 Mhz, MemSize (Mb) 16280, MemClock 715.0 Mhz, Ecc=1, boardGroupID=1
- Using device 0
-
- Testing single precision
- Loading binary file data/conv1.bin
- Loading binary file data/conv1.bias.bin
- Loading binary file data/conv2.bin
- Loading binary file data/conv2.bias.bin
- Loading binary file data/ip1.bin
- Loading binary file data/ip1.bias.bin
- Loading binary file data/ip2.bin
- Loading binary file data/ip2.bias.bin
- Loading image data/one_28x28.pgm
- Performing forward propagation ...
- Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: -1.000000 time requiring 57600 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: -1.000000 time requiring 178432 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: -1.000000 time requiring 184784 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: -1.000000 time requiring 2057744 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnFindConvolutionForwardAlgorithm ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.024864 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.025152 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.066912 time requiring 57600 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.097024 time requiring 178432 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.144352 time requiring 2057744 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.275520 time requiring 184784 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: -1.000000 time requiring 128000 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: -1.000000 time requiring 4656640 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: -1.000000 time requiring 1433120 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: -1.000000 time requiring 2450080 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnFindConvolutionForwardAlgorithm ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.062560 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.062880 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.107712 time requiring 2450080 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.114528 time requiring 1433120 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.116704 time requiring 128000 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.130944 time requiring 4656640 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Resulting weights from Softmax:
- 0.0000000 0.9999399 0.0000000 0.0000000 0.0000561 0.0000000 0.0000012 0.0000017 0.0000010 0.0000000
- Loading image data/three_28x28.pgm
- Performing forward propagation ...
- Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: -1.000000 time requiring 57600 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: -1.000000 time requiring 178432 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: -1.000000 time requiring 184784 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: -1.000000 time requiring 2057744 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnFindConvolutionForwardAlgorithm ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.024512 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.040768 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.052480 time requiring 57600 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.067328 time requiring 2057744 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.069856 time requiring 178432 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.077664 time requiring 184784 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: -1.000000 time requiring 128000 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: -1.000000 time requiring 4656640 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: -1.000000 time requiring 1433120 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: -1.000000 time requiring 2450080 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnFindConvolutionForwardAlgorithm ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.062336 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.064128 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.077600 time requiring 1433120 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.079904 time requiring 2450080 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.113632 time requiring 128000 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.123968 time requiring 4656640 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Resulting weights from Softmax:
- 0.0000000 0.0000000 0.0000000 0.9999288 0.0000000 0.0000711 0.0000000 0.0000000 0.0000000 0.0000000
- Loading image data/five_28x28.pgm
- Performing forward propagation ...
- Resulting weights from Softmax:
- 0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 0.9999820 0.0000154 0.0000000 0.0000012 0.0000006
-
- Result of classification: 1 3 5
-
- Test passed!
-
- Testing half precision (math in single precision)
- Loading binary file data/conv1.bin
- Loading binary file data/conv1.bias.bin
- Loading binary file data/conv2.bin
- Loading binary file data/conv2.bias.bin
- Loading binary file data/ip1.bin
- Loading binary file data/ip1.bias.bin
- Loading binary file data/ip2.bin
- Loading binary file data/ip2.bias.bin
- Loading image data/one_28x28.pgm
- Performing forward propagation ...
- Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 5632 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: -1.000000 time requiring 28800 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: -1.000000 time requiring 178432 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: -1.000000 time requiring 184784 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: -1.000000 time requiring 2057744 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnFindConvolutionForwardAlgorithm ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.026944 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.052864 time requiring 28800 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.064928 time requiring 178432 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.073376 time requiring 2057744 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.093312 time requiring 184784 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.109312 time requiring 5632 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: -1.000000 time requiring 1433120 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: -1.000000 time requiring 4656640 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: -1.000000 time requiring 2450080 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 2000 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnFindConvolutionForwardAlgorithm ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.087264 time requiring 2450080 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.088320 time requiring 1433120 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.088864 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.097152 time requiring 2000 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.122624 time requiring 4656640 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.195200 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Resulting weights from Softmax:
- 0.0000001 1.0000000 0.0000001 0.0000000 0.0000563 0.0000001 0.0000012 0.0000017 0.0000010 0.0000001
- Loading image data/three_28x28.pgm
- Performing forward propagation ...
- Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 5632 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: -1.000000 time requiring 28800 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: -1.000000 time requiring 178432 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: -1.000000 time requiring 184784 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: -1.000000 time requiring 2057744 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnFindConvolutionForwardAlgorithm ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.026272 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.047712 time requiring 28800 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.068864 time requiring 2057744 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.069856 time requiring 5632 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.075904 time requiring 184784 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.097664 time requiring 178432 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnGetConvolutionForwardAlgorithm_v7 ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: -1.000000 time requiring 1433120 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: -1.000000 time requiring 4656640 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: -1.000000 time requiring 2450080 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: -1.000000 time requiring 2000 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Testing cudnnFindConvolutionForwardAlgorithm ...
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.079712 time requiring 2450080 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.079808 time requiring 2000 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.083232 time requiring 1433120 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.088128 time requiring 0 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.117088 time requiring 4656640 memory
- ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.185120 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 6: -1.000000 time requiring 0 memory
- ^^^^ CUDNN_STATUS_NOT_SUPPORTED for Algo 3: -1.000000 time requiring 0 memory
- Resulting weights from Softmax:
- 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000714 0.0000000 0.0000000 0.0000000 0.0000000
- Loading image data/five_28x28.pgm
- Performing forward propagation ...
- Resulting weights from Softmax:
- 0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 1.0000000 0.0000154 0.0000000 0.0000012 0.0000006
-
- Result of classification: 1 3 5
-
- Test passed!
- wyr@ubuntu2004w1:~/cudnn_samples_v8/mnistCUDNN$
- # 卸载gnome
- sudo apt-get remove gnome -y
- # 卸载 gnome-shell
- sudo apt-get remove gnome-shell -y
- # 彻底卸载删除gnome的相关配置文件
- sudo apt-get purge gnome -y
- # 卸载臃肿的服务组件
- sudo apt-get remove snapd -y
- # 卸载依赖组件
- sudo apt-get autoremove -y
- # 清理安装gnome时候留下的缓存程序软件包
- sudo apt-get autoclean
- sudo apt-get clean
- # 重启系统
- sudo reboot
- sudo shutdown -r now
这是一个可以替换 nvidia-smi
查看显卡信息的一个工具。可以非常清楚地看到各个显卡的温度、利用率、正在使用的用户以及各用户占用的显存等。
使用如下命令安装:
- sudo apt install python3-pip
- sudo pip install gpustat
用法非常简单,记住下面这一条命令就行:
gpustat -i
这是一个跨平台的命令行网速监测工具,可以看到服务器实时网速显示。
通过如下命令安装:
- sudo apt install python3-pip
- sudo pip install netsm
用法非常简单,记住下面这一条命令就行:
netsm show
跑耗时较长的任务时,可以打开 tmux 将任务挂起,即使你关闭了窗口,任务仍然在后台运行。
sudo apt-get install tmux
区别于 wget 单线程下载的多线程下载工具。用法很简单,通过 -n
参数指定线程数即可,例如:axel -n 10 下载链接
。
sudo apt-get install axel
上述配置了三个深度学习 GPU 环境,分别是 PyTorch,TensorFlow 2 和 TensorFlow 1。且都是通过管理员来配置的。其他普通用户使用时,仅需使用 conda 在新建环境时克隆即可,下面给一个例子。
例如,普通用户要使用 PyTorch 环境,但他同时还需要安装 requests 包,直接在名为 pytorch
的环境里面是没有办法安装,因为缺少写入权限。因此可以通过如下克隆的方式安装:
- conda create -n pytorch2 --clone pytorch
- conda activate pytorch2
- pip install requests
这样既节省了服务器的存储空间,又避免了重复安装环境的烦恼。
当然你不克隆,直接激活使用也是可以的:
- conda activate pytorch
- pip install requests
因为默认会安装 requests 到用户家目录下,不会和其他用户的环境产生冲突。但如果环境多了,就不太容易区分了。
简易记录:安装GPU驱动,CUDA和cuDNN
使用ubuntu 20.04 进行机器学习配置环境 必须做的事情
【Linux】在Ubuntu上安装和使用miniconda
Administering a multi-user conda installation
Start Locally | PyTorch
Anaconda 镜像使用帮助
使用 pip 安装 TensorFlow
ubuntu20.04安装12.2版本的cuda_cuda12.2-CSDN博客
【Linux】Ubuntu 20.04 深度学习 GPU 环境配置(CUDA Toolkit 11.7 + cuDNN v8.4.1)_Xavier Jiezou的博客-CSDN博客
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。