ubuntu2004安装cuda11.7+cuDNN8.6 deb版本

2023-05-16

ubuntu2004安装cuda11.7+cuDNN8.6 deb版本

  • 1.显卡驱动安装
    • 1.1查看驱动版本
  • 2.安装cuda
    • 2.1安装前检查
    • 2.2下载CUDA11.7
    • 2.3安装
    • 2.4设置环境变量
    • 2.5检测
  • 3.cuDNN安装
    • 3.1下载cuDNN8.6
    • 3.2 安装cuDNN8.6 deb
    • 3.3测试cuDNN
    • 3.4问题描述

教程参考扫地的小和尚1

1.显卡驱动安装

为了稳定和不折腾,最好还是装系统推荐的驱动版本吧。
打开设置(software&updates)
选择Additional Drivers
在这里插入图片描述
安装推荐的驱动即可。

1.1查看驱动版本

完成安装后输入

nvidia-smi

进行检测
在这里插入图片描述

2.安装cuda

2.1安装前检查

1.显卡

lspci | grep -i nvidia

输出

08:00.0 VGA compatible controller: NVIDIA Corporation Device 2484 (rev a1)
08:00.1 Audio device: NVIDIA Corporation Device 228b (rev a1)

2.系统

uname -m && cat /etc/*release

输出

x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION=“Ubuntu 20.04.5 LTS”
NAME=“Ubuntu”
VERSION=“20.04.5 LTS (Focal Fossa)”
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME=“Ubuntu 20.04.5 LTS”
VERSION_ID=“20.04”
HOME_URL=“https://www.ubuntu.com/”
SUPPORT_URL=“https://help.ubuntu.com/”
BUG_REPORT_URL=“https://bugs.launchpad.net/ubuntu/”
PRIVACY_POLICY_URL=“https://www.ubuntu.com/legal/terms-and-policies/privacy-policy”
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
3.gcc
gcc --version

输出

gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright © 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2.2下载CUDA11.7

https://developer.nvidia.com/cuda-downloads
选择“Archive of Previous CUDA Releases”
找到与显卡驱动“515.65”对应的的cuda版本cuda_11.7.1_515.65.01_linux.run
在这里插入图片描述
如图,最下面已经给出了安装命令。网络不好,直接复制wget后面的地址用下载器下载。

2.3安装

最后在文件目录右键鼠标打开命令行进行安装

wget https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda_11.7.1_515.65.01_linux.run
sudo sh cuda_11.7.1_515.65.01_linux.run

同意并继续,取消勾选驱动(因为系统已经帮我们装了)
在这里插入图片描述

2.4设置环境变量

安装完成后会有提示

===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-11.7/

Please make sure that

  • PATH includes /usr/local/cuda-11.7/bin
  • LD_LIBRARY_PATH includes /usr/local/cuda-11.7/lib64, or, add /usr/local/cuda-11.7/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.7/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 515.00 is required for CUDA 11.7 functionality to work.
To install the driver using this installer, run the following command, replacing with the name of this run file:
sudo .run --silent --driver

Logfile is /var/log/cuda-installer.log

提示你添加环境变量

sudo gedit ~/.bashrc

或者

vim ~/.bashrc

最后一行添加:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda

保存关闭后,应用一下更改

source ~/.bashrc
sudo ldconfig

2.5检测

nvcc -V

输出:

nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:49:14_PDT_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0

查看你的系统GPU参数, 运行deviceQuery:

/usr/local/cuda/extras/demo_suite/deviceQuery

输出:

/usr/local/cuda/extras/demo_suite/deviceQuery Starting…

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: “NVIDIA GeForce RTX 3070”
CUDA Driver Version / Runtime Version 11.7 / 11.7
CUDA Capability Major/Minor version number: 8.6
Total amount of global memory: 7981 MBytes (8368685056 bytes)
(46) Multiprocessors, (128) CUDA Cores/MP: 5888 CUDA Cores
GPU Max Clock rate: 1830 MHz (1.83 GHz)
Memory Clock rate: 7001 Mhz
Memory Bus Width: 256-bit
L2 Cache Size: 4194304 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 2 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Device supports Compute Preemption: Yes
Supports Cooperative Kernel Launch: Yes
Supports MultiDevice Co-op Kernel Launch: Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 8 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 11.7, CUDA Runtime Version = 11.7, NumDevs = 1, Device0 = NVIDIA GeForce RTX 3070
Result = PASS

3.cuDNN安装

我采用deb安装的,地址如下。需要注册登录NVIDIA。

https://developer.nvidia.com/rdp/cudnn-download

同样Archived cuDNN Releases (不知道11.x啥意思,我没找到11.7的就装了8.6,最后好像成了)

3.1下载cuDNN8.6

cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_amd64.deb
按照官方文档安装

https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installlinux-deb\

文档说了cuDNN前置条件是
1.装了显卡驱动
2.cuda
3.zlib

2.1.3. Installing Zlib
About this task
For Ubuntu users, to install the zlib package, run:
sudo apt-get install zlib1g

2.3.2. Debian Local Installation
Download the Debian local repository installation package. Before issuing the following commands, you must replace X.Y and 8.x.x.x with your specific CUDA and cuDNN versions.
Procedure
1.Navigate to your directory containing the cuDNN Debian local installer file.
2.Enable the local repository.
sudo dpkg -i cudnn-local-repo-${OS}-8.x.x.x_1.0-1_amd64.deb
Or
sudo dpkg -i cudnn-local-repo-${OS}-8.x.x.x_1.0-1_arm64.deb
3.Import the CUDA GPG key.
sudo cp /var/cudnn-local-repo-*/cudnn-local-*-keyring.gpg /usr/share/keyrings/
4.Refresh the repository metadata.
sudo apt-get update
5.Install the runtime library.
sudo apt-get install libcudnn8=8.x.x.x-1+cudaX.Y
6.Install the developer library.
sudo apt-get install libcudnn8-dev=8.x.x.x-1+cudaX.Y
7.Install the code samples and the cuDNN library documentation.
sudo apt-get install libcudnn8-samples=8.x.x.x-1+cudaX.Y

