当前位置: 首页 > article >正文

ubuntu 20.04 NVIDIA驱动、cuda、cuDNN安装

1. NVIDIA驱动

系统设置->软件和更新->附加驱动->选择NVIDIA驱动->应用更改。该界面会自动根据电脑上的GPU显示推荐的NVIDIA显卡驱动。
请添加图片描述
运行nvidia-smi:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

1.1 使用nvcc -V检查驱动和cuda:

Command 'nvcc' not found, but can be installed with:

sudo apt install nvidia-cuda-toolkit

运行:

sudo apt install nvidia-cuda-toolkit

再次运行nvcc -V,出现:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

证明驱动是存在的,于是进行下一步。

1.2 检查是否已安装 NVIDIA 驱动:

dpkg -l | grep nvidia

出现

ii  libnvidia-cfg1-535:amd64                    535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-535                        535.183.01-0ubuntu0.20.04.1           all          Shared files used by the NVIDIA libraries
ii  libnvidia-compute-535:amd64                 535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA libcompute package
ii  libnvidia-compute-535:i386                  535.183.01-0ubuntu0.20.04.1           i386         NVIDIA libcompute package
ii  libnvidia-decode-535:amd64                  535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-535:i386                   535.183.01-0ubuntu0.20.04.1           i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-encode-535:amd64                  535.183.01-0ubuntu0.20.04.1           amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-535:i386                   535.183.01-0ubuntu0.20.04.1           i386         NVENC Video Encoding runtime library
ii  libnvidia-extra-535:amd64                   535.183.01-0ubuntu0.20.04.1           amd64        Extra libraries for the NVIDIA driver
ii  libnvidia-fbc1-535:amd64                    535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-535:i386                     535.183.01-0ubuntu0.20.04.1           i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-gl-535:amd64                      535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-gl-535:i386                       535.183.01-0ubuntu0.20.04.1           i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-ml-dev                            10.1.243-3                            amd64        NVIDIA Management Library (NVML) development files
ii  nvidia-compute-utils-535                    535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA compute utilities
ii  nvidia-cuda-dev                             10.1.243-3                            amd64        NVIDIA CUDA development files
ii  nvidia-cuda-doc                             10.1.243-3                            all          NVIDIA CUDA and OpenCL documentation
ii  nvidia-cuda-gdb                             10.1.243-3                            amd64        NVIDIA CUDA Debugger (GDB)
ii  nvidia-cuda-toolkit                         10.1.243-3                            amd64        NVIDIA CUDA development toolkit
ii  nvidia-dkms-535                             535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA DKMS package
ii  nvidia-driver-535                           535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA driver metapackage
ii  nvidia-firmware-535-535.183.01              535.183.01-0ubuntu0.20.04.1           amd64        Firmware files used by the kernel module
ii  nvidia-kernel-common-535                    535.183.01-0ubuntu0.20.04.1           amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-535                    535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA kernel source package
ii  nvidia-opencl-dev:amd64                     10.1.243-3                            amd64        NVIDIA OpenCL development files
ii  nvidia-prime                                0.8.16~0.20.04.2                      all          Tools to enable NVIDIA's Prime
ii  nvidia-profiler                             10.1.243-3                            amd64        NVIDIA Profiler for CUDA and OpenCL
ii  nvidia-settings                             470.57.01-0ubuntu0.20.04.3            amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-535                            535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA driver support binaries
ii  nvidia-visual-profiler                      10.1.243-3                            amd64        NVIDIA Visual Profiler for CUDA and OpenCL
ii  screen-resolution-extra                     0.18build1                            all          Extension for the nvidia-settings control panel
ii  xserver-xorg-video-nvidia-535               535.183.01-0ubuntu0.20.04.1           amd64        NVIDIA binary Xorg driver

说明已安装NVIDIA 驱动。

1.3 查看已安装驱动的版本信息

ls /usr/src | grep nvidia

出现驱动版本信息nvidia-535.183.01

1.4 安装 DKMS 工具,帮助自动重新编译和安装NVIDIA 驱动程序的内核模块

sudo apt-get install dkms

1.5 安装或重新安装特定版本(535.183.01)的 NVIDIA 驱动模块

错误…… 回到第一步,设置更换驱动后一定要重启!!!!或运行命令sudo reboot

1.6 运行sudo reboot后,再次nvidia-smi

请添加图片描述
成功!

2. CUDA

2.1 首先查看cuda是否安装:

运行nvcc -V

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

没有安装cuda。

2.2 参考1

2.3 参考2

2.4 查看CUDA版本

cat /usr/local/cuda/version.txt

2.5 查看cuDNN版本

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

http://www.kler.cn/a/391005.html

相关文章:

  • 24.11.13 Javascript3
  • 普通电脑上安装属于自己的Llama 3 大模型和对话客户端
  • 浅谈C#之内存管理
  • 【深圳大学】数据结构A+攻略(计软版)
  • 使用pytest+openpyxl做接口自动化遇到的问题
  • 第三十六章 Vue之路由重定向/404页面设置/路径模式设置
  • Python 类私化有笔记
  • 【深度学习遥感分割|论文解读2】UNetFormer:一种类UNet的Transformer,用于高效的遥感城市场景图像语义分割
  • 量化交易系统开发-实时行情自动化交易-3.4.2.2.Okex交易数据
  • 从0开始搭建一个生产级SpringBoot2.0.X项目(十三)SpringBoot连接MongoDB
  • 请求接口时跨域问题详细解决方案
  • 前端开发调试之 PC 端调试
  • 使用 `RestTemplate` 获取二进制数据并返回 `byte[]`:解决方案与示例
  • Java 多态 (Polymorphism)详解
  • 智能社区服务小程序+ssm
  • MySQL数据库:SQL语言入门 (学习笔记)
  • ubuntu 20.04添加ros官方的软件源(解决下载ros软件包出现的E 无法定位软件包的问题)
  • ERP学习笔记-预处理eeglab
  • Transformer模型中的位置编码介绍
  • 群晖 Docker 容器文件夹出现未知用户 UID 1000
  • 开源TTS语音克隆神器GPT-SoVITS_V2版本地整合包部署与远程使用生成音频
  • 云计算在教育领域的应用
  • 数据库基础(10) . MySQL函数
  • 【MATLAB源码-第291期】基于matlab的AMI编码解码系统仿真,输出各个节点波形。
  • XML 现实案例:深入解析与应用
  • 斯坦福泡茶机器人DexCap源码解析:涵盖收集数据、处理数据、模型训练三大阶段