From 9d435973d2f1b9c0fab670ce4ff352f8ef3d1871 Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Mon, 18 Mar 2019 04:58:43 +0000 Subject: [PATCH] not use PERSISTENT in batch_norm. test=develop --- paddle/fluid/operators/batch_norm_op.cu | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/operators/batch_norm_op.cu b/paddle/fluid/operators/batch_norm_op.cu index 36d297ec552..32564516556 100644 --- a/paddle/fluid/operators/batch_norm_op.cu +++ b/paddle/fluid/operators/batch_norm_op.cu @@ -75,11 +75,15 @@ class BatchNormKernel << "CUDNN_BN_MIN_EPSILON instead."; } epsilon = std::max(epsilon, CUDNN_BN_MIN_EPSILON); -#if CUDNN_VERSION_MIN(7, 0, 0) - mode_ = CUDNN_BATCHNORM_SPATIAL_PERSISTENT; -#else + + // TODO(dengkaipeng): use PERSISTENT mode in training may incur errors + // in inference period, cuDNN fixed issues on PERSISTENT mode in version + // 7.0.2, 7.0.4 and 7.3.0, we disable this mode currently. +/* #if CUDNN_VERSION_MIN(7, 0, 0) */ +/* mode_ = CUDNN_BATCHNORM_SPATIAL_PERSISTENT; */ +/* #else */ mode_ = CUDNN_BATCHNORM_SPATIAL; -#endif +/* #endif */ VLOG(3) << "Setting descriptors."; std::vector dims; @@ -301,11 +305,15 @@ class BatchNormGradKernel << "CUDNN_BN_MIN_EPSILON instead."; } epsilon = std::max(epsilon, CUDNN_BN_MIN_EPSILON); -#if CUDNN_VERSION_MIN(7, 0, 0) - mode_ = CUDNN_BATCHNORM_SPATIAL_PERSISTENT; -#else + + // TODO(dengkaipeng): use PERSISTENT mode in training may incur errors + // in inference period, cuDNN fixed issues on PERSISTENT mode in version + // 7.0.2, 7.0.4 and 7.3.0, we disable this mode currently. +/* #if CUDNN_VERSION_MIN(7, 0, 0) */ +/* mode_ = CUDNN_BATCHNORM_SPATIAL_PERSISTENT; */ +/* #else */ mode_ = CUDNN_BATCHNORM_SPATIAL; -#endif +/* #endif */ CUDNN_ENFORCE(platform::dynload::cudnnSetTensorNdDescriptor( data_desc_, CudnnDataType::type, -- GitLab