3.2 安装cuDNN8.6 deb

到download目录打开终端,
sudo dpkg -i cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_amd64.deb
提示:

Selecting previously unselected package cudnn-local-repo-ubuntu2004-8.6.0.163.
(Reading database … 206235 files and directories currently installed.)
Preparing to unpack cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_amd64.deb …
Unpacking cudnn-local-repo-ubuntu2004-8.6.0.163 (1.0-1) …
Setting up cudnn-local-repo-ubuntu2004-8.6.0.163 (1.0-1) …

The public cudnn-local-repo-ubuntu2004-8.6.0.163 GPG key does not appear to be installed.
To install the key, run this command:
sudo cp /var/cudnn-local-repo-ubuntu2004-8.6.0.163/cudnn-local-B0FE0A41-keyring.gpg /usr/share/keyrings/

按照官方3.提示输入

sudo cp /var/cudnn-local-repo-ubuntu2004-8.6.0.163/cudnn-local-B0FE0A41-keyring.gpg /usr/share/keyrings/

按照官方4.Refresh the repository metadata

sudo apt-get update

打开路径/var/cudnn-local-repo-ubuntu2004-8.6.0.163/
在这里插入图片描述
按照5.6.7.的步骤输入

sudo apt-get install libcudnn8=8.6.0.163-1+cuda11.8
sudo apt-get install libcudnn8-dev=8.6.0.163-1+cuda11.8
sudo apt-get install libcudnn8-samples=8.6.0.163-1+cuda11.8

这下就OKK了

3.3测试cuDNN

2.4. Verifying the Install on Linux
To verify that cuDNN is installed and is running properly, compile the mnistCUDNN sample located in the /usr/src/cudnn_samples_v8 directory in the Debian file.
Procedure
Copy the cuDNN samples to a writable path.
cp -r /usr/src/cudnn_samples_v8/ $HOME
Go to the writable path.
cd $HOME/cudnn_samples_v8/mnistCUDNN
Compile the mnistCUDNN sample.
make clean && make
Run the mnistCUDNN sample.
./mnistCUDNN
If cuDNN is properly installed and running on your Linux system, you will see a message similar to the following:
Test passed!

3.4问题描述

nvcc warning : The ‘compute_35’, ‘compute_37’, ‘sm_35’, and ‘sm_37’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
https://blog.csdn.net/qq_51182466/article/details/120183001
原因是Makefile中采用了CUDA中的compute capability 3.5、3.7这几种计算能力。而我安装的是CUDA11.7,可能已经将这几种计算能力弃用了。可以用cmake或者GUI进行修改(我不会)
https://zhuanlan.zhihu.com/p/398023201
这个教程教了如何写,其中的SMS ? =35 37 50 52 60很像
因此在HOME/cudnn_samples_v8/mnistCUDNN这个目录的makefile中搜索SMS

#Gencode arguments
#Setting SMS inside samples_common.mk
include …/samples_common.mk

打开HOME/cudnn_samples_v8中的samples_common.mk
最后一行

SMS ?= 37 50 53 60 61 62 $(SMS_VOLTA) $(SMS_AMPERE)
删除37


  1. https://blog.csdn.net/kunhe0512/article/details/125061911
    #Nvidia驱动安装 ↩︎

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ubuntu2004安装cuda11.7+cuDNN8.6 deb版本 的相关文章

