注1:本人新手,文章中不准確的地方,歡迎批評指正
注2:知識儲備應達到Linux入門級水平
一.首先介紹硬件配置
處理器 英特爾 Core i7
主板 華碩工作站主板
顯卡 Nvidia GeForce GT 730
GPU Nvidia Tesla K40c
內存 32 GB
二.裸機安裝ubuntu-14.04.5-desktop-amd64.iso鏡像文件
UltraISo制作U盤啟動盤,安裝即可
三.安裝nvidia驅動和cuda 7.5
很多新手會遇到安裝了nvidia官方驅動之後,reboot系統,會卡在登陸頁面的問題,原因是nvidia驅動和Ubuntu自帶的nouveau顯卡驅動沖突
進入terminal後
1.證明存在GPU
tju@tju-System-Product-Name:/$ lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GK208 [GeForce GT 730] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GK208 HDMI/DP Audio Controller (rev a1)
02:00.0 3D controller: NVIDIA Corporation GK110BGL [Tesla K40c] (rev a1)
2.Linux版本是否支持x86_64
tju@tju-System-Product-Name:/$ uname -m && cat /etc/*release
x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.5 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
3.看gcc是否安裝
tju@tju-System-Product-Name:/$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4.看是否存在已安裝的nvidia驅動,如果存在應先卸載
tju@tju-System-Product-Name:/$ lsmod | grep nvidia
tju@tju-System-Product-Name:/$
5.看是否存在已安裝的草根驅動nouveau
tju@tju-System-Product-Name:/$ lsmod | grep nouveau
nouveau 1474560 4
ttm 94208 1 nouveau
drm_kms_helper 143360 2 i915_bpo,nouveau
drm 360448 8 ttm,i915_bpo,drm_kms_helper,nouveau
mxm_wmi 16384 1 nouveau
i2c_algo_bit 16384 2 i915_bpo,nouveau
wmi 20480 3 mxm_wmi,nouveau,asus_wmi
video 40960 3 i915_bpo,nouveau,asus_wmi
6.關閉圖形界面X-Win界面
sudo stop lightdm
7.進入1命令通道
8.進入黑名單目錄
cd /etc/modprobe.d/
9.創建blacklist-nouveau.conf並添加內容
sudo touch blacklist-nouveau.conf
sudo echo "blacklist nouveau">>blacklist-nouveau.conf
sudo echo "options nouveau modeset=0">>blacklist-nouveau.conf
10.查看blacklist-nouveau.conf內容是否添加成功
sudo cat blacklist-nouveau.conf
11.更新blacklist
update initramfs -u
12.重啟
sudo shutdown -r now
13.查看驅動是否還存在
lsmod | grep nouveau
14.找到apt存放deb文件的位置
tju@tju-System-Product-Name:~/桌面$ cd /var/cache/apt/archives/
tju@tju-System-Product-Name:/var/cache/apt/archives$ ls
有很多*.deb文件就對了
15.獲取移動復制文件的權限,把事先在nvidia官網下好的cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb拷貝進去
root@tju-System-Product-Name:/var/cache/apt/archives# sudo nautilus
ctrl+z跳出
16.安裝cuda
sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda
17.查看驅動
tju@tju-System-Product-Name:~$ lsmod | grep nvidia
nvidia_uvm 724992 0
nvidia_drm 45056 2
nvidia_modeset 765952 4 nvidia_drm
nvidia 11489280 81 nvidia_modeset,nvidia_uvm
drm_kms_helper 143360 2 i915_bpo,nvidia_drm
drm 360448 6 i915_bpo,drm_kms_helper,nvidia_drm
18.檢查安裝情況
tju@tju-System-Product-Name:~$ nvidia-smi
Wed Nov 23 11:02:20 2016
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 367.57 Driver Version: 367.57 |
|-------------------------------+----------------------+----------------------+
| 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 GT 730 Off | 0000:01:00.0 N/A | N/A |
| 20% 27C P8 N/A / N/A | 163MiB / 979MiB | N/A Default |
+-------------------------------+----------------------+----------------------+
| 1 Tesla K40c Off | 0000:02:00.0 Off | Off |
| 23% 29C P8 19W / 235W | 0MiB / 12204MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 Not Supported |
+-----------------------------------------------------------------------------+
安裝完成
參考文獻:
1.http://www.cnblogs.com/whenever/p/5631325.html
2.http://blog.csdn.net/lu597203933/article/details/46742199/
http://xxxxxx/Linuxjc/1174500.html TechArticle