Skip to content

Commit 206c843

Browse files
authored
Merge pull request opencv#17499 from cyyever:fix_CUDA11
Fix cuda11 * use cudnn_version.h to detect version when it is available * remove nppi from CUDA11 * use ocv_list_filterout * dnn(cuda): temporary disable CUDNN 8.0
1 parent 4e6a108 commit 206c843

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

cmake/FindCUDNN.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ endif()
6565

6666
# extract version from the include
6767
if(CUDNN_INCLUDE_DIR)
68-
file(READ "${CUDNN_INCLUDE_DIR}/cudnn.h" CUDNN_H_CONTENTS)
68+
if(EXISTS "${CUDNN_INCLUDE_DIR}/cudnn_version.h")
69+
file(READ "${CUDNN_INCLUDE_DIR}/cudnn_version.h" CUDNN_H_CONTENTS)
70+
else()
71+
file(READ "${CUDNN_INCLUDE_DIR}/cudnn.h" CUDNN_H_CONTENTS)
72+
endif()
6973

7074
string(REGEX MATCH "define CUDNN_MAJOR ([0-9]+)" _ "${CUDNN_H_CONTENTS}")
7175
set(CUDNN_MAJOR_VERSION ${CMAKE_MATCH_1} CACHE INTERNAL "")

cmake/OpenCVDetectCUDA.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ endif()
3131

3232
if(CUDA_FOUND)
3333
set(HAVE_CUDA 1)
34+
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
35+
# CUDA 11.0 removes nppicom
36+
ocv_list_filterout(CUDA_nppi_LIBRARY "nppicom")
37+
ocv_list_filterout(CUDA_npp_LIBRARY "nppicom")
38+
endif()
3439

3540
if(WITH_CUFFT)
3641
set(HAVE_CUFFT 1)

modules/dnn/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@ if(OPENCV_DNN_OPENCL AND HAVE_OPENCL)
2121
add_definitions(-DCV_OCL4DNN=1)
2222
endif()
2323

24-
ocv_option(OPENCV_DNN_CUDA "Build with CUDA support" HAVE_CUDA AND HAVE_CUBLAS AND HAVE_CUDNN)
24+
if(NOT DEFINED OPENCV_DNN_CUDA AND HAVE_CUDNN AND CUDNN_VERSION VERSION_LESS 8.0)
25+
message(STATUS "DNN: CUDNN 8.0 is not supported yes. Details: https://github.com/opencv/opencv/issues/17496")
26+
endif()
27+
ocv_option(OPENCV_DNN_CUDA "Build with CUDA support"
28+
HAVE_CUDA
29+
AND HAVE_CUBLAS
30+
AND HAVE_CUDNN
31+
AND CUDNN_VERSION VERSION_LESS 8.0
32+
)
2533

2634
if(OPENCV_DNN_CUDA AND HAVE_CUDA AND HAVE_CUBLAS AND HAVE_CUDNN)
2735
add_definitions(-DCV_CUDA4DNN=1)

0 commit comments

Comments
 (0)