Ubuntu22.04.4安装配置CUDA12.5,Cdnn官方详细版本

安装需求如下图

机器raid配置

两块磁盘做raid1,参见官方raid,配置手册

https://www.supermicro.com/support/manuals/

系统下载

https://old-releases.ubuntu.com/releases/22.04/

制作U盘

使用rufus制作,

U盘系统安装

重启按F11,选择U盘,操作步骤截图如下:

获取到ip地址,点击下一步

ubuntu远程登录

后续使用远程登录,远程登录界面如下

安装docker

可在选择系统安装部分,选择勾选docker即可

安装GCC

GCC版本要求参考官方

CUDA Toolkit Documentation 12.5

System Requirements 配置如下

To use NVIDIA CUDA on your system, you will need the following installed:

The CUDA development environment relies on tight integration with the host development environment, including the host compiler and C runtime libraries, and is therefore only supported on distribution versions that have been qualified for this CUDA Toolkit release.

The following table lists the supported Linux distributions. Please review the footnotes associated with the table.

# 安装gcc12

sudo apt  install gcc-12

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12

admin1@admin1:~$ gcc --version

gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0

Copyright (C) 2022 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.

安装Cuda12.5

Cuda官方下载链接

https://developer.nvidia.com/cuda-downloads

安装文档参考官方

CUDA 12.6 Update 1 Release Notes

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin

sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600

wget https://developer.download.nvidia.com/compute/cuda/12.5.0/local_installers/cuda-repo-ubuntu2204-12-5-local_12.5.0-555.42.02-1_amd64.deb

sudo dpkg -i cuda-repo-ubuntu2204-12-5-local_12.5.0-555.42.02-1_amd64.deb

sudo cp /var/cuda-repo-ubuntu2204-12-5-local/cuda-*-keyring.gpg /usr/share/keyrings/

sudo apt-get update

sudo apt-get -y install cuda-toolkit-12-5

 安装GPU驱动

安装命令,最新版

sudo apt-get install -y cuda-drivers

如果你想要安装指定版本,2选1即可

sudo apt-get install -y cuda-drivers-555

安装完毕执行nvidia-smi

安装cudnn

官方下载链接

https://developer.nvidia.com/cudnn-archive

安装文档参考(新版cdnn9.x.x)

NVIDIA cuDNN — NVIDIA cuDNN v9.4.0 documentation

安装文档参考(新版cdnn8.x.x)

Installation Guide :: NVIDIA cuDNN Documentation

deb包安装(适用于新版cdnn9.x.x)

wget https://developer.download.nvidia.com/compute/cudnn/9.4.0/local_installers/cudnn-local-repo-ubuntu2204-9.4.0_1.0-1_amd64.deb

sudo dpkg -i cudnn-local-repo-ubuntu2204-9.4.0_1.0-1_amd64.deb

sudo cp /var/cudnn-local-repo-ubuntu2204-9.4.0/cudnn-*-keyring.gpg /usr/share/keyrings/

sudo apt-get updatesudo apt-get -y install cudnn

  1. To install for CUDA 11, perform the above configuration but install the CUDA 11 specific package:

sudo apt-get -y install cudnn-cuda-11

  1. To install for CUDA 12, perform the above configuration but install the CUDA 12 specific package:

sudo apt-get -y install cudnn-cuda-12

deb包安装(适用于8.x.x)

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.

  1. Navigate to your downloads directory containing the cuDNN Debian local installer file.
  2. Enable the local repository.

sudo dpkg -i cudnn-local-repo-${distro}-8.x.x.x_1.0-1_amd64.deb

or

sudo dpkg -i cudnn-local-repo-${distro}-8.x.x.x_1.0-1_arm64.deb

Import the CUDA GPG key.

sudo cp /var/cudnn-local-repo-*/cudnn-local-*-keyring.gpg /usr/share/keyrings/

Refresh the repository metadata.

sudo apt-get update

Install the runtime library.

