Tensorflow of GPU, hello fish by version 0.8.

Tensorflow of GPU, hello fish by version 0.8.

Before your beginning, you should operate as below:
    1): uninstall the gcc 5.2.1 version that the system default installed.
        sudo apt-get remove gcc g++
    2):install gcc g++ 4.9:
        sudo apt-get install gcc-4.9
        sudo apt-get install g++-4.9
 
How to install CUDA Toolkit 7.5 on Ubuntu 15.10
download cuda:http://www.alexanderclines.net/howto/how-to-cuda-toolkit-7-5-on-ubuntu-15-10/
download cudnn:https://developer.nvidia.com/rdp/cudnn-download

Install .deb
Go to the download page and follow the prompts to download the .deb for your machine.
I recommend verifying your download using the checksum tool of your choice before continuing.
To install:
sudo dpkg -i cuda-repo-ubuntu1504-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda
Add Path Variables
In either your ~/.bashrc (or if you want every user on your machine, /etc/profile) add these two lines:
export PATH=/usr/local/cuda-7.5/bin/:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
To verify this and the installation worked enter:
nvcc --version
Compilers
So at this point you are technically done installing CUDA-toolkit 7.5 and if you like go ahead and try to run some CUDA code.
However, at the time of this writing, if you were to try and compile a CUDA program you would get this error:
1 error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
If you have a GCC compiler version higher than 4.9, which you can check by entering:
1 gcc --version
you will have to install a lower version gcc.
Now, what if you are like me and you don’t want to downgrade your gcc compiler for the whole system? Do what I did and install gcc and g++ 4.9 for CUDA 7.5 by entering these commands: (I believe g++ is optional, but I chose to do it to be safe)

In Conclusion
By now, hopefully everything works and you will now be able to use the commands:
nvcc
cuda-gdb
 
as for, cudnn:
You just copy the file to the forder as below:
    tar xvzf cudnn-7.5-linux-x64-v5.0-rc.tgz
    sudo cp cuda/cudnn.h /usr/local/cuda/include
    sudo cp cuda/libcudnn* /usr/local/cuda/lib64
    sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
 
Tensorflow:
0.download open source project:Tensorflow from git:

git clone --recurse-submodules https://github.com/tensorflow/tensorflow

1.configure:

cd tensorflow

and run:TF_UNOFFICIAL_SETTING=1 ./configure

2.compile:

bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer

bazel-bin/tensorflow/cc/tutorials_example_trainer --use_gpu

bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

mkdir /tmp/tensorflow_pkg

bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

pip install /tmp/tensorflow_pkg/tensorflow-*

3.Test:

After done! I found the Tensorflow have updated from 0,7 to 0.8. Surprise!

原文地址:https://www.cnblogs.com/FORFISH/p/5393878.html