Install tensorflow-gpu (2.2.0) installation tutorial under Windows10 (avoid pits + nanny teaching)

This article implements the installation of the GPU version of tensorflow 2.2.0 under Windows 10. The software used mainly includes: CUDA 10.2 + cuDNN + Anaconda + tensorflow-gpu 2.2.0. (Note: This tutorial is also applicable under Win7 environment! Also attached is the solution of missing cudart64_101.dll!)

One, download and install CUDA

(1) Check the computer's graphics card type and graphics driver version
Insert picture description here
(2) Query the comparison table between CUDA version and graphics driver version
URL: https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html# title-resolved-issues
Insert picture description here
(3) (optional) According to the above table, if you need to update the graphics card driver, you can go to the NVIDIA driver download
website: https://www.nvidia.cn/Download/index.aspx?lang=cn
Insert picture description here
Insert picture description here
( 4) Download the CUDA version you want. I chose the 10.2 version here.
Website: https://developer.nvidia.com/cuda-toolkit-archive
Insert picture description here
Choose the corresponding version according to your computer. Remember to choose the local installation exe (local ), click Download to download.
Insert picture description here
Insert picture description here
(5) Install CUDA
1. Create a folder named CUDA-temp and CUDA in the directory you want to install.
Insert picture description here
2. Set the temporary decompression path to the path of the CUDA-temp folder just created.
Insert picture description here
3. Select custom installation
Insert picture description here
4. In the custom installation options, only select the options in the red box, other options do not need to be checked
Insert picture description here
5. Modify the installation location to the corresponding location in the CUDA folder (you can also keep the default settings)
Insert picture description here
6. Installation is complete
Insert picture description here
(6) Configure environment variables
1. Press Win+R and enter control to control panel, select system and security, then select system, then click Advanced System Settings, click Environment Variables.
Insert picture description here
2. Add the following four paths to the Path of the system variables, pay attention to replace with your own installation path.
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp

(7) Check whether CUDA is installed successfully.
Press Win+R to enter cmd, enter nvcc -V in the console, and return the following message, indicating that CUDA is installed successfully
Insert picture description here

2. Download and configure cuDNN

Download URL: https://developer.nvidia.com/rdp/cudnn-archive
(1) Select the version of cnDNN corresponding to CUDA (there is no version corresponding to 10.2, because the version corresponding to 10.1 is selected, which does not affect subsequent installation) ( Update 20200901: Currently there is a version corresponding to 10.2 on the official website)
Insert picture description hereInsert picture description here(2) You need to register before downloading, and you can download after registration
Insert picture description here
(3) After the download is complete, unzip cuDNN to the same folder of CUDA to facilitate subsequent operations
Insert picture description here
(4) Copy the files in the three folders of cnDNN to the corresponding folders in the CUDA installation directory.
Insert picture description here

Three, create an Anaconda virtual environment

Open the console of Anaconda (you can refer to other tutorials for the installation and use of Anaconda, I won't repeat them here), and create a new virtual environment.

conda create -n DL python=3.6

Create a screenshot:
Insert picture description here

Fourth, install tensorflow-gpu 2.2.0

(1) Start the virtual environment just created
Insert picture description here
(2) Install tensorflow-gpu 2.2.0 (Tsinghua source is used here)

pip install tensorflow-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple

Installation screenshot:
Insert picture description here
(3) Add the missing cudart64_101.dll file After the
Insert picture description here
installation is complete, if you run it directly, it will report an error of missing cudart64_101.dll.
Solution: Copy the missing cudart64_101.dll file to the NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin directory installed by CUDA. (This dll can be found online, and you can also
send me a private message!) (20200901 update: you can rename cudart64_102.dll in CUDA to cudart64_101.dll)
Insert picture description here
(4) You're done! Check if tensorflow can run with gpu

import tensorflow as tf
# 下面语句都可以达到检测目的
tf.test.is_gpu_available()
tf.config.list_physical_devices('GPU')
tf.test.gpu_device_name()

Final screenshot:
Insert picture description here
(Update 20200907) Later, we can install the GPU version of pytorch together. Because CUDA is already installed, the installation process will be easier, but there will be some minor problems. For details, please refer to my other article Tutorial: GPU version of pytorch1.6.0+torchvision0.7.0 installation tutorial under Windows10 (support CUDA10.2, including whl quick download address)

Conclusion & Easter eggs

Hello everyone, I am Yi Lei xylbill, a primary school scumbag majoring in Operations Research and Cybernetics at Beijing Jiaotong University. I am very eager to meet excellent friends to exchange and learn together! If you can find the dry goods you need from this article, it is my honor! Finally, please pay attention, like, favorite and comment more! If you have any questions about this article, you can also send me a private message at any time!

Keep self-discipline, be in awe, keep your feet on the ground, and look up at the stars!

Guess you like

Origin blog.csdn.net/xylbill97/article/details/107107789
Recommended