CUDA环境配置在Ubuntu18

🎬个人简介:一个全栈工程师的升级之路!

📋个人专栏:高性能(HPC)开发基础教程

🎀CSDN主页 发狂的小花

🌄人生秘诀:学习的本质就是极致重复!

目录

[1 NVIDIA CUDA环境配置](#1 NVIDIA CUDA环境配置)

[1.1 NVIDIA GPU Driver 安装配置](#1.1 NVIDIA GPU Driver 安装配置)

[1.2 NVIDIA CUDA 安装配置](#1.2 NVIDIA CUDA 安装配置)

[1.2.1 NVIDIA GPU driver与CUDA 版本对应](#1.2.1 NVIDIA GPU driver与CUDA 版本对应)

[1.2.2 CUAD 安装配置验证](#1.2.2 CUAD 安装配置验证)

[1.3 cuDNN 安装配置](#1.3 cuDNN 安装配置)

[1.3.1 CUDA 与cuDNN 版本对应](#1.3.1 CUDA 与cuDNN 版本对应)

[1.3.2 cuDNN安装配置](#1.3.2 cuDNN安装配置)


1 NVIDIA CUDA环境配置

1.1 NVIDIA GPU Driver 安装配置

step1:you can use "nvidia-detector" to detect nvidia driver for the GPU

step2:you can update and install driver on sodtware&update

step3:you can use "nvidia-smi" to see

step4:you can "reboot" to see.

可能有的错误:

a. /home/hubery/lib/opencv/samples/opencl/opencl-opencv-interop.cpp:26:10: fatal error: CL/cl.h: 没有那个文件或目录

#include <CL/cl.h>

**解决办法:**use "sudo apt install nvidia-opencl-dev " to install opencl

b. ubuntu解决libnvidia-gl-390错误

ubuntu解决libnvidia-gl-390错误

1.2 NVIDIA CUDA 安装配置

CUDA地址点开后,cuda对应平台各个版本下载地址:

CUDA Toolkit Archive | NVIDIA Developer

1.2.1 NVIDIA GPU driver与CUDA 版本对应

CUDA Toolkit Toolkit Driver Version
Linux x86_64 Driver Version Windows x86_64 Driver Version
CUDA 12.4 GA >=550.54.14 >=551.61
CUDA 12.3 Update 1 >=545.23.08 >=546.12
CUDA 12.3 GA >=545.23.06 >=545.84
CUDA 12.2 Update 2 >=535.104.05 >=537.13
CUDA 12.2 Update 1 >=535.86.09 >=536.67
CUDA 12.2 GA >=535.54.03 >=536.25
CUDA 12.1 Update 1 >=530.30.02 >=531.14
CUDA 12.1 GA >=530.30.02 >=531.14
CUDA 12.0 Update 1 >=525.85.12 >=528.33
CUDA 12.0 GA >=525.60.13 >=527.41
CUDA 11.8 GA >=520.61.05 >=520.06
CUDA 11.7 Update 1 >=515.48.07 >=516.31
CUDA 11.7 GA >=515.43.04 >=516.01
CUDA 11.6 Update 2 >=510.47.03 >=511.65
CUDA 11.6 Update 1 >=510.47.03 >=511.65
CUDA 11.6 GA >=510.39.01 >=511.23
CUDA 11.5 Update 2 >=495.29.05 >=496.13
CUDA 11.5 Update 1 >=495.29.05 >=496.13
CUDA 11.5 GA >=495.29.05 >=496.04
CUDA 11.4 Update 4 >=470.82.01 >=472.50
CUDA 11.4 Update 3 >=470.82.01 >=472.50
CUDA 11.4 Update 2 >=470.57.02 >=471.41
CUDA 11.4 Update 1 >=470.57.02 >=471.41
CUDA 11.4.0 GA >=470.42.01 >=471.11
CUDA 11.3.1 Update 1 >=465.19.01 >=465.89
CUDA 11.3.0 GA >=465.19.01 >=465.89
CUDA 11.2.2 Update 2 >=460.32.03 >=461.33
CUDA 11.2.1 Update 1 >=460.32.03 >=461.09
CUDA 11.2.0 GA >=460.27.03 >=460.82
CUDA 11.1.1 Update 1 >=455.32 >=456.81
CUDA 11.1 GA >=455.23 >=456.38
CUDA 11.0.3 Update 1 >= 450.51.06 >= 451.82
CUDA 11.0.2 GA >= 450.51.05 >= 451.48
CUDA 11.0.1 RC >= 450.36.06 >= 451.22
CUDA 10.2.89 >= 440.33 >= 441.22
CUDA 10.1 (10.1.105 general release, and updates) >= 418.39 >= 418.96
CUDA 10.0.130 >= 410.48 >= 411.31
CUDA 9.2 (9.2.148 Update 1) >= 396.37 >= 398.26
CUDA 9.2 (9.2.88) >= 396.26 >= 397.44
CUDA 9.1 (9.1.85) >= 390.46 >= 391.29
CUDA 9.0 (9.0.76) >= 384.81 >= 385.54
CUDA 8.0 (8.0.61 GA2) >= 375.26 >= 376.51
CUDA 8.0 (8.0.44) >= 367.48 >= 369.30
CUDA 7.5 (7.5.16) >= 352.31 >= 353.66
CUDA 7.0 (7.0.28) >= 346.46 >= 347.62
[Table 3 CUDA Toolkit and Corresponding Driver Versions ]

1.2.2 CUAD 安装配置验证

cpp 复制代码
wget https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda_12.1.1_530.30.02_linux.run
sudo sh cuda_12.1.1_530.30.02_linux.run

仅仅安装 CUDA Toolkit 12.1即可,如下安装完成:

增加环境变量

cpp 复制代码
vi ~/.bashrc

# cuda path
# ln -s /usr/local/cuda-12.1 /usr/local/cuda #建立软链接
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/bin
cpp 复制代码
source ~/.bashrc

验证CUDA安装成功

上述表示安装成功

1.3 cuDNN 安装配置

cudnn下载路径:cuDNN Archive | NVIDIA Developer

1.3.1 CUDA 与cuDNN 版本对应

Download cuDNN v8.9.7 (December 5th, 2023), for CUDA 12.x

Download cuDNN v8.9.7 (December 5th, 2023), for CUDA 11.x

Download cuDNN v8.9.6 (November 1st, 2023), for CUDA 12.x

Download cuDNN v8.9.6 (November 1st, 2023), for CUDA 11.x

Download cuDNN v8.9.5 (October 27th, 2023), for CUDA 12.x

Download cuDNN v8.9.5 (October 27th, 2023), for CUDA 11.x

Download cuDNN v8.9.4 (August 8th, 2023), for CUDA 12.x

Download cuDNN v8.9.4 (August 8th, 2023), for CUDA 11.x

Download cuDNN v8.9.3 (July 11th, 2023), for CUDA 12.x

Download cuDNN v8.9.3 (July 11th, 2023), for CUDA 11.x

Download cuDNN v8.9.2 (June 1st, 2023), for CUDA 12.x

Download cuDNN v8.9.2 (June 1st, 2023), for CUDA 11.x

Download cuDNN v8.9.1 (May 5th, 2023), for CUDA 12.x

Download cuDNN v8.9.1 (May 5th, 2023), for CUDA 11.x

Download cuDNN v8.9.0 (April 11th, 2023), for CUDA 12.x

Download cuDNN v8.9.0 (April 11th, 2023), for CUDA 11.x

Download cuDNN v8.8.1 (March 8th, 2023), for CUDA 12.x

Download cuDNN v8.8.1 (March 8th, 2023), for CUDA 11.x

Download cuDNN v8.8.0 (February 7th, 2023), for CUDA 12.0

Download cuDNN v8.8.0 (February 7th, 2023), for CUDA 11.x

Download cuDNN v8.7.0 (November 28th, 2022), for CUDA 11.x

Download cuDNN v8.7.0 (November 28th, 2022), for CUDA 10.2

Download cuDNN v8.6.0 (October 3rd, 2022), for CUDA 11.x

Download cuDNN v8.6.0 (October 3rd, 2022), for CUDA 10.2

Download cuDNN v8.5.0 (August 8th, 2022), for CUDA 11.x

Download cuDNN v8.5.0 (August 8th, 2022), for CUDA 10.2

Download cuDNN v8.4.1 (May 27th, 2022), for CUDA 11.x

Download cuDNN v8.4.1 (May 27th, 2022), for CUDA 10.2

Download cuDNN v8.4.0 (April 1st, 2022), for CUDA 11.x

Download cuDNN v8.4.0 (April 1st, 2022), for CUDA 10.2

Download cuDNN v8.3.3 (March 18th, 2022), for CUDA 11.5

Download cuDNN v8.3.3 (March 18th, 2022), for CUDA 10.2

Download cuDNN v8.3.2 (January 10th, 2022), for CUDA 11.5

Download cuDNN v8.3.2 (January 10th, 2022), for CUDA 10.2

Download cuDNN v8.3.1 (November 22nd, 2021), for CUDA 11.5

Download cuDNN v8.3.1 (November 22nd, 2021), for CUDA 10.2

Download cuDNN v8.3.0 (November 3rd, 2021), for CUDA 11.5

Download cuDNN v8.3.0 (November 3rd, 2021), for CUDA 10.2

Download cuDNN v8.2.4 (September 2nd, 2021), for CUDA 11.4

Download cuDNN v8.2.4 (September 2nd, 2021), for CUDA 10.2

Download cuDNN v8.2.2 (July 6th, 2021), for CUDA 11.4

Download cuDNN v8.2.2 (July 6th, 2021), for CUDA 10.2

Download cuDNN v8.2.1 (June 7th, 2021), for CUDA 11.x

Download cuDNN v8.2.1 (June 7th, 2021), for CUDA 10.2

Download cuDNN v8.2.0 (April 23rd, 2021), for CUDA 11.x

Download cuDNN v8.2.0 (April 23rd, 2021), for CUDA 10.2

Download cuDNN v8.1.1 (Feburary 26th, 2021), for CUDA 11.0,11.1 and 11.2

Download cuDNN v8.1.1 (Feburary 26th, 2021), for CUDA 10.2

Download cuDNN v8.1.0 (January 26th, 2021), for CUDA 11.0,11.1 and 11.2

Download cuDNN v8.1.0 (January 26th, 2021), for CUDA 10.2

Download cuDNN v8.0.5 (November 9th, 2020), for CUDA 11.1

Download cuDNN v8.0.5 (November 9th, 2020), for CUDA 11.0

Download cuDNN v8.0.5 (November 9th, 2020), for CUDA 10.2

Download cuDNN v8.0.5 (November 9th, 2020), for CUDA 10.1

Download cuDNN v8.0.4 (September 28th, 2020), for CUDA 11.1

Download cuDNN v8.0.4 (September 28th, 2020), for CUDA 11.0

Download cuDNN v8.0.4 (September 28th, 2020), for CUDA 10.2

Download cuDNN v8.0.4 (September 28th, 2020), for CUDA 10.1

Download cuDNN v8.0.3 (August 26th, 2020), for CUDA 11.0

Download cuDNN v8.0.3 (August 26th, 2020), for CUDA 10.2

Download cuDNN v8.0.3 (August 26th, 2020), for CUDA 10.1

Download cuDNN v8.0.2 (July 24th, 2020), for CUDA 11.0

Download cuDNN v8.0.2 (July 24th, 2020), for CUDA 10.2

Download cuDNN v8.0.2 (July 24th, 2020), for CUDA 10.1

Download cuDNN v8.0.1 RC2 (June 26th, 2020), for CUDA 11.0

Download cuDNN v8.0.1 RC2 (June 26th, 2020), for CUDA 10.2

Download cuDNN v7.6.5 (November 18th, 2019), for CUDA 10.2

Download cuDNN v7.6.5 (November 5th, 2019), for CUDA 10.1

Download cuDNN v7.6.5 (November 5th, 2019), for CUDA 10.0

Download cuDNN v7.6.5 (November 5th, 2019), for CUDA 9.2

Download cuDNN v7.6.5 (November 5th, 2019), for CUDA 9.0

Download cuDNN v7.6.4 (September 27, 2019), for CUDA 10.1

Download cuDNN v7.6.4 (September 27, 2019), for CUDA 10.0

Download cuDNN v7.6.4 (September 27, 2019), for CUDA 9.2

Download cuDNN v7.6.4 (September 27, 2019), for CUDA 9.0

Download cuDNN v7.6.3 (August 23, 2019), for CUDA 10.1

Download cuDNN v7.6.3 (August 23, 2019), for CUDA 10.0

Download cuDNN v7.6.3 (August 23, 2019), for CUDA 9.2

Download cuDNN v7.6.3 (August 23, 2019), for CUDA 9.0

Download cuDNN v7.6.2 (July 22, 2019), for CUDA 10.1

Download cuDNN v7.6.2 (July 22, 2019), for CUDA 10.0

Download cuDNN v7.6.2 (July 22, 2019), for CUDA 9.2

Download cuDNN v7.6.2 (July 22, 2019), for CUDA 9.0

Download cuDNN v7.6.1 (June 24, 2019), for CUDA 10.1

Download cuDNN v7.6.1 (June 24, 2019), for CUDA 10.0

Download cuDNN v7.6.1 (June 24, 2019), for CUDA 9.2

Download cuDNN v7.6.1 (June 24, 2019), for CUDA 9.0

Download cuDNN v7.6.0 (May 20, 2019), for CUDA 10.1

Download cuDNN v7.6.0 (May 20, 2019), for CUDA 10.0

Download cuDNN v7.6.0 (May 20, 2019), for CUDA 9.2

Download cuDNN v7.6.0 (May 20, 2019), for CUDA 9.0

Download cuDNN v7.5.1 (April 22, 2019), for CUDA 10.1

Download cuDNN v7.5.1 (April 22, 2019), for CUDA 10.0

Download cuDNN v7.5.1 (April 22, 2019), for CUDA 9.2

Download cuDNN v7.5.1 (April 22, 2019), for CUDA 9.0

Download cuDNN v7.5.0 (Feb 25, 2019), for CUDA 10.1

Download cuDNN v7.5.0 (Feb 21, 2019), for CUDA 10.0

Download cuDNN v7.5.0 (Feb 21, 2019), for CUDA 9.2

Download cuDNN v7.5.0 (Feb 21, 2019), for CUDA 9.0

Download cuDNN v7.4.2 (Dec 14, 2018), for CUDA 10.0

Download cuDNN v7.4.2 (Dec 14, 2018), for CUDA 9.2

Download cuDNN v7.4.2 (Dec 14, 2018), for CUDA 9.0

Download cuDNN v7.4.1 (Nov 8, 2018), for CUDA 10.0

Download cuDNN v7.4.1 (Nov 8, 2018), for CUDA 9.2

Download cuDNN v7.4.1 (Nov 8, 2018), for CUDA 9.0

Download cuDNN v7.3.1 (Sept 28, 2018), for CUDA 10.0

Download cuDNN v7.3.1 (Sept 28, 2018), for CUDA 9.2

Download cuDNN v7.3.1 (Sept 28, 2018), for CUDA 9.0

Download cuDNN v7.3.0 (Sept 19, 2018), for CUDA 10.0

Download cuDNN v7.3.0 (Sept 19, 2018), for CUDA 9.0

Download cuDNN v7.2.1 (August 7, 2018), for CUDA 9.2

Download cuDNN v7.1.4 (May 16, 2018), for CUDA 9.2

Download cuDNN v7.1.4 (May 16, 2018), for CUDA 9.0

Download cuDNN v7.1.4 (May 16, 2018), for CUDA 8.0

Download cuDNN v7.1.3 (April 17, 2018), for CUDA 9.1

Download cuDNN v7.1.3 (April 17, 2018), for CUDA 9.0

Download cuDNN v7.1.3 (April 17, 2018), for CUDA 8.0

Download cuDNN v7.1.2 (Mar 21, 2018), for CUDA 9.1 & 9.2

Download cuDNN v7.1.2 (Mar 21, 2018), for CUDA 9.0

Download cuDNN v7.0.5 (Dec 11, 2017), for CUDA 9.1

Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 9.0

Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 8.0

Download cuDNN v7.0.4 (Nov 13, 2017), for CUDA 9.0

Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0

Download cuDNN v6.0 (April 27, 2017), for CUDA 7.5

Download cuDNN v5.1 (Jan 20, 2017), for CUDA 8.0

Download cuDNN v5.1 (Jan 20, 2017), for CUDA 7.5

Download cuDNN v5 (May 27, 2016), for CUDA 8.0

Download cuDNN v5 (May 12, 2016), for CUDA 7.5

Download cuDNN v4 (Feb 10, 2016), for CUDA 7.0 and later.

Download cuDNN v3 (September 8, 2015), for CUDA 7.0 and later.

Download cuDNN v2 (March 17,2015), for CUDA 6.5 and later.

Download cuDNN v1 (cuDNN 6.5 R1)

1.3.2 cuDNN安装配置

选择与cuda版本匹配的cudnn版本,这里选v8.9.7版本。

选择Local Installer for Linux x86_64 (Tar)

解压cudnn-linux-x86_64-8.9.7.29_cuda12-archive.tar.xz得到

拷贝并执行cudnn代码到cuda中:

cpp 复制代码
cd cudnn-linux-x86_64-8.9.7.29_cuda12-archive
sudo cp -d include/cudnn*.h /usr/local/cuda/include
sudo cp -d lib/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*

验证cuDNN:

cpp 复制代码
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

🌈我的分享也就到此结束啦🌈

如果我的分享也能对你有帮助,那就太好了!

若有不足,还请大家多多指正,我们一起学习交流!

📢未来的富豪们:点赞👍→收藏⭐→关注🔍,如果能评论下就太惊喜了!

感谢大家的观看和支持!最后,☺祝愿大家每天有钱赚!!!欢迎关注、关注!

相关推荐
前端青山2 小时前
Node.js-增强 API 安全性和性能优化
开发语言·前端·javascript·性能优化·前端框架·node.js
青云交8 小时前
大数据新视界 -- 大数据大厂之 Impala 性能优化:应对海量复杂数据的挑战(上)(7/30)
大数据·性能优化·impala·数据分区·查询优化·海量复杂数据·经典案例
chusheng184011 小时前
Python 爬取大量数据如何并发抓取与性能优化
开发语言·python·性能优化
探索云原生19 小时前
GPU 环境搭建指南:如何在裸机、Docker、K8s 等环境中使用 GPU
ai·云原生·kubernetes·go·gpu
XMYX-01 天前
MySQL 性能优化策略:提升响应速度与系统稳定性
mysql·性能优化
一个处女座的程序猿1 天前
AI之硬件对比:据传英伟达Nvidia2025年将推出RTX 5090-32GB/RTX 5080-24GB、华为2025年推出910C/910D
人工智能·gpu
PangPiLoLo1 天前
高可用架构-业务高可用
java·性能优化·架构
尸僵打怪兽2 天前
软考(中级-软件设计师)数据库篇(1101)
数据库·oracle·性能优化·软考
程序猿进阶2 天前
系统上云-流量分析和链路分析
java·后端·阿里云·面试·性能优化·系统架构·云计算
飞腾开发者3 天前
飞腾平台Arm ComputeLibrary编译安装指南
linux·服务器·arm开发·后端·性能优化