ubuntu20.04安装cuda11.4以及cudnn

  1. 系统:ubuntu20.04
  2. 硬件配置:GPU3080、CPU未知
  3. 通过《软件和更新》在附加驱动选项中添加了驱动:

    1.检查自己电脑支持的cuda
bash 复制代码
 nvidia-smi
  1. 下载cuda11.4.2
bash 复制代码
wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run
sudo sh cuda_11.4.2_470.57.02_linux.run

会有卡顿,大概等1分钟;因之前安装了驱动,因此在下面的步骤中需要取消安装驱动。

  1. Continue
  2. accept
  3. 取消Driver


    添加环境变量:
bash 复制代码
gedit ~/.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

测试CUDA

bash 复制代码
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make -j4
./deviceQuery
--------------------------显示-----------------
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 11.4, CUDA Runtime Version = 11.4, NumDevs = 1
Result = PASS

安装CUDNN

https://developer.nvidia.com/cudnn (现在需要先登录才能下载)

下载cudnn-linux-x86_64-8.9.7.29_cuda11-archive.tar.xz

下载成功后解压复制

bash 复制代码
tar zxvf cudnn-11.4-linux-x64-v8.2.4.15.tgz

sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
相关推荐
serve the people1 天前
tensorflow Keras Sequential 模型
人工智能·tensorflow·keras
laocooon5238578861 天前
TensorFlow与 PyTorch有什么关联么
人工智能·pytorch·tensorflow
serve the people1 天前
tensorflow 深度解析 Sequential 模型的创建与层管理
人工智能·python·tensorflow
serve the people2 天前
tensorflow 零基础吃透:创建 tf.sparse.SparseTensor 的核心方法
人工智能·python·tensorflow
serve the people2 天前
tensorflow 零基础吃透:tf.sparse.SparseTensor 与核心 TensorFlow API 的协同使用
人工智能·python·tensorflow
serve the people2 天前
tensorflow 零基础吃透:TensorFlow 张量切片与数据插入(附目标检测 / NLP 实战场景)
目标检测·自然语言处理·tensorflow
serve the people2 天前
tensorflow 零基础吃透:TensorFlow 稀疏张量(SparseTensor)的核心操作
人工智能·tensorflow·neo4j
玖日大大2 天前
TensorFlow 深度解析:从基础到实战的全维度指南
人工智能·python·tensorflow
serve the people3 天前
tensorflow 零基础吃透:RaggedTensor 的不规则形状与广播机制 2
人工智能·python·tensorflow
serve the people3 天前
tensorflow 零基础吃透:TensorFlow 稀疏张量(SparseTensor)的核心用法
人工智能·tensorflow·neo4j