随机推荐

  • Win10安装Ubuntu子系统及图形化界面详细教程20210401

    Win10安装Ubuntu子系统及图形化界面详细教程 WSL xff08 Windows Subsystem for Linux xff09 xff0c 顾名思义就是Windows中可以用Linux了 xff0c 当然命令也会丰富更多 xf
  • python在函数中改变外部变量

    python在函数中改变改变外部变量 python在函数中修改变量值的方法 和其他语言不一样 xff0c 传递参数的时候 xff0c python不允许程序员选择采用传值还是传引用 Python参数传递采用的肯定是 传对象引用 的方式 实际
  • Linux在执行命令并将结果赋值给变量

    通过find命令在 etc目录下查找sources list文件 xff0c 将结果赋值给temp变量 temp span class token operator 61 span span class token variable spa
  • MAC去掉更新小红点

    1 打开 系统偏好设置 点击 软件更新 2 取消选择 自动保持我的Mac最新 3 然后点击 高级 按钮 xff0c 取消所有的勾选 4 通过上面步骤设置后 xff0c 发现底部的小红点还在 xff0c 则需打开终端 5 打开终端执行如下代码
  • MQ-2烟雾传感器模块功能实现(STM32)

    认识MQ 2模块与其工作原理 MQ 2型烟雾传感器属于二氧化锡半导体气敏材料 xff0c 属于表面离子式N型半导体 当处于200 300摄氏度时 xff0c 二氧化锡吸附空气中的氧 xff0c 形成氧的负离子吸附 xff0c 使半导体中的电
  • [编程题]提取不重复的整数

    Talk is cheap show me the code 一 问题描述 输入一个int型整数 xff0c 按照从右向左的阅读顺序 xff0c 返回一个不含重复数字的新的整数 输入描述 xff1a 输入一个int型整数 输出描述 xff1
  • [编程题]判断两个IP是否属于同一子网

    Talk is cheap show me the code 一 问题描述 子网掩码是用来判断任意两台计算机的IP地址是否属于同一子网络的根据 二 问题分析 这道题又是一道坑题 xff0c 题意没描述清楚 xff0c 首先判断一个ip或者m
  • centos7永久关闭防火墙

    首先输入用户名和密码进入centos7 接着先是看centos7的防火墙的状态 xff0c 查看的命令为 sudo systemctl status firewalld 查看后 xff0c 看到active running 就意味着防火墙打
  • ubuntu系统安装Go和liteide及环境配置

    大家好 xff0c 我是加摩斯 xff0c 觉得文章有帮助的小伙伴 xff0c 记得一键三连哟 xff5e 申明 xff1a 原创 xff0c 转载前请与我沟通 搭建环境是编程中最基本的工作 xff0c 但有时方法不对 xff0c 也会踩到
  • OVS的作用OVS 总体架构、源码结构及数据流程全面解析

    为什么要有OVS 1 xff09 方便网络管理与监控 OVS 的引入 xff0c 可以方便管理员对整套云环境中的网络状态和数据流量进行监控 xff0c 比如可以分析网络中流淌的数据包是来自哪个 VM 哪个 OS 及哪个用户 xff0c 这些
  • LATEX——两张图并列排列/双栏模板中图片通栏并列布局

    LATEX 两张图并列排列 双栏模板中图片通栏并列布局 正常插入图片并列插入两张图片双栏模板中图片通栏并列布局1 不同图片使用不同标题 xff0c 不同编号 双栏模板中图片通栏并列布局2 xff08 不同图片使有不同的小标题 xff0c 但
  • SUMO输出文件设置

    1 fcd浮动车数据输出 轨迹数据输出 sumo c demo sumocfg fcd output fcd1 xml 2 设置E3检测器 E3检测器简介 Multi Entry Exit Detectors xff08 E3 xff09
  • 私有地址

    私有地址 xff08 Private address xff09 属于非注册地址 xff0c 专门为组织机构内部使用 以下表列出留用的内部寻址地址 A类 10 0 0 0 10 255 255 255 B类 172 16 0 0 172 3
  • apereo CAS Server 6.2.x 和 6.4.x 的部署

    代码地址 xff0c 分别下载6 2和6 4两个版本 https github com apereo cas overlay template 版本地址 xff1a https github com apereo cas overlay t
  • 微信小程序学习第九课:总结JS页面 radio (单选)向后台传值

    1 data里增加 dengji 0 dengjiitems name 34 优 34 value 34 1 34 name 34 良 34 value 34 0 34 34 checked 34 39 true 39 name 34 中
  • 微信小程序WXSS加虚线

    cartLeft width 50 height 100rpx border right 1rpx dashed a7a8a8
  • 没见过这么恶心的,钉钉开发同一个ip只能被一个企业使用

    关键是把另外一个企业的IP改了 xff0c 还是提示 xff01 同一个ip只能被一个企业使用 创建企业自建应用 xff0c 提示 同一个ip只能被一个企业使用 xff0c 请您参考以下内容确认 xff1a 1 如果是授权定制服务商开发的应
  • Workbench的服务器公网白名单:

    登录名称 Administrator 64 139 196 54 95 3389 实例id i uf6exzqcieg2y4tvzly1 实例名称 launch advisor 20200109 登录实例失败 xff0c 原因 连接实例 i
  • 【PHP】使用mpdf生成pdf文件

    本文主要需求是将html页面转换为pdf文档 1 安装mpdf工具类 xff08 composer方式 xff09 composer require mpdf mpdf 8 0 3 2 控制器里调用 lt php public functi
  • ubuntu2004安装cuda11.7+cuDNN8.6 deb版本

    ubuntu2004安装cuda11 7 43 cuDNN8 6 deb版本 1 显卡驱动安装1 1查看驱动版本 2 安装cuda2 1安装前检查2 2下载CUDA11 72 3安装2 4设置环境变量2 5检测 3 cuDNN安装3 1下载