3

Apparently I correctly installed CUDA and CUDNN, but still FindCUDA finds CUDA, but FindCUDNN.cmake does not find CUDNN

What else should I check to debug this?

OS: Windows 10

cmake version 3.17.2

CUDA Version 10.2

CUDNN version cudnn-10.2-windows10-x64-v7.6.5.32

CUDA installed with installer, to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2

PATH set as instructed enter image description here

CUDNN files copied into respective bin, include, and lib folders

enter image description here

enter image description here

enter image description here

[cmake] -- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2 (found version "10.2") 
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
[cmake]   Could NOT find CUDNN (missing: CUDNN_LIBRARY CUDNN_INCLUDE_DIR)
[cmake] Call Stack (most recent call first):
[cmake]   C:/Program Files/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
[cmake]   cmake/FindCUDNN.cmake:90 (find_package_handle_standard_args)
[cmake]   CMakeLists.txt:17 (find_package)

The FindCUDNN.cmake: https://gist.github.com/WurmD/26af2940d8dec7cc48d38bc30fd1b3ef

WurmD
  • 1,231
  • 5
  • 21
  • 42

4 Answers4

3
...
set "cudaRoot=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.3"
...
-DCUDNN_LIBRARY="%cudaRoot%\lib" ^
-DCUDNN_INCLUDE_DIR="%cudaRoot%\include" ^
...
Lei Chen
  • 699
  • 1
  • 5
  • 13
1

I was compiling OpenCV with Visual Studio 2019; so I'll just go ahead and assume you were too - since I'm tired and I just got this issue resolved for myself.

  1. Be sure to REBOOT/RESTART your PC after "installation" of CUDNN
  2. Do a fresh GIT clone of opencv as well as opencv_contrib
  3. Be sure to make the BUILD folder in the opencv directory
  4. Set your required environmental variables; something like this but fill in your paths:



    set "CUDA_PATH=............/NVIDIA GPU Computing Toolkit/CUDA/v11.0"
    set "opencvSource=opencv"
    set "opencvExtraModules=opencv_contrib\modules"
    set "opencvBuild=%opencvSource%\build"
    set "compiler=Visual Studio 16 2019"
    set "buildType=Release"
    set "python3_executable=............/AppData/Local/Programs/Python/Python38/python.exe"
    set "python3_include_dir=............/AppData/Local/Programs/Python/Python38/include"
    set "python3_library=............/AppData/Local/Programs/Python/Python38/libs/python38.lib"
    set "python3_numpy_include_dirs=............/AppData/Local/Programs/Python/Python38/Lib/site-packages/numpy/core/include"
    set "python3_packages_path=............/AppData/Local/Programs/Python/Python38/Lib/site-packages"

  1. Re-run CMAKE (obviously change this to match your options), mine were:


    cmake ^
    -B"%opencvBuild%/" ^
    -H"%opencvSource%/" ^
    -G"%compiler%" ^
    -Ax64 ^
    -DCMAKE_BUILD_TYPE=%buildType% ^
    -DBUILD_opencv_python3=ON ^
    -DBUILD_opencv_world=ON ^
    -DBUILD_EXAMPLES=OFF ^
    -DBUILD_opencv_python_bindings_generator=ON ^
    -DOPENCV_PYTHON3_VERSION=3.8.3 ^
    -DPYTHON3_EXECUTABLE="%python3_executable%" ^
    -DPYTHON3_INCLUDE_DIR="%python3_include_dir%" ^
    -DPYTHON3_LIBRARY="%python3_library%" ^
    -DPYTHON3_NUMPY_INCLUDE_DIRS="%python3_numpy_include_dirs%" ^
    -DPYTHON3_PACKAGES_PATH="%python3_packages_path%" ^
    -DINSTALL_TESTS=OFF ^
    -DINSTALL_C_EXAMPLES=OFF ^
    -DOPENCV_EXTRA_MODULES_PATH="%opencvExtraModules%/" ^
    -DWITH_CUDA=ON ^
    -DCUDA_ARCH_BIN=6.1^
    -DCUDA_ARCH_PTX=7.5^
    -DCUDA_FAST_MATH=ON ^
    -DBUILD_PROTOBUF=ON 
Kyle
  • 553
  • 2
  • 7
0

With a fresh install of CuDNN, make sure to remove the cache of CMake via File and then Delete Cache. This will remove all settings, but recognize CuDNN.

Chris Fowl
  • 488
  • 4
  • 16
0

I have had this problem too. Changing from Win32 to x64 solved it for me. I guess it's looking at different paths when trying to build for Win32.

Wim Vanhenden
  • 841
  • 2
  • 12
  • 18