// Beginning in cuDNN 7, the binary compatibility of a patch and minor releases is maintained as follows:
// Any patch release x.y.z is forward or backward-compatible with applications built against another cuDNN patch release x.y.w (meaning, of the same major and minor version number, but having w!=z).
// cuDNN minor releases beginning with cuDNN 7 are binary backward-compatible with applications built against the same or earlier patch release (meaning, an application built against cuDNN 7.x is binary compatible with cuDNN library 7.y, where y>=x).
// Applications compiled with a cuDNN version 7.y are not guaranteed to work with 7.x release when y > x.
oss<<"CUDART reports version "<<cudart_version<<" which does not match with the version "<<CUDART_VERSION<<" with which OpenCV was built";
oss<<"cuDNN reports version "<<cudnn_major_bversion<<"."<<cudnn_minor_bversion<<" which is not compatible with the version "<<CUDNN_MAJOR<<"."<<CUDNN_MINOR<<" with which OpenCV was built";
CV_LOG_WARNING(NULL,oss.str().c_str());
}
autocudnn_version=cudnnGetVersion();
if(cudnn_version!=CUDNN_VERSION)
{
std::ostringstreamoss;
oss<<"cuDNN reports version "<<cudnn_version<<" which does not match with the version "<<CUDNN_VERSION<<" with which OpenCV was built";
CV_LOG_WARNING(NULL,oss.str().c_str());
}
autocudnn_cudart_version=cudnnGetCudartVersion();
if(cudart_version!=cudnn_cudart_version)
{
std::ostringstreamoss;
oss<<"CUDART version "<<cudnn_cudart_version<<" reported by cuDNN "<<cudnn_version<<" does not match with the version reported by CUDART "<<cudart_version;
@ -2363,6 +2362,9 @@ struct Net::Impl : public detail::NetImplBase
CV_Assert(preferableBackend==DNN_BACKEND_CUDA);
CV_Assert(preferableBackend==DNN_BACKEND_CUDA);
#ifdef HAVE_CUDA
#ifdef HAVE_CUDA
if(!cudaInfo)/* we need to check only once */
cuda4dnn::checkVersions();
if(cuda4dnn::getDeviceCount()<=0)
if(cuda4dnn::getDeviceCount()<=0)
CV_Error(Error::StsError,"No CUDA capable device found.");
CV_Error(Error::StsError,"No CUDA capable device found.");
@ -2373,7 +2375,10 @@ struct Net::Impl : public detail::NetImplBase
CV_Error(Error::GpuNotSupported,"OpenCV was not built to work with the selected device. Please check CUDA_ARCH_PTX or CUDA_ARCH_BIN in your build configuration.");
CV_Error(Error::GpuNotSupported,"OpenCV was not built to work with the selected device. Please check CUDA_ARCH_PTX or CUDA_ARCH_BIN in your build configuration.");