Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to compile DLIB with CUDNN. CUDA v11 with CUDNN v8 Windows 10, Python #2108

Closed
Monnoo-stack opened this issue Jun 20, 2020 · 16 comments
Closed

Comments

@Monnoo-stack
Copy link

##Version Details
Windows 10
Cmake 3.17.3
dlib 19.20.0
CUDA v11
CUDNN v8
python 3.8.3
NVIDIA Geforce 1050 TI

##Summary
I am trying to do facial recognition and have reached a roadblock. I am unable to compile DLIB with CUDNN as it gives me an error saying CUDNN is found but is the wrong version. I tried installing CUDA v10.2 with CUDNN v7.6.5 and that seemed to compile with CUDNN however I ran into an issue where I get the following error: ImportError: DLL load failed: The specified module could not be found

Expected Behavior

DLIB Compiles with CUDNN

Current Behavior

-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0 (found suitable version "11.0", minimum required is "7.5")
-- Looking for cuDNN install...
-- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/lib/x64/cudnn.lib
-- Building a CUDA test project to see if your compiler is compatible with CUDA...
-- Checking if you have the right version of cuDNN installed.
-- *** Found cuDNN, but it looks like the wrong version so dlib will not use it. ***
-- *** 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 cuDNN's folder. ***
-- Disabling CUDA support for dlib. DLIB WILL NOT USE CUDA
-- C++11 activated.

##Request
I am completely new to programming so I would be very grateful if you could be clear as to what steps I need to take and how to take them.

@rafale77
Copy link

I am having the same problem on ubuntu. I think the current repo is not yet supporting these newer versions of CUDA and cuDNN.

@Monnoo-stack
Copy link
Author

I am having the same problem on ubuntu. I think the current repo is not yet supporting these newer versions of CUDA and cuDNN.

This might be the case however I struggled to find cases of this among other people so I can only imagine it isn't as widespread of an issue. Furthermore I tried an earlier version as I had mentioned which also led to errors

@davisking
Copy link
Owner

I just updated dlib to support cuDNN 8.0. So try the latest code on github.

@Monnoo-stack
Copy link
Author

I just updated dlib to support cuDNN 8.0. So try the latest code on github.

Just tried downloading from github and installing it with pip. Ran into the exact same issue and error as quoted

@davisking
Copy link
Owner

What did you type exactly?

@Monnoo-stack
Copy link
Author

I downloaded dlib from github then did pip install -v D:\dlib-master

@davisking
Copy link
Owner

Go into the dlib folder and type this instead and paste the output:

cd dlib
mkdir build
cd build
cmake ..

@Monnoo-stack
Copy link
Author

Hey, I managed to figure out how to do the build thing. Here's the output from that.

(venv) D:\dlib-master\dlib>cmake ..
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.26.28806.0
-- The CXX compiler identification is MSVC 19.26.28806.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CMake version: 3.17.3
-- Compiling dlib version: 19.20.99
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Enabling SSE2 instructions
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0 (found suitable version "11.0", minimum required is "7.5")
-- Looking for cuDNN install...
-- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/lib/x64/cudnn.lib
-- Building a CUDA test project to see if your compiler is compatible with CUDA...
-- Checking if you have the right version of cuDNN installed.
-- *** Found cuDNN, but it looks like the wrong version so dlib will not use it. ***
-- *** 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 cuDNN's folder. ***
-- Disabling CUDA support for dlib. DLIB WILL NOT USE CUDA
-- C++11 activated.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/dlib-master/dlib

@davisking
Copy link
Owner

That test is just trying to build the cd dlib/cmake_utils/test_for_cudnn project. So do

cd dlib/cmake_utils/test_for_cudnn
mkdir build
cd build
cmake ..
cmake --build .

What does that say?

@davisking
Copy link
Owner

Actually, just pull the latest dlib from github and try building again. I updated the cmake settings so you should get more informative output. So just pull from github and do the cmake build again, and post the output here.

@Monnoo-stack
Copy link
Author

Okay so this is the error I get. Seems like a file is missing but I'm not sure which since I installed cudnn properly to the best of my knowledge. If you could tell me how to proceed I'd be highly grateful.

-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0 (found suitable version "11.0", minimum required is "7.5")
-- Looking for cuDNN install...
-- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/lib/x64/cudnn.lib
-- Building a CUDA test project to see if your compiler is compatible with CUDA...
-- Building a cuDNN test project to check if you have the right version of cuDNN installed...
-- *****************************************************************************************************
-- *** Found cuDNN, but we failed to compile the dlib/cmake_utils/test_for_cudnn project.
-- *** You either have an unsupported version of cuDNN or something is wrong with your cudDNN install.
-- *** Since a functional cuDNN is not found DLIB WILL NOT USE CUDA.
-- *** The output of the failed test_for_cudnn build is:
-- ***
-- ***   Change Dir: C:/Users/Monnoo/AppData/Local/Temp/pip-req-build-8gmh8gra/build/temp.win-amd64-3.8/Release/dlib_build/cudnn_test_build
   ***
   ***   Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe ALL_BUILD.vcxproj /p:Configuration=Debug /p:Platform=x64 /p

:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework
*** Copyright (C) Microsoft Corporation. All rights reserved.
***
*** C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(475,5): warning MSB8029: The Intermediate directory or Outp
ut directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Monnoo\AppData\Local\Temp\pip-req-build-8gmh8gra\build\temp.win-amd64
-3.8\Release\dlib_build\cudnn_test_build\ZERO_CHECK.vcxproj]
*** Checking Build System
*** C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(475,5): warning MSB8029: The Intermediate directory or Outp
ut directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Monnoo\AppData\Local\Temp\pip-req-build-8gmh8gra\build\temp.win-amd64
-3.8\Release\dlib_build\cudnn_test_build\cudnn_test.vcxproj]
*** Building Custom Rule C:/Users/Monnoo/AppData/Local/Temp/pip-req-build-8gmh8gra/dlib/cmake_utils/test_for_cudnn/CMakeLists.txt
*** cudnn_dlibapi.cpp
*** C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include\cudnn.h(59,10): fatal error C1083: Cannot open include file: 'cudnn_version.h': No such file or directory [C:
\Users\Monnoo\AppData\Local\Temp\pip-req-build-8gmh8gra\build\temp.win-amd64-3.8\Release\dlib_build\cudnn_test_build\cudnn_test.vcxproj]
***
***
-- *****************************************************************************************************
-- Disabling CUDA support for dlib. DLIB WILL NOT USE CUDA
-- C++11 activated.

@davisking
Copy link
Owner

I would download cuDNN again and make sure you get that missing file.

@Monnoo-stack
Copy link
Author

Okay so it turns out CUDNN v8 has some extra files in the include folder that you have to copy into the CUDA folder along with the normal 3 files. That seems to have resolved it. Thank you for the help

@petargyurov
Copy link

Okay so it turns out CUDNN v8 has some extra files in the include folder that you have to copy into the CUDA folder along with the normal 3 files. That seems to have resolved it. Thank you for the help

For anyone else having issues with cudnn v8, the files they're referring to are all the files in the include folder. Copy those to your install path, i.e.: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include.

Re-run the dlib installation, but ensure you don't use the cache: pip install dlib --verbose --no-cache-dir

You should see the following during installation:

  -- Looking for cuDNN install...
  -- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.4/lib/x64/cudnn.lib
  -- Building a CUDA test project to see if your compiler is compatible with CUDA...
  -- Building a cuDNN test project to check if you have the right version of cuDNN installed...
  -- Enabling CUDA support for dlib.  DLIB WILL USE CUDA

@rosebbb
Copy link

rosebbb commented Apr 10, 2022

Which include folder are you referring to? Thanks!

Okay so it turns out CUDNN v8 has some extra files in the include folder that you have to copy into the CUDA folder along with the normal 3 files. That seems to have resolved it. Thank you for the help

For anyone else having issues with cudnn v8, the files they're referring to are all the files in the include folder. Copy those to your install path, i.e.: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include.

Re-run the dlib installation, but ensure you don't use the cache: pip install dlib --verbose --no-cache-dir

You should see the following during installation:

  -- Looking for cuDNN install...
  -- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.4/lib/x64/cudnn.lib
  -- Building a CUDA test project to see if your compiler is compatible with CUDA...
  -- Building a cuDNN test project to check if you have the right version of cuDNN installed...
  -- Enabling CUDA support for dlib.  DLIB WILL USE CUDA

@danniserena
Copy link

Okay so it turns out CUDNN v8 has some extra files in the include folder that you have to copy into the CUDA folder along with the normal 3 files. That seems to have resolved it. Thank you for the help

For anyone else having issues with cudnn v8, the files they're referring to are all the files in the include folder. Copy those to your install path, i.e.: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include.

Re-run the dlib installation, but ensure you don't use the cache: pip install dlib --verbose --no-cache-dir

You should see the following during installation:

  -- Looking for cuDNN install...
  -- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.4/lib/x64/cudnn.lib
  -- Building a CUDA test project to see if your compiler is compatible with CUDA...
  -- Building a cuDNN test project to check if you have the right version of cuDNN installed...
  -- Enabling CUDA support for dlib.  DLIB WILL USE CUDA

Thank you so much! It really helped! I manually downloaded source code and tried to compile dlib with cmake and after trying every way I still couldn't make it. This is simple and helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants