debian10安装gpu版pytorch
1)安装cuda驱动
查看cuda版本,如果机器上cuda正常安装了驱动
# 查看驱动
nvidia-smi
正常安装了结果如下,可以看到版本是10.1
,否则需要sudo apt-get install nvidia-cuda-toolkit
进行安装。
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.152.00 Driver Version: 418.152.00 CUDA Version: 10.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 750 Ti On | 00000000:03:00.0 On | N/A |
| 40% 24C P8 1W / 38W | 53MiB / 2000MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 915 G /usr/lib/xorg/Xorg 20MiB |
| 0 969 G /usr/bin/gnome-shell 29MiB |
+-----------------------------------------------------------------------------+
2)安装pytorch
首先,配置清华源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
然后,在官网查看对应10.1
版本的pytorch
必须把-c去掉,否则安装pytorch不会从清华源安装,而是从默认源安装,非常慢!
conda install pytorch torchvision torchaudio cudatoolkit=10.1 pytorch
3)安装完成