網頁

2021年1月21日 星期四

Install Tensorflow 1.15 on Ubuntu 18.04

原本 pip3 install tensorflow-gpu=1.15 即可
但發現與 cuda 10.2 不合, 需要安裝 cuda 10.0,搭配 cudnn v7.6.5

安裝 CUDA
https://developer.nvidia.com/cuda-downloads
選 Archive of Previous CUDA Releases
選 CUDA Toolkit 10.0, Linux, x86_64, Ubuntu, 18.04, deb(local)
按下 Download
sudo dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
sudo apt-get update
查詢可安裝版本
apt-cache policy cuda
apt-cache madison cuda
安裝正確版本
sudo apt-get install cuda=10.0.130-1

安裝 CUDNN
https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html
https://developer.nvidia.com/cudnn
選擇 cuDNN v7.6.5 for CUDA 10.0
選擇 cuDNN Library for Linux (x86)
tar -xzvf cudnn-10.0-linux-x64-v7.6.5.32.tgz
sudo cp cuda/include/cudnn*.h /usr/local/cuda-10.0/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-10.0/lib64
sudo chmod a+r /usr/local/cuda-10.0/include/cudnn*.h /usr/local-10.0/cuda/lib64/libcudnn*

sudo apt install python3-testresources
sudo apt install python-dev python-pip
mkdir envs; cd envs
python3 -m venv --system-site-packages tensorflow-1.15
source tensorflow-1.15/bin/activate
pip install --upgrade pip
pip install tensorflow-gpu==1.15

沒有留言:

張貼留言