[Nanny level tutorial] Windows installation CUDA and cuDNN

foreword

1. Install CUDA for the first time

Before installing CUDA for the first time,It is recommended that you take a look at which NVIDIA software currently exists in the computer, so that even if you want to uninstall CUDA later, you can distinguish which ones already exist and cannot be uninstalled, and which ones are installed later and can be uninstalled. Specific steps are as follows:

  • The first step is to search for [Control Panel] in the [Settings] of the computer and open it.
    insert image description here
  • Step 2: Click [Uninstall a program].
    insert image description here
  • The third step, from the perspective of the author’s computer, the following ones already exist, so after I install CUDA, if I want to uninstall, these few should be kept to prevent problems, and other follow-up If it appears here due to the installation of CUDA, you can uninstall it later with confidence.
    insert image description here

2. Install CUDA for the Nth time

In the [Control Panel] of the computer, [Uninstall a program] thereKeep the following three software, and then other software starting with NVIDIA can be uninstalled. After uninstalling, you can install the new CUDA.

insert image description here

1. CUDA

1. Query CUDA version

(1) Check the graphics card driver version. Press the win and r keys at the same time to open the run box, enter nvidia-smi and press Enter, as follows, you can see that the driver version of the graphics card is 528.02.
insert image description here

(2) Enter the CUDA Toolkit official document interface: https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html , as follows:
insert image description here

(3) Scroll down to find the following form:
insert image description here

It can be seen that the version number of my graphics card driver is 528.02, which should be the highest in the table. Therefore, versions below CUDA12.0 should be able to be installed. Here, the author intends to install CUDA 11.6 version.

2. Download CUDA

1. After determining the installed CUDA version, such as CUDA 11.6 determined above, you can enter the CUDA download interface: https://developer.nvidia.com/cuda-downloads , in this interface, click [CUDA historical version 】,As follows:
insert image description here

(2) After entering the CUDA history version interface, slide down, select a 11.6.X series CUDA Toolkit, such as CUDA Toolkit 11.6.0 in the figure below, and then click the left button.insert image description here

(3) After entering the CUDA Toolkit 11.6 download interface, make the following selections in turn, and click the [Download] button.
insert image description here

3. Install CUDA

  • The first step is to double-click the CUDA installation package.
    insert image description here

  • In the second step, click [OK] directly.
    insert image description here

  • Step 3: Click [Agree and Continue].
    insert image description here

  • Step 4: Select [Custom Installation] and click [Next].
    insert image description here

  • The fifth step, since there is no VS in my computer, I unchecked VS and clicked [Next].It must be noted here that if there is no VS in the computer, this check must be removed, otherwise it is easy to make mistakes
    insert image description here

  • Step 6: Modify the [Installation Location] and click [Next]. Here, the author installed it on the D drive to save space on the C drive.Note, no matter where it is installed, remember this location, because it will be used later when configuring CUDA environment variables
    insert image description here

  • The seventh step is to wait for the installation.
    insert image description here

  • The eighth step, click [Next].
    insert image description here

  • The ninth step, the installation is complete, click [Close].
    insert image description here

4. Configure CUDA environment variables

  • The first step is to search for environment variables in the computer [Settings], and click [Edit System Environment Variables].
    insert image description here
  • The second step is to click [Environment Variables] under [Advanced] in [System Properties].
    insert image description here
  • The third step is to check whether there is a CUDA environment variable. If not, add it. The added content is the location where CUDA was installed just now; if the environment variable already exists, do not need to add it.
    insert image description here

5. Check whether CUDA is installed successfully

  • The first step, press the win and r keys at the same time, call out the run box, and enter cmd, as follows:
    insert image description here
  • In the second step, enter nvcc -V, if it looks like the following, it means that the installation is successful. Otherwise, it means that there must be an error in any step, and CUDA needs to be reinstalled.
    insert image description here

Two, cuDNN

1. Query and download cuDNN version

(1) Enter the cuDNN Download interface: https://developer.nvidia.com/rdp/cudnn-download , as follows, if it is not the following interface, there is a high probability that you have not logged in. If you do not have an account, just register one. In short, the interface after logging in is as follows, and then we need to check [Agree], and then click [Archived cuDNN Releases] to view the historical cuDNN version.
insert image description here

(2) In the cuDNN Archive interface, search for the cuDNN version suitable for CUDA11.6, as follows, I choose cuDNN v.8.5.0 version, and then click the left button to download the corresponding compressed package.
insert image description here

2. Install cuDNN

  • The first step is to unzip the cuDNN compressed package just downloaded and get three folders, as follows:
    insert image description here
    insert image description here

  • The second step is to copy the three folders in the red box above and paste them into the CUDA installation directory, that is, the location where CUDA was just installed, as follows:
    insert image description here
    insert image description here

3. Configure the environment variables of cuDNN

  • The first step is to search for environment variables in the computer [Settings], and click [Edit System Environment Variables].
    insert image description here

  • The second step is to click [Environment Variables] under [Advanced] in [System Properties].
    insert image description here

  • The third step is to double-click [Path] in [System Variables]
    insert image description here

  • Step 4: Click [New], and then add the following 4 environment variables one by one. If they already exist, don’t add them. If they don’t exist, just add them one by one.Note that the path filled here is consistent with the path we installed CUDA
    insert image description here

4. Check whether cuDNN is installed successfully

  • The first step, press the win and r keys at the same time, call out the run box, and enter cmd, as follows:
    insert image description here

  • The second step is to run deviceQuery.exe under the path of [D:\software\cuda11.6.0\extras\demo_suite] to check whether PASS appears. If PASS appears, it means that deviceQuery.exe runs successfully.
    insert image description here
    insert image description here

  • The third step is to run the bandwidthTest.exe under the path of [D:\software\cuda11.6.0\extras\demo_suite] to check whether there is a PASS. If there is a PASS, it means that the bandwidthTest.exe runs successfully.
    insert image description here

  • Step 4, if both deviceQuery.exe and bandwidthTest.exe run successfully, it means that cuDNN is installed successfully.

3. Query the version of CUDA and cuDNN

If you forget the version of CUDA and cuDNN during the subsequent use, you can find it in the following way.

1. Query the version of CUDA

  • The first step is to press the win and r keys at the same time to bring up the run box, enter [cmd], and then click [OK], as shown below:
    insert image description here
  • In the second step, enter [nvcc -V] to find the CUDA version, as shown below, you can see that the author's CUDA version is 11.6.
    insert image description here

2. Query the version of cuDNN

  • The first step, in the path where CUDA is installed, refer to the figure below, find the cudnn_version.h file, and then open it with Notepad.
    insert image description here

  • In the second step, in the cudnn_version.h file, search for CUDNN_MAJOR to find the corresponding cuDNN version, as follows, the author's cuDNN version should be 8.5.0.Note that some cuDNN version numbers are in the cudnn.h file. Anyway, you can try both cudnn_version.h and cudnn.h files.
    insert image description here

So far, this blog has come to a perfect end! Thank you all for reading! It is strongly recommended that you bookmark this blog to prevent it from being found next time~

Guess you like

Origin blog.csdn.net/qq_40968179/article/details/128996692