PyTorch在Ubuntu系统上支持的GPU型号相当广泛,涵盖了从入门级到企业级的各种选择。以下是对支持的GPU型号的详细梳理,以及安装CUDA和PyTorch的推荐步骤,帮助您更好地在Ubuntu系统上配置GPU环境。
PyTorch支持的GPU型号包括:
sudo add-apt-repository ppa:graphics-drivers/ppasudo apt update
sudo apt install -y alsa-utilssudo apt install -y pciutils ubuntu-drivers-common
sudo lspci | grep -i nvidia
sudo ubuntu-drivers devices
sudo apt install nvidia-driver-版本号
sudo reboot
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-wsl-ubuntu.pinsudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.debsudo dpkg -i cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.debsudo cp /var/cuda-repo-wsl-ubuntu-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt get updatesudo apt get -y install cuda
cd /usr/local/cuda-11.8/bin./nvcc -V
conda create -y -n dl-gpu python=3.8
conda activate dl-gpu
conda install pytorch torchvision torchaudio cudatoolkit=11.8 -c pytorch -c conda-forge
请注意,具体的CUDA和PyTorch版本可能会随着新版本的发布而发生变化,建议您在安装时查阅最新的官方文档,以确保兼容性和稳定性。