ubuntu 16.04 安装 tensorflow-gpu 包括 CUDA ,CUDNN,CONDA
显卡驱动装好了,如图:
英文原文链接:
https://github.com/williamFalcon/tensorflow-gpu-install-ubuntu-16.04
英文内容:
update apt-get
sudo apt-get update
Install apt-get deps
sudo apt-get install openjdk-8-jdk git python-dev python3-dev python-numpy python3-numpy build-essential python-pip python3-pip python-virtualenv swig python-wheel libcurl3-dev
install nvidia drivers
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
apt-get update
apt-get install cuda -y
2a. check nvidia driver install
nvidia-smi
# you should see a list of gpus printed
# if not, the previous steps failed.
install cuda toolkit (MAKE SURE TO SELECT N TO INSTALL NVIDIA DRIVERS)
wget https://s3.amazonaws.com/personal-waf/cuda_8.0.61_375.26_linux.run
sudo sh cuda_8.0.61_375.26_linux.run # press and hold s to skip agreement
Install cudnn
wget https://s3.amazonaws.com/personal-waf/cudnn-8.0-linux-x64-v5.1.tgz
sudo tar -xzvf cudnn-8.0-linux-x64-v5.1.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 /usr/local/cuda/lib64/libcudnn*
Add these lines to end of ~/.bashrc:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda
Reload bashrc
source ~/.bashrc
Install miniconda
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
Reload bashrc
source ~/.bashrc
Create conda env to install tf
conda create -n tensorflow
Activate env
source activate tensorflow
Install tensorflow with GPU support for python 3.6
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.2.0-cp36-cp36m-linux_x86_64.whl
Test tf install
python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
手机扫一扫
移动阅读更方便
你可能感兴趣的文章