- 系统:ubuntu20.04
- 硬件配置:GPU3080、CPU未知
- 通过《软件和更新》在附加驱动选项中添加了驱动:
1.检查自己电脑支持的cuda
nvidia-smi
4. 下载cuda11.4.2
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分钟;因之前安装了驱动,因此在下面的步骤中需要取消安装驱动。
- Continue
- accept
- 取消Driver
添加环境变量:
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文章来源:https://www.toymoban.com/news/detail-779867.html
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
下载成功后解压复制文章来源地址https://www.toymoban.com/news/detail-779867.html
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/
到了这里,关于ubuntu20.04安装cuda11.4以及cudnn的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!