Ubuntu installation cuda10 + cudnn7.5 + Tensorflow2.0
This article addresses: https: //blog.csdn.net/qq_31456593/article/details/90170708
See the complete tensorflow2.0 tutorial code tensorflow2.0: Chinese tutorial tensorflow2_tutorials_chinese (welcome star)
More TensorFlow2.0 introductory tutorial please stay tuned to this blog: https: //blog.csdn.net/qq_31456593/article/details/88606284
Install NVIDIA drivers
Download NVIDIA Driver
TensorFlow2.0 need cuda10, so it should be installed above version 410.48 drivers
CUDA Toolkit | Linux x86_64 Driver Version | Windows x86_64 Driver Version |
---|---|---|
CUDA 10.1.105 | >= 418.39 | >= 418.96 |
CUDA 10.0.130 | >= 410.48 | >= 411.31 |
CUDA 9.2 (9.2.148 Update 1) | >= 396.37 | >= 398.26 |
CUDA 9.2 (09/02/88) | >= 396.26 | >= 397.44 |
CUDA 9.1 (09/01/85) | >= 390.46 | >= 391.29 |
CUDA 9.0 (9.0.76) | >= 384.81 | >= 385.54 |
CUDA 8.0 (8.0.61 GA2) | >= 375.26 | >= 376.51 |
CUDA 8.0 (8.0.44) | >= 367.48 | >= 369.30 |
CUDA 7.5 (7.5.16) | >= 352.31 | >= 353.66 |
CUDA 7.0 (7.0.28) | >= 346.46 | >= 347.62 |
Sheriff Ying-Wei accessible network access to: https://www.geforce.cn/drivers
I am here to download 410.78
Prohibit ubuntu comes with driver
sudo vim /etc/modprobe.d/blacklist.conf
Add the following two lines in the file
new blacklist
new options modeset = 0
# 更新配置
sudo update-initramfs -u
# 重启
reboot
# 检测驱动是否禁止,无输出,则禁止成功
lsmod | grep nouveau
Install NVIDIA drivers
Enter the command line interface ctrl + alt + f1
sudo service lightdm stop
cd install_package
sudo chmod 777 NVIDIA-Linux-x86_64-410.78.run
sudo ./NVIDIA-Linux-x86_64-410.78.run
Check the installation gpu
# 重启图形界面
sudo service lightdm start
# 查看显卡驱动
nvidia-smi
If the above method can not be installed, please use the following method to install
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
View current driver support
ubuntu-drivers devices
Install the appropriate driver
sudo apt install nvidia-driver-410
Installation cuda10
Download cuda10
cuda10.0 address: https: //developer.nvidia.com/cuda-10.0-download-archive
Installation cuda
sudo chmod 777 cuda_9.0.176_384.81_linux.run
sudo ./cuda_9.0.176_384.81_linux.run
ps: in the choice of whether to create / usr / local / selected no (n), the environment variable to write directly to the back of the soft connection cuda specific version, you can avoid multiple versions cuda confusion.
Configuration Cuda environment
If there is a plurality of versions cuda press the first method can be directly arranged, it requires the use of a plurality of second configuration cuda
1, configured into a dynamic link library (fast loading, a machine can be configured with a cuda version)
sudo gedit /etc/ld.so.conf.d/cuda.conf
Add the following statement in open file:
/usr/local/cuda-10.0/lib64
carried out
sudo ldconfig
2, to configure the environment variables (in different environments, different environment configuration variables, multiple versions cuda)
sudo gedit ~/.bashrc
After opening the file is added at the end of the file path, which is the installation directory, the command is as follows:
export PATH=/usr/local/cuda-10.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
run
source ~/.bashrc
ps:
- To configure the global system variables, configuration in / etc / profile in
- If you use pycharm remote call, which the program does not import .bashrc environment variables, configure as environment variables in the corresponding operation in python. (Do not use pycharm remote call ignore this)
Original Address: https: //blog.csdn.net/qq_31456593/article/details/90170708
Installation cuDNN7.5.1
download
cudnn7.5.1 (cuda10.0 version) https://developer.nvidia.com/rdp/cudnn-download
[Image dump outer link failure (img-hXBmWHCL-1563497799736) (/ home / czy / coding_pubic / blog / assets / tensorflow_api / Screenshot from 2019-05-07 22-23-12.png)]
Installation cudnn:
tar -zxvf cudnn-10.0-linux-x64-v7.5.1.10.tgz
cd cuda
sudo cp lib64/lib* /usr/local/cuda-10.0/lib64/
sudo cp include/cudnn.h /usr/local/cuda-10.0/include/
cd /usr/local/cuda-10.0/lib64/
sudo chmod +r libcudnn.so.7.5.1 # 自己查看.so的版本
sudo ln -sf libcudnn.so.7.5.1 libcudnn.so.7
sudo ln -sf libcudnn.so.7 libcudnn.so
Installation TensorFlow2.0
pip install tensorflow-gpu==2.0.0-alpha0
import tensorflow, output tf._ Version _, normal installation.