2080ti+ubuntu18.04+nvidia410.93+cuda10+cudnn7.3.1+tensorflow1.12+mxnet-cu100

一 安装nvidia驱动410.93
1.禁止nouveau驱动

$ sudo vi /etc/modprobe.d/blacklist.conf  写入下面5行代码,保存并退出 
blacklist nouveau 
blacklist lbm-nouveau 
options nouveau modeset=0 
alias nouveau off 
alias lbm-nouveau off
$ echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
$ sudo update-initramfs -u
$ sudo reboot
$ ls mod | grep nouveau

2.开始安装nvidia驱动

$ sudo apt install gcc make  //提前配置清华源
$ sudo init 3

按ctrl + alt+ F1 进入tty模式

$ sudo service lightdm stop 
$ sudo init 3
$ chmod +x NVIDIA-Linux-x86_64-410.93.run 
$ sudo sh ./NVIDIA-Linux-x86_64-410.93.run --no-opengl-files

“continue installation”+“no”

$ nvidia-smi 

二 安装cuda10

$ sudo sh cuda_10.0.130_410.48_linux.run

不选安装驱动

$ sudo gedit ~/.bashrc    将下面三行代码写入~/.bashrc文件保存后退出
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" 
export CUDA_HOME=/usr/local/cuda 
export PATH=/usr/local/cuda-10.0/bin:$PATH  
$ source ~/.bashrc 
$ nvcc --version 

三 装cudnn7.3.1

$ tar -xzvf cudnn-10.0-linux-x64-v7.3.1.20.tgz
$ sudo cp cuda/include/cudnn.h /usr/local/cuda/include 
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 
$ sudo chmod +r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn* 
$ cd /usr/local/cuda/lib64
$ sudo ln -sf libcudnn.so.7.3.1 libcudnn.so.7
$ sudo ln -sf libcudnn.so.7 libcudnn.so
$ ll
$ sudo vi /etc/ld.so.conf.d/cuda.conf    将下面一行写入文件
/usr/local/cuda/lib64
$ sudo ldconfig   

四 装python3.6.4

$ sudo apt-get install gcc make zlib1g-dev
$ sudo apt-get install libbz2-dev
$ sudo apt-get install libsqlite3-dev
$ sudo apt-get install python3-dev libxml2-dev libffi-dev libssl-dev libxslt1-dev
$ tar -zxvf Python-3.6.4.tgz 
$ mv Python-3.6.4 /usr/local 
$ cd /usr/local/Python-3.6.4/ 
$ ./configure 
$ make
$ make install 
$ ll /usr/bin | grep python 
$ rm -rf /usr/bin/python 
$ ln -s /usr/local/bin/python3.6 /usr/bin/python 
$ python -V
$ cd /usr/bin
$ sudo mv pip pip2  
$ sudo ln -s /usr/local/bin/pip3 /usr/bin/pip
$ pip --version

五 装openmpi-2.0.0

$ tar -zxvf openmpi-2.0.0.tar.gz
$ cd openmpi-2.0.0
$ ./configure --prefix="/usr/local/openmpi"
$ make
$ sudo make install
$ sudo gedit ~/.bashrc  //写入下面两行,这两行需添加在原路径的后面
export PATH="$PATH:/usr/local/openmpi/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/openmpi/lib/"
$ sudo ldconfig

六 装tensorflow-1.12和mxnet-cu100
pip安装不支持cuda10版tensorflow,去github搜 tensorflow wheel 下载大神编译的tensorflow.

注意:千万不要自己编译,会累死的,珍惜生命,远离编译.
$ sudo pip install tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl
$ sudo pip install mxnet-cu100

若ubuntu16.04安装报错:ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version GLIBCXX_3.4.22 not found (required by /usr/local/lib/python3.6/site-packages/tensorflow/python/../libtensorflow_framework.so)
ImportError: /lib/x86_64-linux-gnu/libm.so.6: version GLIBC_2.27 not found (required by /usr/local/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)
解决:升级ubuntu18.04系统

附:
卸载 cuda9.0及cudnn

$ sudo /usr/local/cuda-9.0/bin/uninstall_cuda_9.0.pl
$ sudo rm -rf /usr/local/cuda-9.0

你可能感兴趣的:(linux,tensorflow,mxnet)