sudo apt-get install libcudnn8=8.x.x.x-1+cudaX.Y

Install the developer library.

sudo apt-get install libcudnn8-dev=8.x.x.x-1+cudaX.Y

Install the code samples.

sudo apt-get install libcudnn8-samples=8.x.x.x-1+cudaX.Y

tar包安装

Before issuing the following commands, you must replace X.Y and v8.x.x.x with your specific CUDA and cuDNN versions and package date.

  1. Navigate to your <cudnnpath> directory containing the cuDNN tar file.
  2. Unzip the cuDNN package.

 tar -xvf cudnn-linux-x86_64-8.x.x.x_cudaX.Y-archive.tar.xz

Copy the following files into the CUDA toolkit directory.

sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include

sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64

sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*

安装fabricmanager

官方文档链接如下

1. Overview — Fabric Manager for NVIDIA NVSwitch Systems r560 documentation

Note  In the following commands, <driver-branch> should be substituted with the required NVIDIA driver branch number for qualified data center drivers (for example, 560).

  • For Debian and Ubuntu based OS distributions:

sudo apt-get install -V nvidia-open-<driver-branch>

sudo apt-get install -V nvidia-fabricmanager-<driver-branch> nvidia-fabricmanager-dev-<driver-branch>

安装nvidia- container-toolkit

官方安装文档

Installing the NVIDIA Container Toolkit — NVIDIA Container Toolkit 1.16.2 documentation

Installing with AptConfigure the production repository:

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \

&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \

sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \

sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

Optionally, configure the repository to use experimental packages:

sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list

Update the packages list from the repository:

sudo apt-get update

Install the NVIDIA Container Toolkit packages:

sudo apt-get install -y nvidia-container-toolkit

### 关于CUDA 12.5与TensorFlow的兼容性 TensorFlow对于CUDA的支持通常依赖其官方发布的版本说明文档。在最新的TensorFlow版本中,支持的CUDA版本可能并不总是最新发布的大版本号[^3]。例如,在撰写本文时,TensorFlow稳定版推荐使用的CUDA版本通常是较旧的长期支持版本(如CUDA 11.x系列)。然而,随着NVIDIA不断更新CUDA工具包以及TensorFlow自身的迭代开发,更高版本CUDA可能会逐渐被纳入支持范围。 #### 配置指南 为了成功配置CUDA 12.5与TensorFlow,请遵循以下指导原则: 1. **确认硬件环境** 确保计算机中的GPU设备满足CUDA 12.5的要求,并验证驱动程序已升级至对应最低需求版本。这一步骤可以通过运行`nvidia-smi`命令来完成检查[^4]。 2. **选择匹配的TensorFlow分支** 如果计划使用CUDA 12.5,则需寻找基于源码编译或者预构建二进制文件形式提供的实验性质TensorFlow nightly builds或其他社区维护版本[^5]。这些版本更有可能提前集成对新特性或库的支持能力。 3. **安装必要的组件** 下载并安装完整的CUDA Toolkit v12.5及其附属cuDNN SDK库。注意两者之间存在严格的版本绑定关系;查阅[NVIDIA cuDNN Archive](https://developer.nvidia.com/cudnn)页面获取适配表单信息[^6]。 4. **调整环境变量设置** 修改操作系统级别的PATH与LD_LIBRARY_PATH路径参数,使得Python解释器能够定位到刚部署完毕的新版CUDA动态链接库位置。 ```bash export PATH=/usr/local/cuda-12.5/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-12.5/lib64:$LD_LIBRARY_PATH ``` 5. **测试验证安装成果** 执行一段简单的脚本以加载目标框架模块实例化模型对象执行推理操作,从而判断整个链条是否正常运作无误。 ```python import tensorflow as tf print(tf.config.list_physical_devices('GPU')) ``` 如果上述过程顺利完成且返回至少一个可用物理GPU资源列表项,则表明当前系统环境下CUDA 12.5已经可以协同工作于选定版本的TensorFlow之上[^7]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT杂物铺

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值