赞
踩
sudo apt update
sudo apt upgrade
sudo apt install nvidia-driver-530
在安装驱动程序后,重启计算机以应用更改:
sudo reboot
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo apt-key add 7fa2af80.pub
注意:虽然这是Ubuntu 20.04的存储库,但它也适用于Ubuntu 22.04。
接下来,将CUDA存储库添加到您的sources.list.d
目录:
echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list
sudo apt update
然后安装CUDA Toolkit:
sudo apt install nvidia-cuda-dev nvidia-cuda-toolkit
这将安装最新版本的CUDA Toolkit。
PATH
环境变量中。在您的.bashrc
文件中添加以下行:echo "export PATH=/usr/local/cuda/bin:$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH" >> ~/.bashrc
应用更改:
source ~/.bashrc
nvcc --version
如果CUDA已成功安装,您将看到类似以下内容的输出:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on <build_date>
Cuda compilation tools, release <cuda_version>, V<version_number>
此外,运行nvidia-smi
以查看GPU和驱动程序的状态:
nvidia-smi
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。