tensorflow installation guide

ABSTRACT

descripe : tensorflow installation guide
date : 2018.06.06
platform : NVIDIA GeForce 1080Ti
version : ubuntu - 16.04 LTS
NVIDIA-driver - 384.13
CUDA - 9.0
cuDNN - 7.1.2
tensorflow - 1.8

==========================

STEP I : install nvidia driver

reference : https://blog.csdn.net/u012759136/article/details/53355781

1.  sudo apt-get remove –purge nvidia*
2.  sudo vim /etc/modprobe.d/blacklist.conf
3.  add "blacklist nouveau" at the end of file
4.  sudo update-initramfs -u
5.  sudo reboot
6.  Ctrl+Alt+F1
7.  lsmod | grep nouveau
8.  sudo /etc/init.d/lightdm stop
9.  cd ${nvidia_driver_path}
10. sudo ./NVIDIA-Linux-x86_64-384.13.run
11. sudo reboot

Please run the commands, if the desktop can not login after reboot.
1. cd /usr/share/X11/xorg.conf.d/
2. sudo mv nvidia-drm-outputclass.conf nvidia-drm-outputclass.conf.bak
3. sudo reboot

==========================

STEP II : install CUDA

1. Download CUDA 9.0 at https://developer.nvidia.com/cuda-90-download-archive
   select Linux, x86_64, Ubuntu, 16.04, runfile(local) and download base installer
2. cd ${cuda_9.0_path}
3. sudo ./cuda_9.0.176_384.81_linux.run
4. enter n, y, '\n', y, y, '\n' step by step, like this. ('\n' means enter)

    Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?
    (y)es/(n)o/(q)uit: n

    Install the CUDA 9.0 Toolkit?
    (y)es/(n)o/(q)uit: y

    Enter Toolkit Location
     [ default is /usr/local/cuda-9.0 ]: 

    Do you want to install a symbolic link at /usr/local/cuda?
    (y)es/(n)o/(q)uit: y

    Install the CUDA 9.0 Samples?
    (y)es/(n)o/(q)uit: y

    Enter CUDA Samples Location
     [ default is /home/ai_group ]: 

    Installing the CUDA Toolkit in /usr/local/cuda-9.0 ...
    Missing recommended library: libGLU.so
    Missing recommended library: libX11.so
    Missing recommended library: libXi.so
    Missing recommended library: libXmu.so
    Missing recommended library: libGL.so

    Installing the CUDA Samples in /home/ai_group ...
    Copying samples to /home/ai_group/NVIDIA_CUDA-9.0_Samples now...
    Finished copying samples.

    ===========
    = Summary =
    ===========

    Driver:   Not Selected
    Toolkit:  Installed in /usr/local/cuda-9.0
    Samples:  Installed in /home/ai_group, but missing recommended libraries

5. gedit ./.bashrc
6. add environment path at the end
   export PATH=/usr/local/cuda/bin:$PATH
   export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

==========================

STEP III : install cuDNN

1. Download cuDNN for CUDA 9.0 at https://developer.nvidia.com/rdp/cudnn-archive
2. Extract the cuDNN
3. cd ${cuDNN_extract_folder_path}
4. sudo cp ./include/cudnn.h /usr/local/cuda/include
5. sudo cp ./lib64/libcudnn* /usr/local/cuda/lib64
6. sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

==========================

STEP IV : install tensorflow

1. choose the ailiyun as the default source
2. sudo apt-get update
3. sudo apt-get python3-pip
4. sudo pip3 install --upgrade pip
5. pip3 install tensorflow-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple/

to see other way of installation, visit https://tensorflow.google.cn/install/install_linux

==========================

STEP V : test

1. creat an empty document at desktop named "test.py" and enter the code showed below.

    #!/usr/bin/env python3
    import tensorflow as tf
    hello  = tf.constant('Hello,world!')
    sess   = tf.Session()       # creat a conversation
    result = sess.run(hello)    # run
    sess.close()                # close 
    print(result)               # show result
    
2. cd ~/Desktop
3. python3 test.py

Congratulations, if “Hello,world!” is printed at the end. Enjoy!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值