cuda Installation#
1. Installation of cuda#
Go to https://developer.nvidia.com/cuda-toolkit to download. When installing, be sure to customize the installation, otherwise many unnecessary things will be installed. For the installation options, you can choose not to update the driver.
Alternatively, download the offline file for installation.
Install and choose custom installation.
After installation, the programs related to Nvidia cuda are shown in the following figure.
Note: Do not check unnecessary things like Nsight Visual Studio Edition 2019.2.
2. Test if the environment is successfully installed#
Run cmd and enter nvcc --version
to view the version number;
set cuda
can be used to view the environment variables set for cuda.
Installation of cudnn#
The address for cuDNN is as follows, but please note that we need to register an account to enter the download page. You can register with confidence.
cuDNN Download | NVIDIA Developer
The download result is a compressed package.
Configuration of cuDNN#
It is more accurate to call it the configuration of cuDNN. First, unzip the downloaded cuDNN, and you will get the following files:
Unzipped files:
After downloading, it is found that cudnn is not an exe file, but a compressed package. After unzipping, there are three folders. Copy these three folders to the installation directory of cuda.
The installation path of CUDA can be found in the previous screenshot, or you can check the environment variables of your computer. The default installation path is as follows:
When copying, you will see that there is a folder with the same name as cuDNN in the installation directory of CUDA. Don't worry, just copy it directly. The configuration files in the folder with the same name as cuDNN after unzipping will be added to the folder with the same name in the CUDA installation directory. [It is still recommended to copy the contents of the folders to the corresponding folders separately]
cuDNN is actually a patch for CUDA, optimized for deep learning operations. Then add the environment variables.
First, copy the files with the same name as cudnn to the location where cuda is installed.
Configure environment variables