Open REVRBE opened 1 month ago
Environment
- OS: Windows 10 x64]
- CUDA 12.6
- cuDNN 9.5
- OpenCV 4.8.0
Build failed with cudnn/recurrent.hpp error ‘cudnnSetRNNDescriptor_v6’ was not declared
, and this error doesn't seem to exist before cuDNN
9
Backport compat patch to build it.
diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake
index 3f1de208d..5b89cc3c2 100644
--- a/ports/opencv4/portfile.cmake
+++ b/ports/opencv4/portfile.cmake
@@ -13,6 +13,12 @@ vcpkg_download_distfile(CUDA_12_4_FIX
FILENAME opencv4-3e3ee106fb8ccd003aa2c9a943a2340b066537bc.patch
)
+vcpkg_download_distfile(PATCH_PR_25412_COMPAT_CUDNN_9
+ URLS https://github.com/opencv/opencv/commit/05e48605a0aea00d3a89b9ab5e25cdf89568aa28.patch?full_index=1
+ SHA512 1229c8c9845302942884fac16b36c43dfdeca60c250bd4684ee31bff0346048ecd52f10f770dd033ae12bd578a6e165e71e6ebdd306e3d4d48099267bfefd91d
+ FILENAME opencv4-05e48605a0aea00d3a89b9ab5e25cdf89568aa28.patch
+)
+
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO opencv/opencv
@@ -39,6 +45,7 @@ vcpkg_from_github(
"${ARM64_WINDOWS_FIX}"
0022-fix-supportqnx.patch
"${CUDA_12_4_FIX}"
+ "PATCH_PR_25412_COMPAT_CUDNN_9"
)
# Disallow accidental build of vendored copies
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr")
Build passed opencv[dnn-cuda]:x64-windows
and `opencv[dnn-cuda]:x64-windows-static
@REVRBE Could you please try the patch above? We have no CUDA device for further testing.
This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.
Describe the bug Whenever I try to load a model using CUDA as target and backend it throws this runtime error stated in the title.
net_.setPreferableBackend(cv::dnn::DNN_BACKEND_CUDA); net_.setPreferableTarget(cv::dnn::DNN_TARGET_CUDA);
Environment
To Reproduce Steps to reproduce the behavior:
Expected behavior I expected it to initialize CUDA when loading the weights and config e.g. use GPU for faster inference . I'd expect the DNN module to have been built with CUDA given that I have used the proper modules in the vcpkg install command.
Additional context Fetched and updated vcpkg prior to installation.
I'm using it in Visual Studio Community 2022 in a C++ project, and have linked the following .lib files: cudart_static.lib (from CUDA directory), opencv_world4.lib (from vcpkg) and cudnn.lib, yet no success.
I assume this is a vcpkg issue, as I think I have installed the proper modules for building the DNN module with CUDA, but apparently not. I have also tried the module 'dnn-cuda' (it also is unable to install, trying to reproduce it right now, will update if it successfully builds or not: .\vcpkg.exe install opencv[dnn-cuda]:x64-windows-static --recurse) but I can't seem to find any useful information online on this particular module, most places they just say to use 'cuda', 'cudnn' and 'dnn' module in the vcpkg install command.
EDIT 1 https://imgur.com/a/10RAQYy So I tried to install the 'dnn-cuda' module only, like this: .\vcpkg.exe install opencv[dnn-cuda]:x64-windows-static --recurse but it just fails with the error on the image. If log files are needed, please help me and tell me which one specifically :)
EDIT 2 Output from:
void print_opencv_info() { std::cout << "OpenCV version: " << cv::getBuildInformation() << std::endl; std::cout << "CUDA-enabled GPU devices: " << cv::cuda::getCudaEnabledDeviceCount() << std::endl; std::cout << "OpenCV version: " << CV_VERSION << std::endl; }
`OpenCV version: General configuration for OpenCV 4.8.0 ===================================== Version control: unknown
Extra modules: Location (extra): C:/vcpkg/vcpkg/buildtrees/opencv4/src/4.8.0-59c03c175c.clean/modules Version control (extra): unknown
Platform: Timestamp: 2024-10-18T08:47:03Z Host: Windows 10.0.19045 AMD64 CMake: 3.30.5 CMake generator: Ninja CMake build tool: C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe MSVC: 1937 Configuration: Release
CPU/HW features: Baseline: SSE SSE2 SSE3 requested: SSE3 Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX SSE4_1 (14 files): + SSSE3 SSE4_1 SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX AVX (7 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX AVX2 (33 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX512_SKX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
C/C++: Built as dynamic libs?: NO C++ standard: 11 C++ Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe (ver 19.37.32824.0) C++ flags (Release): /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /MP /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /FS /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 -openmp /MT /O2 /Oi /Gy /DNDEBUG /Z7 C++ flags (Debug): /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /MP /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /FS /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 -openmp /D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 C Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe C flags (Release): /nologo /DWIN32 /D_WINDOWS /utf-8 /MP /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /FS -openmp /MT /O2 /Oi /Gy /DNDEBUG /Z7 C flags (Debug): /nologo /DWIN32 /D_WINDOWS /utf-8 /MP /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /FS -openmp /D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 Linker flags (Release): /machine:x64 /NODEFAULTLIB:atlthunk.lib /nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF /debug /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcpmtd.lib /NODEFAULTLIB:msvcrtd.lib Linker flags (Debug): /machine:x64 /NODEFAULTLIB:atlthunk.lib /nologo /debug /INCREMENTAL /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:msvcrt.lib ccache: NO Precompiled headers: NO Extra dependencies: protobuf::libprotobuf comctl32 gdi32 ole32 setupapi ws2_32 hdf5::hdf5-static harfbuzz::harfbuzz quirc::quirc cudart_static.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cudnn.lib cufft.lib -LIBPATH:"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/lib/x64" 3rdparty dependencies:
OpenCV modules: To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab wechat_qrcode world xfeatures2d ximgproc xobjdetect xphoto Disabled: rgbd Disabled by dependency: - Unavailable: alphamat cvv gapi java julia matlab ovis python2 python2 python3 sfm ts viz Applications: - Documentation: NO Non-free algorithms: NO
Windows RT support: NO
GUI: Win32 UI: YES
Media I/O: ZLib: optimized C:/vcpkg/vcpkg/installed/x64-windows-static/lib/zlib.lib debug C:/vcpkg/vcpkg/installed/x64-windows-static/debug/lib/zlibd.lib (ver 1.3.1) JPEG: optimized C:/vcpkg/vcpkg/installed/x64-windows-static/lib/jpeg.lib debug C:/vcpkg/vcpkg/installed/x64-windows-static/debug/lib/jpeg.lib (ver 62) WEBP: (ver 1.4.0) PNG: optimized C:/vcpkg/vcpkg/installed/x64-windows-static/lib/libpng16.lib debug C:/vcpkg/vcpkg/installed/x64-windows-static/debug/lib/libpng16d.lib (ver 1.6.43) TIFF: optimized C:/vcpkg/vcpkg/installed/x64-windows-static/lib/tiff.lib debug C:/vcpkg/vcpkg/installed/x64-windows-static/debug/lib/tiffd.lib (ver 42 / 4.7.0) HDR: YES SUNRASTER: YES PXM: YES PFM: YES
Video I/O: DirectShow: YES Media Foundation: YES DXVA: YES
Parallel framework: OpenMP
Trace: YES (built-in)
Other third-party libraries: Custom HAL: NO Protobuf: optimized C:/vcpkg/vcpkg/installed/x64-windows-static/lib/libprotobuf.lib debug C:/vcpkg/vcpkg/installed/x64-windows-static/debug/lib/libprotobufd.lib version (25.1.0) Flatbuffers: 23.5.26
NVIDIA CUDA: YES (ver 12.6, CUFFT CUBLAS) NVIDIA GPU arch: 50 52 60 61 70 75 80 86 89 90 NVIDIA PTX archs:
cuDNN: YES (ver )
OpenCL: YES (NVD3D11) Include path: C:/vcpkg/vcpkg/buildtrees/opencv4/src/4.8.0-f4e8005717.clean/3rdparty/include/opencl/1.2 Link libraries: Dynamic load
Python (for build): NO
Install to: C:/vcpkg/vcpkg/packages/opencv4_x64-windows-static
CUDA-enabled GPU devices: 1 OpenCV version: 4.8.0 [ WARN:0@0.079] global net_impl.cpp:178 cv::dnn::dnn4_v20230620::Net::Impl::setUpNet DNN module was not built with CUDA backend; switching to CPU`