当前位置:网站首页>NVIDIA三件套环境配置
NVIDIA三件套环境配置
2022-06-27 18:27:00 【51CTO】
对于做深度学习的环境而言,我们需要理顺以下之间的关系。
就比如PyTorch框架,版本越高,对于显卡算力的要求就会越高,显卡算力上去了,CUDA的版本也要跟上去,CUDA版本上去了,驱动版本也要跟上。。。
我个人而言一般会按照高版本的驱动+低版本的CUDA+与CUDA对应的cudnn+与CUDA对应的PyTorch这样的顺序去配置环境。
但是其中会有玄学问题,自行探索!
多百度,都会解决的。
驱动
遇到实在解决不了的问题,最简单的方法就是全部清除干净,重新上路。如果是新电脑第一次配置可以跳过清除操作。
# 卸载CUDA,对应好自己的版本号
sudo /usr/local/cuda-11.1/bin/cuda-uninstaller
sudo
rm
-rf /usr/local/cuda-11.1/
# 卸载驱动
sudo /usr/bin/nvidia-uninstall
sudo apt-get
--purge remove nvidia*
sudo apt-get purge nvidia*
sudo apt-get purge libnvidia*
sudo apt-get autoremove
# 确保不输出任何内容
sudo dpkg
--list |
grep mvidia*
# 确保禁用了开源驱动nouveau,理论上正常安装NVIDIA官方驱动会自动禁用
lsmod |
grep nouveau
# 无输出即代表禁用成功
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
其实CUDA会自带驱动,但是一般都是先装上驱动,再去安装CUDA,在安装CUDA的过程中取消安装CUDA自带的驱动。
当然也可以直接驱动和CUDA一起安装
CUDA
# 下载CUDA,下载run文件,不要deb文件,deb文件会在安装过程中替换掉已安装的驱动
下载地址:https://developer.nvidia.com/cuda-toolkit-archive
# 下载好之后进入到文件所在目录,是一个run后缀的文件,加上执行权限
sudo
chmod a
+x cuda_11.1.0_455.23.05_linux.run
sudo ./cuda_11.1.0_455.23.05_linux.run
# 如果是已经安装好驱动了,记得安装CUDA的时候取消安装驱动
# 安装完成后查看一下环境变量,理论上会自动在末尾添加
sudo
vim ~/.bashrc
# 如果没有,记得自己追加,对应好版本
export
PATH
=/usr/local/cuda-11.0/bin
${PATH:+:
${PATH}
}
export
LD_LIBRARY_PATH
=/usr/local/cuda-11.0/lib64
${LD_LIBRARY_PATH:+:
${LD_LIBRARY_PATH}
}
# 更新环境变量
source ~/.bashrc
# 测试版本
nvcc
-V
#编译并测试设备 deviceQuery:
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo
make
./deviceQuery
#编译并测试带宽 bandwidthTest:
cd ../bandwidthTest
sudo
make
./bandwidthTest
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.

cudnn

# 解压后,进行文件替换
sudo
cp cuda/include/cudnn.h /usr/local/cuda/include
sudo
cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
# 更改权限
sudo
chmod a
+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
# 安装deb包
sudo dpkg
-i libcudnn8_8.0.5.39-1
+cuda11.0_amd64.deb
sudo dpkg
-i libcudnn8-dev_8.0.5.39-1
+cuda11.0_amd64.deb
sudo dpkg
-i libcudnn8-samples_8.0.5.39-1
+cuda11.0_amd64.deb
# 完成后测试
cd /usr/src/cudnn_samples_v8/mnistCUDNN
sudo
make
./mnistCUDNN
# 如图,成功
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.

问题汇总
运行sudo dpkg --list | grep mvidia*还有输出
英伟达的相关包还没删干净,对照输出的还剩的包,挨个删干净。
运行lsmod | grep nouveau无输出,但还提示让禁用
理论上驱动会自行禁用nouveau开源驱动,但玄学问题,你懂的。
Ps:实现更新后再次安装驱动完成后可能会黑屏,稍等一下。再强制重启。
如果无法进入图形界面,Ctrl+Alt+F1切换到字符界面,Ctrl+Alt+F7切换到图形界面
提示缺少gcc g++ make等包
依次安装即可,常见于新系统。
建议安装完成后装一下build-essential依赖包sudo apt-get install build-essential
边栏推荐
- UE4 realizes long press function
- 数智化进入“深水区”,数据治理是关键
- ABAP随笔-面试回忆 望大家 需求不增 人天飙升
- 一场分销裂变活动,不止是发发朋友圈这么简单
- 数仓的字符截取三胞胎:substrb、substr、substring
- ABAP essays - interview memories hope that everyone's demand will not increase and the number of people will soar
- 嵌入式软件开发中必备软件工具
- Source code analysis of golang map concurrent read / write problem
- At 19:00 on Tuesday evening, the 8th live broadcast of battle code Pioneer - how to participate in openharmony's open source contribution in multiple directions
- [debug] platform engineering interface debugging
猜你喜欢

UE4: explanation of build configuration and config

最佳实践:优化Postgres查询性能(下)
![[login interface]](/img/72/d527a5de23aa9da108e405eb6bb39c.png)
[login interface]

数据库日志

一场分销裂变活动,不止是发发朋友圈这么简单

微信iOS版8.0.24更新发布 缓存细分清理上线

429- binary tree (108. convert the ordered array into a binary search tree, 538. convert the binary search tree into an accumulation tree, 106. construct a binary tree from the middle order and post o

database engine

UOS提示输入密码以解锁您的登陆密钥环解决办法

openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
随机推荐
【bug】联想小新出现问题,你的PIN不可用。
Univision hyperinsight: Nuggets' $16.494 billion "gold hoe" in the observable market?
Postman 汉化教程(Postman中文版)
在开发数字藏品时,文博机构该如何把握公益和商业的尺度?如何确保文物数据的安全?
ABAP essay - get new crown data through API
Graylog 新一代日志收集预警系统安装配置
Linux system plays Oracle database multi table query connection query with a smile
Batch insert data using MySQL bulkloader
Rust 所有权进阶 -- 内存管理
UE4 actor Basics
从指令交读掌握函数调用堆栈详细过程
Data intelligence enters the "deep water area", and data governance is the key
Safety is the last word, Volvo xc40 recharge
PyCharm常用功能 - 断点调试
[bug] there is an error uploading the picture (413 request entity too large)
UE4: explanation of build configuration and config
低代码开发平台是什么?为什么现在那么火?
UE4实现长按功能
On the drawing skills of my writing career
MySQL beginner benefits