TensorFlow||Installation of TensorFlow-GPU version under Win10 (MX130+CUDA 10.0+cuDNN 7.4.2+Python3.6+TensorFlow-GPU2.0.0)

Foreword:

        Recently, the blogger is completing the design and needs to use the TensorFlow deep learning framework. The CPU version of TensorFlow has been installed in the Anaconda environment before. For details, see Anaconda|| (steps on numerous pits, tearful summary!!!) Anaconda uninstall And installation (tensorflow+Keras+spyder+add mirror source ) It is convenient to obtain and manage packages, and at the same time, the environment can be managed uniformly. It includes more than 180 scientific packages and their dependencies such as conda, Python, numpy, scipy, ipython notebook, etc. Anaconda uses the tool/command conda to manage the installation package and environment, and already includes Python and related supporting tools. ... https://blog.csdn.net/Inochigohan/article/details/120400990         The CPU version of TensorFlow is relatively easy to install, but when training large neural networks or large-scale data, the CPU version may be slow (who Who knows (T_T), so it is recommended to install the GPU version of TensorFlow. In this case, CUDA and cuDNN need to be installed. There are hundreds of millions of complex hhh

content

1. Check whether the computer supports GPU 

1.1 View computer related configuration

​1.2 Check if installation is supported

1.3 Pay attention to version connection

2. Install CUDA

2.1 Download and installation

2.2 Configure environment variables

2.3 Check whether the software is installed successfully

3. Install cuDNN

3.1 Download and Installation

3.2 Unzip the file and put it in the appropriate location

Fourth, install TensorFlow-GPU 

4.1 Create environment and installation

4.2 Verify that the installation was successful


1. Check whether the computer supports GPU 

1.1 View computer related configuration

        Open the computer's " Control Panel ", find the NVIDIA Control Panel , and view " System Information ". The blogger's computer configuration is Windows 10 64-bit operating system and has a GeForce MX130 graphics card, so you can consider installing the GPU version of TensorFlow.

         Supplementary knowledge point: How to check the graphics card in the laptop

1.2 Check if the installation is supported

        Maybe there is a little brother whose computer graphics card model is not the same as that of the blogger. If you don't know if your graphics card supports the GPU version of TensorFlow, you can go to NVIDIA's official website  to see.

        The video card model of the blogger is GeForce MX130, which is actually not found in the list of "GeForce and TITAN products supporting CUDA" in the picture below, but there is a tutorial on the Internet that the list of NVIDIA has not been updated for a long time, so it is for reference only . In this article, I personally tested using GeForce MX130 to install the GPU version of TensorFlow and found that it is actually feasible ( •̀ .̫ •́ )✧

1.3 Pay attention to version connection

        To install the GPU version of TensorFlow, you also need to install CUDA, cuDNN, and Python accordingly. Therefore, we need to pay attention to the version correspondence between the installation packages. You can go here to check: Build from source code in Windows environment | TensorFlow (the picture is found online Yes, because bloggers can't get over the wall and can't open the website T_T).


2. Install CUDA

2.1 Download and installation

        CUDA is an SDK launched by NVIDIA that uses GPU resources for general computing. The CUDA installation package generally integrates graphics drivers. The official website download address is: CUDA Toolkit 10.0 Archive | NVIDIA Developer

        After entering the official website, you can download the corresponding installation version according to your needs.

        Run the downloaded .exe file, it is recommended not to modify the path (many blog posts on the Internet say that modifying the path will not complete the installation, in order to avoid unnecessary trouble later, the default installation path ( ̄_, ̄ ), then next

 

 

        The default streamlined mode of the program will install everything, including the VS compiler and graphics card driver that may not be used, so choose the custom mode, and by the way, when you select the driver component in the next step, uncheck the VS compiler and graphics card driver. .

        Then all the way to next until finish ♪(´▽`)

2.2  Configure environment variables

        After the software is installed, it will automatically add two variables to the environment variables of the system

        We also need to add several variables by ourselves (add according to the actual installation version and path); also add variables in the system variable Path, fill in according to our actual situation , as shown in the figure: 

2.3 Check whether the software is installed successfully

        Open the command line window of the computer (enter cmd in the desktop search box), switch to the desired path, and run the following commands bandwidthTest.exe and deviceQuery.exe respectively

cd C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\extras\demo_suite

        The installation is successful as shown in the figure below.


3. Install cuDNN

3.1 Download and Installation

        The official download link is: cuDNN Archive | NVIDIA Developer

        This blog post downloads cuDNN 7.4.2 because the previously installed CUDA version is 10.0. Please select the corresponding version according to the table in 1.3 Note Version Connection . If you download for the first time, you need to register an account first, and fill in your personal information to download~~

         If you can't find the little brother in the picture below, you can enter cuDNN Archive | NVIDIA Developer in the search bar of the website you browse to go to the interface below.

3.2 Unzip the file and put it in the appropriate location

        Find the compressed package downloaded from the browser and unzip it. After decompression, enter the folder, and copy the .h .lib and .dll files to the include, lib/x64, bin folders under the path where CUDA is installed.


Fourth, install TensorFlow-GPU 

4.1 Create environment and installation

         The steps to install the TensorFlow-GPU version are actually similar to the CPU version. This blog post is installed with the help of Anaconda software. First open Anaconda Prompt, create a virtual environment eve-gpu, the corresponding Python version is 3.6, use conda info --envs to ensure that the environment is successfully created.

conda create -n eve-gpu python=3.6
conda info --envs

         Activate the eve-gpu environment and install the TensorFlow-GPU version, remember to specify the version number! ! ! (If you do not specify the version number, the latest version will be installed by default, and the previous installation of CUDA and cuDNN will be in vain...

4.2 Verify that the installation was successful

        Run Python, enter the following code to verify, the picture shows that the TensorFlow-GPU version number is 2.0.0, indicating that the installation is successful

#验证TensorFlow
import tensorflow as tf
tf.__version__
 
#验证CUDA
a = tf.test.is_built_with_cuda()
print(a)
 
physical_devices = tf.config.experimental.list_physical_devices('GPU')
print(physical_devices)


        So far, the end of the flower\^o^/ \^o^/ \^o^/

Guess you like

Origin blog.csdn.net/Inochigohan/article/details/121432257