Unix Linux 2016-11-23
注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/