安装tensorflowGPU版本



ubuntu 16.0
# 安装cuda

## 安装
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb.deb
sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub #执行第一个命令后会有提示
sudo apt-get update
sudo apt-get install cuda

## 设置

sudo gedit ~/.bashrc

在末尾添加  

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

保存退出。


然后刷新。

source ~/.bashrc

## 重启电脑并测试

执行命令
cat /proc/driver/nvidia/version
nvcc -V

1. The NVIDIA CUDA Toolkit includes sample programs in source form. You should compile them by changing to ~/NVIDIA_CUDA-9.1_Samples and typing make. The resulting binaries will be placed under ~/NVIDIA_CUDA-9.1_Samples/bin.

2. After compilation, find and run `deviceQuery` under` ~/NVIDIA_CUDA-9.1_Samples`. If the CUDA software is installed and configured correctly, the output for deviceQuery should look similar to that shown in Figure 1.

3. Running the `bandwidthTest` program ensures that the system and the CUDA-capable device are able to communicate correctly. Its output is shown in Figure 2.


Read more at: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ixzz58f8bhHpY
Follow us: @GPUComputing on Twitter | NVIDIA on Facebook

# 安装cudnn

## 安装
下载相应的源码文件并解压
cudnn-9.0-linux-x64-v7.tgz
执行命令:

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*

## 验证
参照文档

# 安装tensorflowGPU版本
使用conda创建python3.5环境
conda create -n tfGPU python=3.5
source activate tfGPU

pip install --ignore-installed --upgrade tensorflow_gpu-1.6.0-cp35-cp35m-linux_x86_64.whl
直接参照tensorflow官网


posted @ 2018-03-03 14:08  wybert  阅读(686)  评论(0编辑  收藏  举报