Trevor
Trevor

Reputation: 81

dlib fails to install with cuda - says I am missing cudnn

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

I have set the enviromental variables to:
$env:CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3"

Additionally, my $path has the following in it:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\bin
C:\Program Files\NVIDIA\CUDNN\v9.0\bin

I cloned the repository:

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

created a build directory:

cd dlib
mkdir build
cd build

Then I run

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

and I get the following error:

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

As suggested in the error, I have tried the following, but I get the same results:

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

Any ideas, how do I tell dlib that I have CUDNN installed?

Update 4/5/2024:
ok, I think I figured it out. I looked in the CMakeLists.txt file and found two additional parameters:

DCMAKE_INCLUDE_PATH
DCMAKE_LIBRARY_PATH

so the final one ended up being:

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"

Upvotes: -3

Views: 478

Answers (1)

Trevor
Trevor

Reputation: 81

ok, I think I figured it out. Turns out my CPU does not support AVX so the final configure was:

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"

The python one ended up being:

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"

and it compiled and installed without any errors

Upvotes: 0

Related Questions