Merge pull request #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
This commit is contained in:
cyy 2020-06-28 04:34:44 +08:00 committed by GitHub
parent 4e6a108bda
commit 206c843f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View File

@ -65,7 +65,11 @@ endif()
# extract version from the include
if(CUDNN_INCLUDE_DIR)
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 "")

View File

@ -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)

View File

@ -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)