diff --git a/paddle/fluid/platform/cudnn_desc.h b/paddle/fluid/platform/cudnn_desc.h index 4ed51acb587ba042f7e6ff54713854da449eb723..39a50b3bc99d5bd699afa8cf717e5962b792d1ae 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 }