First, make sure you are using an NVIDIA graphics card, otherwise, it won't work even if you install it.
Installing CUDA
- Update your graphics card driver to the latest version, then execute
nvidia-smi
to check the maximum CUDA version number that can be installed. Do not install a CUDA version higher than the one shown here. For example, if the maximum allowed CUDA version shown is 11.8, you cannot install CUDA 12.1.
- First, open the website https://developer.nvidia.com/cuda-downloads. According to your operating system version, select the corresponding CUDA version. For example, in the image below, x86_64 Windows 10 is selected, then click exe[local].
Note: If the current version is greater than the version allowed by your computer, for example, after executing nvidia-smi
, the allowed version is 11.8, but here it is 12.3, then you cannot install it. You need to click this link https://developer.nvidia.com/cuda-toolkit-archive to download the older version.
After downloading, double-click to open it.
Then click OK, and in the following image, select "Custom Installation", and then Next.
In the custom installation options interface, only select "CUDA", and deselect all others, as shown below.
After installation, it will be installed by default in the C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1
directory. If you installed version 11.8, then change the final v12.1
to v11.8
, and so on. If the installation is successful but this directory does not exist, please check if it is in the C:\Program Files(x86)\NVIDIA GPU Computing Toolkit\CUDA\v12.1
directory.
Installing cuDNN
- After installing CUDA, open the website https://developer.nvidia.com/rdp/cudnn-download. This website may require login. If you don't have an account, register and log in first. After opening, you may need to fill out a questionnaire, as shown in the figure.
- After submission, you will reach the download page. Select the download according to your operating system version.
- After downloading, double-click to install, and click Next to complete the installation.
Configuring Environment Variables (May have been added automatically, please add manually if not added)
Press Window + the Pause key in the upper right corner of the keyboard. In the settings page that opens, find Advanced settings, open it, find Environment Variables -- System Variables, and add four records, as follows. The specific version numbers will vary depending on the version you installed. First, check if they already exist; if they do, you don't need to add them.
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\lib
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp
The final effect
Testing for Success
- Execute
nvcc -V
. Successful execution will return the CUDA version number.
Installing cuBLASxx.dll
In faster mode, sometimes the error "cublasxxx.dll does not exist" will be reported.
Please download this file, and then copy the dll file inside to the C:/Windows/System32 directory or the software root directory, i.e., the directory where the exe file is located.
In any folder address bar, type cmd
to open the black window, and enter the command nvcc -V
to view the current CUDA version.
For CUDA 11.x version, click here to download: https://github.com/jianchang512/stt/releases/download/0.0/cuBLAS.and.cuDNN_CUDA11_win_v4.7z
For CUDA 12.x version, click here to download: https://github.com/jianchang512/stt/releases/download/0.0/cuBLAS.and.cuDNN_CUDA12_win_v1.7z