環(huán)境ubuntu 18.10
nvidia Geforce 1080ti
python3.7
cuda10
1. 安裝nvidia驅(qū)動(dòng)
選擇安裝型號(hào):https://www.nvidia.com/Download/driverResults.aspx/145182/en-us
官網(wǎng):https://www.nvidia.com/Download/index.aspx?lang=cn
wget后
sudo chmod +x cuda****-run
sudo ./cuda****-run
sudo reboot
開(kāi)機(jī)出現(xiàn)錯(cuò)誤:started bpfilter, 一直無(wú)法進(jìn)入系統(tǒng)
解決參考:
- https://askubuntu.com/questions/1032639/ubuntu-18-04-stuck-in-boot-after-starting-gnome-display-manager-on-intel-graphic
-
https://blog.versun.org/post/ubuntu-18.10kai-ji-chu-xian-started-bpfilter
換了這個(gè)就好了:
Ctrl+Alt+F2 for get terminal & run this after login
sudo apt-get install xdm
sudo dpkg-reconfigure lightdm
也刪了這個(gè):sudo apt-get remove --purge nvidia-*
2. 安裝torch
2.1 conda 安裝
失敗,官方源太慢,卡住了,清華的源2019.4.16停止服務(wù),轉(zhuǎn)pip安裝

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
查看~/.condarc
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true
defaults是官方默認(rèn)的源
conda info 查看是否生效
2.2 pip安裝
國(guó)內(nèi)網(wǎng)速的問(wèn)題,我們直接pip安裝包通常速度非常慢,而且經(jīng)常會(huì)出現(xiàn)裝到一半失敗了的問(wèn)題,既然這樣,我們就要充分利用國(guó)內(nèi)鏡像的力量,節(jié)省時(shí)間,明顯提高pip安裝的效率
- 安裝python3.7環(huán)境
apt-get install python3.7-dev - 更換pip源
更換pip源方法1
pip install pygame -i http://pypi.douban.com/simple
or
pip install pygame -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
更換pip源方法2
sudo gedit ~/.pip/pip.conf,添加以下內(nèi)容
[global]
index-url = [http://pypi.douban.com/simple](http://pypi.douban.com/simple)
[install]
trusted-host=pypi.douban.com
豆瓣(douban) http://pypi.douban.com/simple/
阿里云 http://mirrors.aliyun.com/pypi/simple/
中國(guó)科技大學(xué) https://pypi.mirrors.ustc.edu.cn/simple/
清華大學(xué) https://pypi.tuna.tsinghua.edu.cn/simple/
中國(guó)科學(xué)技術(shù)大學(xué) http://pypi.mirrors.ustc.edu.cn/simple/
查看pip指向
pip3 -V
修改為python3.7
which pip
編輯pip文件:
vim /usr/local/bin/pip修改第一行就好
確認(rèn)pip3使用的是python3.7安裝torch
根據(jù)官網(wǎng)提示安裝:https://pytorch.org/get-started
pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1.post2-cp37-cp37m-linux_x86_64.whl
pip3 install torchvision
查看顯卡使用情況
Linux查看Nvidia顯卡信息及使用情況
Nvidia自帶一個(gè)命令行工具可以查看顯存的使用情況:
nvidia-smi

表頭釋義:
Fan:顯示風(fēng)扇轉(zhuǎn)速,數(shù)值在0到100%之間,是計(jì)算機(jī)的期望轉(zhuǎn)速,如果計(jì)算機(jī)不是通過(guò)風(fēng)扇冷卻或者風(fēng)扇壞了,顯示出來(lái)就是N/A;
Temp:顯卡內(nèi)部的溫度,單位是攝氏度;
Perf:表征性能狀態(tài),從P0到P12,P0表示最大性能,P12表示狀態(tài)最小性能;
Pwr:能耗表示;
Bus-Id:涉及GPU總線(xiàn)的相關(guān)信息;
Disp.A:是Display Active的意思,表示GPU的顯示是否初始化;
Memory Usage:顯存的使用率;
Volatile GPU-Util:浮動(dòng)的GPU利用率;
Compute M:計(jì)算模式;
ref:
https://blog.csdn.net/yucicheung/article/details/79094657#2%E4%BF%AE%E6%94%B9conda%E9%95%9C%E5%83%8F%E6%BA%90
https://blog.csdn.net/dcrmg/article/details/78146797