Windows10+CUDA 10.1.0+CUDNN+pytorch installation process

The main purpose of writing this article is to record and share their own successful installation process, if there are friends who are troubled by this problem, you can also see if you can find a solution from here.

Without further ado, let’s comb through my general process

  • Install the CUDA
  • Install cuDNN
  • Install pytorch
  • test

First, install CUDA

We all know that CUDA is installed to take advantage of GPU acceleration on graphics cards, so first make sure that your computer’s graphics card supports CUDA and that you already have drivers installed.

Drivers first, go to Device Manager, find the display adapter,

  • If you can see your graphics card model, it indicates that the driver has been successfully installed
  • If a yellow exclamation mark is displayed, the driver is abnormal and needs to be reinstalled.

My computer is directly installed, so there is no need to download and install, if you need to install, you can go to nvidia official website to download, some notes can be searched in advance.

GPU Driver and CUDA version

Can view the table below according to the need to install the CUDA GPU version query version (must see first, otherwise the wrong version, can cause but with the success of the installation failure phenomenon) see matching version of the site: docs.nvidia.com/cuda/cuda-t…

Driver update

How do I check whether my GRAPHICS card supports CUDA

To provide a way, find the NVIDIA control panel mine is in the status bar in the lower right corner. Then click Help, Components, nvCuda. DLL to view the CUDA versions supported by the graphics card.

Download the CUDA

Next, I went to the official website to download the corresponding VERSION of CUDA. I went to the official website and found that the direct download was version 11, but I needed version 10.1. After searching, I found that different VERSIONS of CUDA can download any version of CUDA.

Then choose to download as you want.

Install the CUDA

After downloading, follow the steps to install it. There is also a prerequisite that your computer has installed VS2015 version or above in advance. Note that there are two paths during the installation. The first is the temporary decompression path, and the second is the installation path. The installation path should be remembered if it is not the default, because it will be used later when adding environment variables.

Up here is the first path

Select Custom

This is the second path, the actual installation location, do not change, convenient to add environment variables later.

Test whether CUDA is installed successfully

Open powershell or CMD, and enter NVCC -v to check whether the installation is successful. The preceding figure shows that the installation is successful.

Add environment variables for CUDA

Add environment variables. Computer -> Properties -> Advanced System Settings -> Environment Variables

Set this parameter based on your installation path:

CUDA_SDK_PATH = C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.1 CUDA_LIB_PATH = %CUDA_PATH%\lib\x64 CUDA_BIN_PATH =  %CUDA_PATH%\bin CUDA_SDK_BIN_PATH = %CUDA_SDK_PATH%\bin\win64 CUDA_SDK_LIB_PATH = %CUDA_SDK_PATH%\common\lib\x64Copy the code

Create the above into the system variable

Then locate path in the system variable and select Edit.

Add the following:

%CUDA_LIB_PATH%; %CUDA_BIN_PATH%; %CUDA_SDK_LIB_PATH%; %CUDA_SDK_BIN_PATH%; C: Program Files NVIDIA GPU Computing Toolkit CUDA v10.1 lib x64; C: Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin C: ProgramData\NVIDIA Corporation\CUDA Samples \ v10.1 \ common \ lib \ x64; C: \ ProgramData \ NVIDIA Corporation \ CUDA Samples \ v10.1 \ bin \ win64.Copy the code

Step 2, install cuDNN

Go to CUDNN to download it first. You need to register for the first time

Select CREATE AN ACCOUNT

Verify email and fill in your personal information.

Formal CUDNN download page: developer.nvidia.com/rdp/cudnn-a…

Then you register an account and go back to download it.

Select the version that works with CUDA.

Then select cuDNN that is appropriate for your system.

After downloading is an installation package, decompression will have three folders. Copy the contents of the three folders into the corresponding folder in your CUDA installation. For example, if you unzip a lib, copy its contents. Find the path to CUDA, also find the lib folder, and copy the contents to the folder.

Step 3, install PyTorch

Go to the PyTorch website and select the appropriate version, then copy the code into CMD or PowerShell.

Install torch, PyTorch, torchVision if you have installed torch, PyTorch, TorchVision before install.

pip uninstall torch
Copy the code

Or use

conda uninstall torch
Copy the code

I had installed it before, so it was not successful to install it directly. I can uninstall it later.

The last step, testing

If pyhton, torch. Codu. is_Available is true, the installation is successful and ready to use.

Pytorch uses WHL files for a stable installation

  1. First, find the previous version now in PyTorch

  1. Scroll down to find the version site (version 1.8.0)

  1. Copy the path above to your browser and open it

  1. Pytorch files are available for all versions of pyTorch. Select the WHL file you want to download