跳到主要內容

Install tensorflow-gpu in Ubuntu 18.04

Ubuntu version:
18.04 LTS
NVidia graphic card:
NVidia 1080
NVidia graphic driver:
410.93
CUDA:
9.0
Cudnn:
7.0.
Tensorflow-gpu:



how to check nvidia driver version:
1.  $ nvidia-smi


check cuda version:
    cat /usr/local/cuda/version.txt
    nvcc --version



Installing Tensorflow GPU on Ubuntu 18.04 LTS for deepfakehttps://medium.com/@taylordenouden/installing-tensorflow-gpu-on-ubuntu-18-04-89a142325138  *****
step1:nvidia driver
    https://www.geforce.com.tw/drivers
    sudo ./NVIDIA-Linux-x86_64-410.93.run

    出現 Would you like to run the nvidia-xconfig utility to automatically update your X configuration file
       so that the NVIDIA X driver will be used when you restart X? 
       Any pre-existing X configuration file will be backed up
       回答:Yes  (注意預設值是No)


OR:
(~) viper1 $ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001BE0sv00001025sd00001146bc03sc00i00
vendor   : NVIDIA Corporation
model    : GP104M [GeForce GTX 1080 Mobile]
manual_install: True
driver   : nvidia-driver-410 - third-party free
driver   : nvidia-driver-390 - third-party free
driver   : nvidia-driver-396 - third-party free
driver   : nvidia-driver-415 - third-party free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

$ sudo ubuntu-drivers autoinstall 
or
$ sudo apt install nvidia-415 

step2:cuda V9.0
    sudo chmod +x cuda_9.0.176_384.81_linux.run
    ./cuda_9.0.176_384.81_linux.run --override
    choose no to “Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?”


step3:cudnn V7.1.4
    cudnn
    cuDNN v7.1.4 Library for Linux    <=====pls download this one, not ubuntu XXXX
    cudnn-9.0-linux-x64-v7.tgz
    # Unpack the archive
    tar -zxvf cudnn-9.0-linux-x64-v7.tgz

    # Move the unpacked contents to your CUDA directory
    sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-9.0/lib64/
    sudo cp  cuda/include/cudnn.h /usr/local/cuda-9.0/include/

    # Give read access to all users
    sudo chmod a+r /usr/local/cuda-9.0/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

step4:Install libcupti
    sudo apt-get install libcupti-dev

step5:Do the CUDA post-install actions
    So Tensorflow can find your CUDA installation and use it properly, you need to add these lines to the end of you ~/.bashrc or ~/.zshrc.

    export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

step6:Install Tensorflow GPU
    pip install --upgrade tensorflow-gpu


check if tensorflow-gpu works:
    python3
    >>>import tensorflow as tf
    >>>sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))

留言

這個網誌中的熱門文章

增強式學習

   迴力球遊戲-ATARI     賽車遊戲DQN-ATARI 賽車遊戲-TORCS Ref:     李宏毅老師 YOUTUBE DRL 1-3 On-policy VS Off-policy On-policy     The agent learned and the agent interacting with the environment is the same     阿光自已下棋學習 Off-policy     The agent learned and the agent interacting with the environment is different     佐助下棋,阿光在旁邊看 Add a baseline:     It is possible that R is always positive     So R subtract a expectation value Policy in " Policy Gradient" means output action, like left/right/fire gamma-discounted rewards: 時間愈遠的貢獻,降低其權重 Reward Function & Action is defined in prior to training MC v.s. TD MC 蒙弟卡羅: critic after episode end : larger variance(cuz conditions differ a lot in every episode), unbiased (judge until episode end, more fair) TD: Temporal-difference approach: critic during episode :smaller variance, biased maybe atari : a3c  ...

DeepRacer

Preliminary training: deepracer-github-simapp.tar.gz Reward function: ./opt/install/sagemaker_rl_agent/lib/python3.5/site-packages/markov/environments/deepracer_env.py action = [steering_angle, throttle] TRAINING_IMAGE_SIZE = (160, 120) Plotted waypoints in vertices array of hard track Parameters: on_track, x, y, distance_from_center, car_orientation, progress, steps,                                                                          throttle, steering, track_width, waypoints, closest_waypoints Note: Above picture is from https://yanpanlau.github.io/2016/10/11/Torcs-Keras.html

Frameworks overview

Picture courtesy from Paul Huang