【Linux】Ubuntu16安装cuda11 cudnn和已有cuda10.1共存
这里写目录标题一、当前情况二、显卡驱动安装2.1 查看驱动是否满足2.2 安装驱动三、安装cuda cudnn3.1 下载cuda3.2 安装cuda3.3 下载cudnn3.4 安装cudnn3.5 配置环境变量一、当前情况当前系统显卡驱动执行nvidia-smi,显卡驱动为450.57显卡型号显示不全,执行lspci | grep -i nvidia在链接输入返回的型号跳转后,显示为RTX 2
这里写目录标题
一、当前情况
- 当前系统显卡驱动
执行nvidia-smi
,显卡驱动为450.57
- 显卡型号
显示不全,执行lspci | grep -i nvidia
在链接输入返回的型号
跳转后,显示为RTX 2080Ti
- nvcc -V查看cuda版本为10.1
二、显卡驱动安装
2.1 查看驱动是否满足
显卡驱动与cuda版本对应关系表查询自己的显卡驱动是否需要更新
2.2 安装驱动
点击链接进行驱动选择
这里暂不安装,因为版本够了,驱动安装参考
三、安装cuda cudnn
3.1 下载cuda
点击链接选择版本,可本地下载好后上传到服务器
3.2 安装cuda
- 执行
ls
查看,显示已有下载好的安装包 - 执行
sudo sh cuda**
执行安装 - 等待弹出如下界面,同意
- 回车取消勾选第一个,即显卡驱动,因为已有了,然后回车Install
6. 安装成功后
可以查看到安装的包存在于/usr/local/cuda-11.0,且已有的cuda-10.1存在于平行目录下
3.3 下载cudnn
点击链接选择并下载,我选择的是v8.0.5 cuda11.0 根据情况选择
提示:需要进行注册登录才可以下载,可使用谷歌邮箱注册.
3.4 安装cudnn
执行tar -xvf cudnn-11.1-linux-x64-v8.0.4.30.tgz
解压
依次执行
sudo cp cuda/include/cudnn.h /usr/local/cuda-11.0/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-11.0/lib64/
sudo chmod a+r /usr/local/cuda-11.0/include/cudnn.h
完成安装
3.5 配置环境变量
vi ~/.bashrc
最后面添加或编辑已有代码为如下两行
export PATH="/usr/local/cuda-11.0/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-11.0/lib64:$LD_LIBRARY_PATH"
设置完成后,执行source ~/.bashrc
即可完成配置,如想使用cuda10.1,只要将对应的cuda-11.0改回cuda-10.1即可
成功后输入nvcc -V
,返回如下
四、安装tensorrtx依赖
本节安装出错,无效
4.1 下载
点击链接下载对应的包
下载后上传至服务器
4.2 安装
执行sudo dpkg -i nv-tensorrt-repo-ubuntu1604-cuda11.0-trt7.2.3.4-ga-20210226_1-1_amd64.deb
执行sudo apt-key add /var/nv-tensorrt-repo-ubuntu1604-cuda11.0-trt7.2.3.4-ga-20210226/7fa2af80.pub
执行sudo apt update
执行sudo apt install tensorrt
出现tensorrt : Depends: libnvinfer7 (= 7.2.3-1+cuda11.0) but it is not going to be installed错误
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
tensorrt : Depends: libnvinfer7 (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvinfer-plugin7 (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvparsers7 (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvonnxparsers7 (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvinfer-bin (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvinfer-dev (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvinfer-plugin-dev (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvparsers-dev (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvonnxparsers-dev (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvinfer-samples (= 7.2.3-1+cuda11.0) but it is not going to be installed
Depends: libnvinfer-doc (= 7.2.3-1+cuda11.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
sudo apt-get update
更新源
sudo apt-get upgrade
与源对比,更新软件
依次用apt-get -y install 包=版本
执行安装
例如 apt-get -y install libnvinfer6=6.0.1-1+cuda10.1
缺什么装什么
更多推荐
所有评论(0)