cuDNNのv8.8.1をインストールしようとしたところ、zlibのインストールも必要で、ビルド手順が書かれていなかったのでメモです。

CUDA、cuDNNのダウンロード、インストール、ファイルの配置や環境変数の設定は終わっている前提です。

また、以下のソフトウェアを使用します。

  • Visual Studio 2020 (x64 Native Tools Command Prompt for VS 2022を使用します)
  • cmake
  • git (zipファイルでダウンロードして展開するのであれば不要)

Installation Guide :: NVIDIA Deep Learning cuDNN Documentation
This cuDNN 8.8.1 Installation Guide provides step-by-step instructions on how to install and check for correct operation of NVIDIA cuDNN on Linux and Microsoft Windows systems.

NVIDIAのドキュメントではバイナリをダウンロードするよう指示がありますが、Chromeにブロックされてしまうのでソースからビルドします。

zlibのソースコードを取得します。

GitHub - madler/zlib: A massively spiffy yet delicately unobtrusive compression library.
A massively spiffy yet delicately unobtrusive compression library. - GitHub - madler/zlib: A massively spiffy yet delicately unobtrusive compression library.

x64 Native Tools Command Prompt for VS 2022を起動し、zlibをcloneしたフォルダに移動します。

mkdir build
cd build
cmake .. -G"Visual Studio 17"
msbuild /P:Configuration=Release  ALL_BUILD.vcxproj

build/Release/
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\

build/Releaseフォルダにzlib.dllが生成されるので、このファイルをzlibwapi.dllにリネームした上でcudnn64_8.dllファイルを配置したフォルダ(CUDA v12.1の場合特に変更していなければC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\)に配置します。