From 97f0ec23578123bea229374686d299098facd320 Mon Sep 17 00:00:00 2001 From: qingqing01 Date: Mon, 20 May 2019 09:35:32 +0800 Subject: [PATCH] Fix compiling error with cuDNN 5.1 (#17458) test=develop --- paddle/fluid/platform/cudnn_desc.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/platform/cudnn_desc.h b/paddle/fluid/platform/cudnn_desc.h index 4ed51acb58..39a50b3bc9 100644 --- a/paddle/fluid/platform/cudnn_desc.h +++ b/paddle/fluid/platform/cudnn_desc.h @@ -183,15 +183,17 @@ class ConvolutionDescriptor { CUDNN_ENFORCE(dynload::cudnnSetConvolutionNdDescriptor( desc, pads.size(), pads.data(), strides.data(), dilations.data(), CUDNN_CROSS_CORRELATION, compute_type)); - CUDNN_ENFORCE(platform::dynload::cudnnSetConvolutionMathType( - desc, CUDNN_DEFAULT_MATH)); #if CUDNN_VERSION_MIN(7, 0, 1) CUDNN_ENFORCE( platform::dynload::cudnnSetConvolutionGroupCount(desc, groups)); +#if CUDA_VERSION >= 9000 && CUDNN_VERSION_MIN(7, 0, 1) + CUDNN_ENFORCE(platform::dynload::cudnnSetConvolutionMathType( + desc, CUDNN_DEFAULT_MATH)); if (dtype == CUDNN_DATA_HALF) { CUDNN_ENFORCE(platform::dynload::cudnnSetConvolutionMathType( desc, CUDNN_TENSOR_OP_MATH)); } +#endif #endif } -- GitLab