深度学习环境:ubuntu18.04+1080ti+cuda9.0+tensorflow1.11

0.ubuntu18.04系统,分区方案:

/swap 4096M, 剩下的全部给 根目录 /,即boot,temp,home共享全盘资源。此问题可以良好的解决安装cuda、matlab等环境时tmp不够用的问题。

1.更换apt源:

sudo vim /etc/apt sources.list

此前可以先备份,用cp命令或者直接复制到外面。

将里面的内容换成:

deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

2.cuda driver: sudo ubuntu-drivers autoinstall

3.gcc:  后面的数字代表优先级,系统会选择优先级高的作为默认版本。

sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 48
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 48

4.cuda9.0:

download 官网路径:cuda9.0 -> linux -> x86_64 -> Ubuntu -> 16.04 -> runfile[local]

$sudo sh cuda_9.0.176_384.81_linux.run

选项顺序:accept yes  no  yes yes

添加系统环境路径

$ sudo vim  ~/.bashrc                 #打开配置文件,如果没安装vim,可执行 
$ sudo apt-get install vim  #安装vim
export PATH=/usr/local/cuda-9.0/bin:$PATH   
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH
$source ~/.bashrc

5.cudnn:

从官网下载cuda9.0对应的版本。

tar -zxvf cudnn-9.0-linux-x64-v7.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/ -d
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

6.tensorflow:

sudo apt-get install python-pip(这边要换个pip源,可参考之前配Windows环境的文章)

pip3 install tensorflow-gpu

7.测试:这里不知道为什么装在Python2下有些问题,最好用pip3安装到Python3下就好了。。。

你可能感兴趣的:(深度学习环境:ubuntu18.04+1080ti+cuda9.0+tensorflow1.11)