Skip to content

Commit

Permalink
Merge pull request opencv#17499 from cyyever:fix_CUDA11
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cyyever authored Jun 27, 2020
1 parent 4e6a108 commit 206c843
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cmake/FindCUDNN.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ endif()

# extract version from the include
if(CUDNN_INCLUDE_DIR)
file(READ "${CUDNN_INCLUDE_DIR}/cudnn.h" CUDNN_H_CONTENTS)
if(EXISTS "${CUDNN_INCLUDE_DIR}/cudnn_version.h")
file(READ "${CUDNN_INCLUDE_DIR}/cudnn_version.h" CUDNN_H_CONTENTS)
else()
file(READ "${CUDNN_INCLUDE_DIR}/cudnn.h" CUDNN_H_CONTENTS)
endif()

string(REGEX MATCH "define CUDNN_MAJOR ([0-9]+)" _ "${CUDNN_H_CONTENTS}")
set(CUDNN_MAJOR_VERSION ${CMAKE_MATCH_1} CACHE INTERNAL "")
Expand Down
5 changes: 5 additions & 0 deletions cmake/OpenCVDetectCUDA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ endif()

if(CUDA_FOUND)
set(HAVE_CUDA 1)
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
# CUDA 11.0 removes nppicom
ocv_list_filterout(CUDA_nppi_LIBRARY "nppicom")
ocv_list_filterout(CUDA_npp_LIBRARY "nppicom")
endif()

if(WITH_CUFFT)
set(HAVE_CUFFT 1)
Expand Down
10 changes: 9 additions & 1 deletion modules/dnn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ if(OPENCV_DNN_OPENCL AND HAVE_OPENCL)
add_definitions(-DCV_OCL4DNN=1)
endif()

ocv_option(OPENCV_DNN_CUDA "Build with CUDA support" HAVE_CUDA AND HAVE_CUBLAS AND HAVE_CUDNN)
if(NOT DEFINED OPENCV_DNN_CUDA AND HAVE_CUDNN AND CUDNN_VERSION VERSION_LESS 8.0)
message(STATUS "DNN: CUDNN 8.0 is not supported yes. Details: https://github.com/opencv/opencv/issues/17496")
endif()
ocv_option(OPENCV_DNN_CUDA "Build with CUDA support"
HAVE_CUDA
AND HAVE_CUBLAS
AND HAVE_CUDNN
AND CUDNN_VERSION VERSION_LESS 8.0
)

if(OPENCV_DNN_CUDA AND HAVE_CUDA AND HAVE_CUBLAS AND HAVE_CUDNN)
add_definitions(-DCV_CUDA4DNN=1)
Expand Down

0 comments on commit 206c843

Please sign in to comment.