[Tensorflow-2.x-gpu] Test the correspondence between tensorflow_gpu 2.x and cudn under windows10

[Tensorflow-2.x-gpu] Test the correspondence between tensorflow_gpu 2.x and cudn under windows10

1. Background

For configuring tensorflow-2.x gpu environment, refer to the blog:
python3 configure tensorflow-2.x gpu environment (2)
https://blog.csdn.net/jn10010537/article/details/113791239

Due to the recent hard decoding needs of cuda to compile VPF, cuda10.0 was uninstalled and reinstalled: cuda10.2 and cudnn7.6.5.

test environment

python3.7
windows10 专业版

2. Install the cuda framework

CUDA (Compute Unified Device Architecture) is a parallel computing platform and programming model for GPU general-purpose computing. It is based on the C language and has been extended with multiple C languages, which can execute programs on the graphics chip.
Installation package cuda_10.2.89_441.22_win10.exe, custom installation location:

development package D:\D03_GeneralDevelop\D03_01_nvidia\cuda\install\development
documentation D:\D03_GeneralDevelop\D03_01_nvidia\cuda\install\documentation
samples D:\D03_GeneralDevelop\D03_01_nvidia\cuda\install\samples

As shown in Figure 1:Insert picture description here

3. Install cuDNN

CUDA provides a deep neural network GPU acceleration library cuDNN (CUDA Deep Neural Network), which completes the rapid implementation of standard operations such as convolution, pooling, normalization, and activation function layers.
Installation package: cudnn-10.2-windows10-x64-v7.6.5.32.7z After
decompression, copy the three folders bin, include and lib to the cuDNN folder, which is the path as follows:
D:\D03_GeneralDevelop\D03_01_nvidia\cudnn\cuDNN

As shown in Figure 2: Insert picture description here
-3. Add cuda and cuDNN to system environment variables
. Add the following folders under the installation directory of cuda and cuDNN to system environment variables:

1 D:\D03_GeneralDevelop\D03_01_nvidia\cuda\install\development\bin image 3
2 D:\D03_GeneralDevelop\D03_01_nvidia\cuda\install\development\extras\CUPTI\lib64 Figure 4
3 D:\D03_GeneralDevelop\D03_01_nvidia\cuda\install\development\include Figure 5
4 D:\D03_GeneralDevelop\D03_01_nvidia\cudnn\cuDNN\bin Figure 6

image 3:
Insert picture description here

Figure 4
Insert picture description here

Figure 5Insert picture description here

Figure 6
Insert picture description here

After adding to the system environment, as shown in Figure 7:
Insert picture description here

4. Install tensorflow-gpu

Install tensorflow-gpu==2.2.0

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

After installation, check the installed tripartite package as follows:
Insert picture description here

Check if tensorflow is running GPU hardware:

import tensorflow as tf 
print(tf.__version__ )     # 2.2.0 
tf.test.is_gpu_available() # False

It is found that the GPU of tensorflow is not running, as shown in the figure
Insert picture description here
above. The reason is: cuda_10.2.89_441.22_win10.exe after installation is in the
D:\D03_GeneralDevelop\D03_01_nvidia\cuda\install\development\bin directory is the cudart64_102.dll file !
As shown in the figure below, the
Insert picture description here
conclusion is that cuda_10.2.89_441.22_win10.exe does not match tensorflow-gpu 2.2.0 and requires'cudart64_101.dll', that is, cuda10.1;

After testing, cuda_10.2.89_441.22_win10.exe and tensorflow-gpu 2.3.0 also do not match, requiring'cudart64_101.dll', namely cuda10.1;

After testing, cuda_10.2.89_441.22_win10.exe and tensorflow-gpu 2.3.1 also do not match, requiring'cudart64_101.dll', namely cuda10.1;

After testing, cuda_10.2.89_441.22_win10.exe and tensorflow-gpu 2.3.2 also do not match, requiring'cudart64_101.dll', which is cuda10.1;

After testing, cuda_10.2.89_441.22_win10.exe and tensorflow-gpu 2.4.0 also do not match, requiring'cudart64_110.dll', that is, cuda11.0;

After testing, cuda_10.2.89_441.22_win10.exe and tensorflow-gpu 2.4.0rc0 also do not match, requiring'cudart64_110.dll', namely cuda11.0;

5. Summary

-5.1 The significance of
the test It seems that this kind of test is meaningless,
but if you are studying VPF, that is, VideoProcessingFramework, then it makes sense!
(Under windows10, after installing cuda10.0, compile VPF error report, the specific error report is not mentioned here.)
At the same time, this blog also details the general process of cuda and tensorflow-gpu installation and configuration, which is also meaningful.

Reference blog:
[tensorflow-2.x-gpu] python3 configures tensorflow-2.x gpu environment (2)
https://blog.csdn.net/jn10010537/article/details/113791239

The mentioned Windows-GPU build configuration, configure cuda, cudnn, tensorflow-gpu;

Finally, I suggest you install cuda10.1 version under windows10, this version can take into account the use of tensorflow-gpu and VPF at the same time.

-5.2 I installed cuda10.1 and tensorflow-gpu2.3.0. The
following is a brief description of my reinstallation of cuda and cudnn:
Insert picture description here

Install tensorflow 2.3.0, check the tripartite package after installation: Insert picture description here
check whether tensorflow is running GPU:

import tensorflow as tf 
print(tf.__version__ )     # 2.2.0 
tf.test.is_gpu_available() # False

It is found that the gpu of tensorflow runs successfully, as shown in the following figure:
Insert picture description here

Guess you like

Origin blog.csdn.net/jn10010537/article/details/114169373