win10+cuda10.0+tensorflow-gpu==1.15 installation tutorial

Background introduction

As a beginner who is just getting started with deep learning, I am ready to start running deep learning algorithms with GPU happily. I have installed the CPU version of tensorflow, and I want to speed up and build a tensorflow-gpu version.

My environment is python==3.7, tensorflow==1.15. You can refer to other tutorials for the installation of these two. Why do I choose the 1.15 version in 2021, because the code I want to use is still tensorflow version 1, tensorflow 2.0 Unlike the original, other problems are prone to occur. In order to get started with deep learning as soon as possible, I don't want to get 2.0. Here is mainly to explain how to install GPU accelerated CUDA and cuDnn.

tensorflow-gpu-1.15.0 , tensorflow-gpu installation directly enter the command line window: pip install tensorflow-gpu==1.15, pay attention to add the version number, otherwise the latest version will be installed directly. Will not match the original installed version.

Graphics card support:

To be clear, I have assumed that everyone's graphics cards can support cuda. ​​Basically, the current graphics cards support cuda, unless your machine is very old. If you still feel uneasy, go to this website to check https:/ /developer.nvidia.com/cuda-gpus; if you do not find your graphics card model, it may not be supported.

cuda installation:

Download link: https://developer.nvidia.com/cuda-toolkit-archive

Pay special attention here. I don't know why I kept downloading failed at the beginning, even if it was downloaded, it was a damaged file with only tens of k. Later, science can be downloaded online.

After the download is complete, click directly to choose streamlined installation or custom installation. All components are checked by default in custom installation, which is actually equivalent to streamlined, and the installation path afterwards can be defaulted. I chose to streamline the installation. Regardless of this, although some of the components are not available, they are installed for convenience. There is nothing wrong with them. Finally, there will be a prompt that because there is no vs studio, there is a component that cannot be installed. It is not important. Skip it and just complete it directly. One thing to note is to make sure that vc++2015 or vc++2017 has been installed on the computer. Generally, those who don’t have it can search and install it by themselves; this is very simple.
After the installation is completed, the environment variables will be automatically added. tube

cudnn installation:

Download link: https://developer.nvidia.com/rdp/cudnn-archive

Same as above, you also need to open the scientific Internet to download.

When downloading, pay attention to choose the 10.0 version, as well as for Windows 10.

In fact, the downloaded file is not an exe file, but a compressed package. After decompression, there are three folders. Copy the three folders to the installation directory of cuda. ​​If the default path is used when cuda is installed, it is C :\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0 , now everyone should understand that cudnn is actually a patch of cuda, optimized for deep learning operations.

Just copy the image on the left in the above picture directly to the image file location on the right.

Test cuda:

It's very simple. Open the cmd command line, enter nvcc -V, and see the content in the figure below. It is successful; the online example of compiling cuda comes with it to ensure that the installation is successful. Don't adjust these useless and troublesome. If it doesn't work, it will be cool. , Which shows that this is basically ok

Install tensorflow : open the command line, enter pip install tensorflow, automatically download tensorflow (cpu version) and its dependencies, and then install tensorflow==1.15.0, if there is a problem here, go to download the wheel tensorflow-1.15.0-cp37- cp37m-win_amd64.whl, pip install The path where the wheels are/tensorflow-1.15.0-cp37-cp37m-win_amd64.whl
Test tensorflow: reopen a command line, enter python first, enter the python environment, enter

import tensorflow as tf
tf.Session()

The result:

This shows that the installation was successful. If it shows that you can't find cudart64_100.dll, please refer to my other article. Solve the problem of mismatch.
 

Guess you like

Origin blog.csdn.net/weixin_40244676/article/details/114124506