dlib 无法与 cuda 一起安装 - 说我缺少 cudnn

问题描述 投票:0回答:1

Windows 11
Visual Studio 17 2022
cuDNN v9.0
Cuda v12.3

我已将环境变量设置为:
$env:CUDA_PATH = "C:\Program Files\NVIDIA GPU 计算工具包\CUDA 12.3"

此外,我的 $path 中有以下内容:
C:\Program Files\NVIDIA GPU 计算工具包\CUDA 12.3 in
C:\Program Files\NVIDIA\CUDNN 9.0 中

我克隆了存储库:

git clone https://github.com/davisking/dlib.git
cd dlib
git submodule init
git submodule update

创建了一个构建目录:

cd dlib
mkdir build
cd build

然后我就跑

cmake -G "Visual Studio 17 2022" .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1 

我收到以下错误:

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.3 (found suitable version "12.3", minimum required is "7.5")
-- Looking for cuDNN install...
-- *** cuDNN V5.0 OR GREATER NOT FOUND.                              ***                      
-- *** Dlib requires cuDNN V5.0 OR GREATER.  Since cuDNN is not found DLIB WILL NOT USE CUDA. ***
-- *** If you have cuDNN then set CMAKE_PREFIX_PATH to include cuDNNs folder.                ***
-- Disabling CUDA support for dlib.  DLIB WILL NOT USE CUDA
-- Searching for FFMPEG/LIBAV
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- PkgConfig could not be found, FFMPEG wont be available
-- Configuring done (7.6s)
-- Generating done (0.0s)
-- Build files have been written to: E:/pythonProj/dlib/build

按照错误中的建议,我尝试了以下方法,但得到了相同的结果:

cmake -G "Visual Studio 17 2022" .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1 -DCMAKE_PREFIX_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0"

任何想法,我如何告诉 dlib 我已经安装了 CUDNN?

2024 年 4 月 5 日更新:
好吧,我想我明白了。我查看了 CMakeLists.txt 文件,发现了两个附加参数:

DCMAKE_INCLUDE_PATH
DCMAKE_LIBRARY_PATH

所以最后一个结果是:

cmake -G "Visual Studio 17 2022" .. `
-DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1 `
-DCMAKE_PREFIX_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0;C:\Program Files (x86)\Intel\oneAPI\mkl\latest" `
-DCMAKE_INCLUDE_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0\include\12.3;C:\Program Files (x86)\Intel\oneAPI\mkl\latest\include" `
-DCMAKE_LIBRARY_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0\lib\12.3\x64;C:\Program Files (x86)\Intel\oneAPI\mkl\latest\lib"
python-3.x face-recognition dlib cudnn
1个回答
0
投票

好吧,我想我明白了。结果我的CPU不支持AVX所以最终的配置是:

cmake -G "Visual Studio 17 2022" .. `
-DDLIB_USE_CUDA=1 `
-DCMAKE_PREFIX_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0;C:\Program Files (x86)\Intel\oneAPI\mkl\latest" `
-DCMAKE_INCLUDE_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0\include\12.3;C:\Program Files (x86)\Intel\oneAPI\mkl\latest\include" `
-DCMAKE_LIBRARY_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0\lib\12.3\x64;C:\Program Files (x86)\Intel\oneAPI\mkl\latest\lib"

Python 最终是:

python setup.py install -G "Visual Studio 17 2022" `
--clean `
--set DLIB_USE_CUDA=1 `
--set CMAKE_PREFIX_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0;C:\Program Files (x86)\Intel\oneAPI\mkl\latest" `
--set CMAKE_INCLUDE_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0\include\12.3;C:\Program Files (x86)\Intel\oneAPI\mkl\latest\include" `
--set CMAKE_LIBRARY_PATH="C:\Program Files\NVIDIA\CUDNN\v9.0\lib\12.3\x64;C:\Program Files (x86)\Intel\oneAPI\mkl\latest\lib"

并且编译和安装没有任何错误

© www.soinside.com 2019 - 2024. All rights reserved.