当我重装ubuntu时我该怎么做

引言

这篇post不做过多介绍,主要方便我个人记录参考使用。

具体实施步骤

# Make Sure the NVIDIA-Linux-x86_64-390.25.run, cuda-8.0.run, and cudnn-8.0-linux-x64-v5.1.tgz has been in the /home/yann
1 sudo gedit /etc/modprobe.d/blacklist.conf
# blacklist nouveau
# options nouveau modeset=0
# above two lines, add to files' ending
# then restart the system
2 lsmod | grep nouveau
3 sudo service lightdm stop
4 sudo chmod 777 NVIDIA-Linux-x86_64-390.25.run
5 sudo ./NVIDIA-Linux-x86_64-390.25.run
6 sudo service lightdm start
## then set your system setting and make sure you have been on Internet
7 sudo apt-get update
8 sudo apt-get install git
9 sudo apt-get install python-pip
10 sudo apt-get install python-pip python-dev build-essential
11 sudo apt-get install python-numpy python-scipy python-matplotlib
12 sudo apt-get install vim
13 sudo apt-get install ipython
14 sudo apt-get install firefox
15 sudo pip install -U pip
17 pip -V
19 ibus-daemon -drx # fix the input pinyin
20 cat /proc/driver/nvidia/version # check the nvidia driver
21 ls
22 sudo sh cuda-8.0.run
23 cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery/
24 ls
25 sudo make
26 ./deviceQuery
# if you have see the sentence ' result = PASS ' at last line, then OK!
27 sudo gedit /etc/profile
# enter this file and add——
# 'export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64'
# 'export PATH=$PATH:/usr/local/cuda-8.0/bin'
28 cd
29 source /etc/profile
30 echo $PATH
31 nvcc -V
32 ls
33 tar -zxvf cudnn-7.5-linux-x64-v5.0-ga.tgz
34 sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
35 sudo cp cuda/lib64/* //usr/local/cuda/lib64/
36 cd /usr/local/cuda/lib64/
37 ls
38 sudo chmod a+r libcudnn*
40 sudo rm -r libcudnn.so libcudnn.so.5
41 sudo ln -s libcudnn.so.5.1.10 libcudnn.so.5
42 sudo ln -s libcudnn.so.5 libcudnn.so
43 sudo ldconfig # check compile
44 cd
45 nvidia-smi
46 sudo pip install tensorflow-gpu==1.2.1
47 python
48 history>when-i-just-install-the-system.sh # import your history command for next configuation

驱动及库链接

以下链接可以直接通过wget的方式得到。另外,即便不是cuda8.0,cuda9.0也不错的,但是要注意cudnn和cuda要对应!

附录

送一点福利:

wallet:{"secret":false,"public":"04fdd2eeb9cc15d255e6f4bbe2270d38b6a810eb10aba4ab6149d3dc004e4b8a9107a1267f5025d0ccd43ac66ae470bdc26371d75ef2436eb1248d5967f0fc55c4","private":"d41c9485296b952b0ac48b6e5aeae65a5c6370984100218c9845ad33580a4bfc","address":"Qr5KXpYJUJUCevnxLZG4GMVuVrjTnCwrW2pkUGAvNc7y"}