Ubuntu16.04 + CUDA + cuDNN + virtualenv + Tensorflow

Prerequirement:

   HardWare:

              motherboard:  Support extended independent graphics card(GPU)

              CPU:  i7-7* or better

              Memory:  16G or more

              SSD: 256G or more

              GPU: NVIDIA GTX1080Ti

              Power: 550W(one GPU)

   System:

              Ubuntu 16.04

   CUDA:

              Download

   cuDNN:

              Download(must login first)

    GCC:

              Verify the System Has gcc installed:

gcc --version

1. Install the driver of GPU:

        Type  [Apply Changes]  then wait some minutes, last restart computer.

  last open a terminal,run the following bash code,then if the following figure appears, the driver installation is successful.

nvidia-smi

2. Install CUDA

Type [Legacy Releases] choose the version you want, Here I choose cuda9.0

start install the file with the extension deb:(Once you've downloaded it, follow the installation instructions on the website.)

After installation, we must declare the enviroment variable and write it to the end of  '~/.bashrc':

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

save and quit then run the following code:

source ~/.bashrc

If no any error reports , it's OK!

3. Install cuDNN

After downloading the cuDNN package(.tgz) on the official website, then decompressing it with `tar`

tar -xvf cudnn-9.0-linux-x64-v7.4.1.5.tgz

then copy the corresponding file to the cuda directory.

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*

then establish the soft connection of cuDNN,

cd /usr/local/cuda/lib64/
sudo rm -rf libcudnn.so libcudnn.so.7
sudo ln -s libcudnn.so.7.4.1 libcudnn.so.7
sudo ln -s libcudnn.so.7 libcudnn.so
sudo ldconfig






that's OK!

 

4. Install virtual environment of python3

apt install python-pip
apt install python3-pip

check:

pip -V
pip3 -V

Then:

pip install virtualenv
pip install virtualenvwrapper
pip3 install virtualenv
pip3 install virtualenvwrapper

declare the enviroment variable and write it to the end of  '~/.bashrc':

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
source ~/.local/bin/virtualenvwrapper.sh

then run

source ~/.bashrc

if no any error report, it's OK!

now create a virtual environment yyf(the name of your virtual environment):

mkvirtualenv yyf

Enter the virtual environment, execute the command,

workon yyf

Exit the virtual environment, execute the command,

deactivate yyf

it's OK!

5. Install Tensorflow-GPU with pip

first enter the virtual environment

workon yyf

then

pip install tensorflow-gpu

wait some minutes

then , check

That's All , Thank you !

Reference:

cudnn

virtualenv

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值