Ubuntu 18.04 N card driver installed + CUDA10.0 + cuDNN7.5 + Anaconda + Tensorflow-GPU

1. Driver Installation

Open software updates, click on the attached drive, select the drive N card

First, the source added
$ sudo add-apt-repository ppa:graphics-drivers/ppa $ sudo apt update
Check system gpu device 
$ ubuntu-drivers devices

in this installation nvidia-driver-410, execution
$ APT-GET the install the sudo NVIDIA-410-Driver

Change restart the computer to view the information GPU

At this point the driver installed

2.cuda10.0 installation

First installation environment dependent

$sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev

Download cuda10.0 and related https://developer.nvidia.com/cuda-10.0-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=runfilelocal

After downloading to enter the download folder, install

 $ Sudo sh cuda_10.0.130_410.48_linux.run
first prompted to select no, the rest of the yes or default

Then edit the environment variable, add the following, and enable: source ~ / .bashrc

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

After that, enter 

$ Nvcc -V 

Display following the installation was successful

$cd /usr/local/cuda-9.0/samples
$sudo make
$./bin/x86_64/linux/release/deviceQuery
显示如下内容


3.cudnn7.5的安装
下载:https://developer.nvidia.com/rdp/cudnn-download
得到文件:cudnn-10.0-linux-x64-v7.5.0.56.tgz
进入到文件目录,执行
$ tar zxvf cudnn-10.0-linux-x64-v7.5.0.56.tgz
解压后得到 名为 cuda 的文件夹,需要将里面的几个文件拷贝到已安装的cuda文件夹下面,并赋予相应的权限
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
之后执行
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
若显示以下内容表明安装成功


4.anaconda 安装
下载得到文件 Anaconda3-2018.12-Linux-x86_64.sh
在文件目录中,执行+
sudo sh Anaconda3-2018.12-Linux-x86_64.sh
出现如下选择yes

最后选择不安装vs code
安装完后需要执行
source ~/.bashrc

anaconda change Source:

Tsinghua University to develop the source:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

Have the resources to show the source address:

conda config --set show_channel_urls yes

5.tensorflow-gpu installation

Before installing install bazel, see the official installation manual

After installing bazel execution

conda install tensorflow-gpu

import tensorflow as tf

tf.__version__

hello = tf.constant('hello tensorflow')

sess = tf.Session()

sess.run(hello)

Guess you like

Origin www.linuxidc.com/Linux/2019-06/158951.htm