Ubuntu 16.04+Nvidia GTX 1080+CUDA8.0 深度学习环境配置

GTX1080主机准备好之后,就是配置深度学习环境了,这里选择了比较熟悉Ubuntu系统,不过是最新的Ubuntu 16.04版本,另外在Nvidia GTX1080的基础上安装相关GPU驱动,外加CUDA8.0,因为都比较新,所以踩了很多坑。

1. 安装Ubuntu16.04

不考虑双系统,直接安装 Ubuntu16.04,从 Ubuntu官方 下载64位版本: ubuntu-16.04-desktop-amd64.iso 。

在MAC下制作了 Ubuntu USB 安装盘,具体方法可参考: 在MAC下使用ISO制作Linux的安装USB盘 ,之后通过Bios引导U盘启动安装Ubuntu系统:

1)一开始安装就踩了一个坑,选择”Install Ubuntu”回车后过一会儿屏幕显示“输入不支持”,google了好多方案,最终和ubuntu对显卡的支持有关,需要手动添加显卡选项: nomodeset,使其支持Nvidia系列显卡,参考: Ubuntu安装时出现黑屏问题的解决 or How do I set ‘nomodeset’ after I’ve already installed Ubuntu?

2) 磁盘分区,全部干掉之前主机自带的Window 10系统,分区为 /boot, /, /home 等几个目录,同时把第二块4T硬盘也挂载了上去,作为数据盘。

3)安装完毕后Ubuntu 16.04的分辨率很低,在显卡驱动未安装之前,可以手动修改一下grub文件:

sudo vim /etc/default/grub

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo’
#GRUB_GFXMODE=640×480
# 这里分辨率自行设置
GRUB_GFXMODE=1024×768

sudo update-grub

4)安装SSH Server,这样可以远程ssh访问这台GTX1080主机:

sudo apt-get install openssh-server

5)更新Ubuntu16.04源,用的是 中科大的源

cd /etc/apt/
sudo cp sources.list sources.list.bak
sudo vi sources.list

把下面的这些源添加到source.list文件头部:

deb xenial main restricted universe multiverse
deb xenial-security main restricted universe multiverse
deb xenial-updates main restricted universe multiverse
deb xenial-proposed main restricted universe multiverse
deb xenial-backports main restricted universe multiverse
deb-src xenial main restricted universe multiverse
deb-src xenial-security main restricted universe multiverse
deb-src xenial-updates main restricted universe multiverse
deb-src xenial-proposed main restricted universe multiverse
deb-src xenial-backports main restricted universe multiverse

最后更新源和更新已安装的包:

sudo apt-get update
sudo apt-get upgrade

2. 安装GTX1080驱动

安装 Nvidia 驱动 367.27

sudo add-apt-repository ppa:graphics-drivers/ppa

第一次运行出现如下的警告:

Fresh drivers from upstream, currently shipping Nvidia.

## Current Status

We currently recommend: nvidia361 nvidia-361 , Nvidia’s current long lived branch.
For GeForce 8 and 9 series GPUs use nvidia340nvidia-340
For GeForce 6 and 7 series GPUs use nvidia304nvidia-304

## What we’re working on right now:

– Normal driver updates– Investigating how to bring this goodness to distro on a cadence.

## WARNINGS:

This PPA is currently in testing, you should be experienced with packaging before you dive in here. Give us a few days to sort out the kinks.

Volunteers welcome! See also: https://github.com/mamarley/nvidia-graphics-drivers/


更多信息: https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
按回车继续或者 Ctrl+c 取消添加

回车后继续:

sudo apt-get update
sudo apt-get install nvidia-367
sudo apt-get install mesa-common-dev
sudo apt-get install freeglut3-dev

之后重启系统让GTX1080显卡驱动生效。

3. 下载和安装CUDA

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/14504.html