type the following at the command line to get the information of your graphics card
$ lspci | grep -i nvidia
If your graphics card is from NVIDIA and it is listed in here, your GPU is CUDA-capable.
The CUDA Development Tools are only supported on some specific distributions of Linux. These are listed in the CUDA Toolkit release notes.
To determine which distribution and release number you’re running, type the following at the command line:
$ uname -m && cat /etc/*release
You should see output similar to the following, modified for your particular system:
x86_64
Red Hat Enterprise Linux Workstation release 6.0 (Santiago)
The x86_64 line indicates you are running on a 64-bit system. The remainder gives information about your distribution.
To verify the version of gcc installed on your system, type the following on the command line:
$ gcc --version
If an error message displays, you need to install the development tools from your Linux distribution or obtain a version of gcc and its accompanying toolchain from the Web.
The kernel headers and development packages for the currently running kernel can be installed with:
$ sudo apt-get install linux-headers-$(uname -r)
$ cd ~/Downloads
$ sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
$ sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install cuda-9-0
$ export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
$ export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64\
${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
To download the cuDNN , click here
The download of cuDNN requires membership of the NVIDIA Developer Program,so you need to create your account first and then Login.
Do not choose the latest version
Choose the v7.0.5 for CUDA 9.0
Download Runtime 、 Developer 、Code Samples
$ cd ~/Downloads
$ sudo dpkg -i libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
$ sudo dpkg -i libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb
$ sudo dpkg -i libcudnn7-doc_7.0.5.15-1+cuda9.0_amd64.deb
To verify that cuDNN is installed and is running properly, compile the mnistCUDNN
$ cp -r /usr/src/cudnn_samples_v7/ $HOME
$ cd $HOME/cudnn_samples_v7/mnistCUDNN
$ make clean && make
$ ./mnistCUDNN
If cuDNN is properly installed and running on your Linux system, you will see a
message similar to the following:
Test passed!
$ sudo apt-get install python3-pip python3-dev python-virtualenv
$ sudo virtualenv --system-site-packages -p python3 ~/tensorflow
targetDirectory 用于指定 Virtualenv 树的顶层目录。我们的说明中假定 targetDirectory 为 ~/tensorflow,但您可以选择任何目录。
$ sudo gedit ~/.bashrc
alias tensorflow="source ~/tensorflow/bin/activate"
$ source ~/.bashrc
$ tensorflow
(tensorflow)$
发出下列其中一条命令以在处于活动状态的 Virtualenv 环境中安装
TensorFlow-CPU版本(无需安装CUDA和CUDNN)
(tensorflow)$ sudo pip3 install --upgrade tensorflow
(tensorflow)$ sudo pip3 install --upgrade tensorflow-gpu
$ tensorflow
(tensorflow)$ Python3
>> import tensorflow as tf
>> hello = tf.constant('Hello, TensorFlow!')
>> sess = tf.Session()
>> print(sess.run(hello))
若如果系统输出以下内容,就说明您可以开始编写 TensorFlow 程序了:
Hello, TensorFlow!