CUDA + cuDNN 安装教程

Windows 10, CUDA 10.2 cuDNN 7.6

  1. 下载 cuda 10.2, 访问链接: https://developer.nvidia.com/cuda-10.2-download-archive, 该页面会有几个选项, 分别配置为
  • Operating System: Windows
  • Architecture: x86_64
  • Version: 10
  • Installer Type: exe (local)

或者也可以直接访问: https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal.

需要下载的包括一个安装包和两个补丁文件包:

  • cuda_10.2.89_441.22_win10.exe
  • cuda_10.2.1_win10.exe
  • cuda_10.2.2_win10.exe
  1. 下载 cuDNN, 访问链接: https://developer.nvidia.com/rdp/cudnn-archive#a-collapse765-102, 定位到如下位置.

Download cuDNN v7.6.5 (November 18th, 2019), for CUDA 10.2
Library for Windows, Mac, Linux, Ubuntu and RedHat/Centos(x86_64architecture)
cuDNN Library for Windows 10

下载一个库文件压缩包:

  • cudnn-10.2-windows10-x64-v7.6.5.32.zip
  1. 安装

CUDA 直接依次双击安装即可

安装完成后打开 powershell 验证

1
2
3
4
5
6
(base) PS C:\Users\username> nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:32:27_Pacific_Daylight_Time_2019
Cuda compilation tools, release 10.2, V10.2.89
(base) PS C:\Users\username>

cuDNN 安装只需解压后把库文件复制到 CUDA 安装目录即可.

  • Copy <unzip path>\cuda\bin\cudnn*.dll to <CUDA PATH>\bin.
  • Copy <unzip path>\cuda\include\cudnn*.h to <CUDA PATH>\include.
  • Copy <unzip path>\cuda\lib\x64\cudnn*.lib to <CUDA PATH>\lib\x64.

复制完成后打开 powershell 验证, 到如下路径运行程序,Result = PASS表示安装成功.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(base) PS D:\CUDA\extras\demo_suite> bandwidthTest.exe
[CUDA Bandwidth Test] - Starting...
Running on...

Device 0: GeForce MX250
Quick Mode

Host to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 3067.2

Device to Host Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 3224.2

Device to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 47884.9

Result = PASS

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
(base) PS D:\CUDA\extras\demo_suite>
  1. 环境变量
    CUDA 安装好后系统环境变量中会出现CUDA_PATH,CUDA_PATH_V10_2 两个系统变量. 如果要在 VS 工程里使用 CUDA+cuDNN, 则最好在系统路径(Path) 里增加:
  • D:\CUDA\include
  • D:\CUDA\lib\x64
  • D:\CUDA\bin
  • D:\CUDA\libnvvp

(其中 D:\CUDA\ 就是我安装 cuda 的路径)

  1. 卸载

如果要更换 cuda/cudnn 版本, 或者是单纯想要卸载 cuda/cudnn, 可以直接在控制面板里操作, 卸载掉其中以 NVIDIA CUDA * 开头的几个即可.

Refer

CUDA + cuDNN 安装教程

https://luosiyou.cn/blogs/cuda_cudnn/

作者

Luo Siyou

发布于

2023-01-09

更新于

2023-01-09

许可协议