Skip to content

Commit 5d4d117

Browse files
authored
Merge pull request #14502 from qingqing01/cudnn5_fix
Fix compling with cuDNN v5
2 parents e68c1fc + cda6031 commit 5d4d117

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

paddle/fluid/operators/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ endif()
4141

4242
register_operators(EXCLUDES warpctc_op conv_fusion_op DEPS ${OP_HEADER_DEPS})
4343

44-
# warpctc_cudnn need cudnn 7 above
44+
# warpctc_op needs cudnn 7 above
4545
if (WITH_GPU)
4646
if (${CUDNN_MAJOR_VERSION} VERSION_LESS 7)
4747
op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale SRCS warpctc_op.cc warpctc_op.cu.cc)
4848
else()
4949
op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale)
5050
endif()
51-
op_library(conv_fusion_op)
52-
file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(conv2d_fusion);\n")
51+
# conv_fusion_op needs cudnn 7 above
52+
if (NOT ${CUDNN_MAJOR_VERSION} VERSION_LESS 7)
53+
op_library(conv_fusion_op)
54+
file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(conv2d_fusion);\n")
55+
endif()
5356
else()
5457
op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale)
5558
endif()

paddle/fluid/operators/conv_fusion_op.cu.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ DECLARE_bool(cudnn_exhaustive_search);
2222
namespace paddle {
2323
namespace operators {
2424

25+
#if CUDNN_VERSION >= 7001
2526
using Tensor = framework::Tensor;
2627
using ScopedTensorDescriptor = platform::ScopedTensorDescriptor;
2728
using ScopedFilterDescriptor = platform::ScopedFilterDescriptor;
@@ -178,10 +179,13 @@ class CUDNNConvFusionOpKernel : public framework::OpKernel<T> {
178179
workspace_handle.RunFunc(cudnn_func, workspace_size_in_bytes);
179180
}
180181
};
182+
#endif
181183

182184
} // namespace operators
183185
} // namespace paddle
184186

187+
#if CUDNN_VERSION >= 7001
185188
namespace ops = paddle::operators;
186189
REGISTER_OP_CUDA_KERNEL(conv2d_fusion, ops::CUDNNConvFusionOpKernel<float>,
187190
ops::CUDNNConvFusionOpKernel<double>);
191+
#endif

python/paddle/fluid/tests/unittests/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ if(NOT WITH_DISTRIBUTE)
2323
LIST(REMOVE_ITEM TEST_OPS test_dist_text_classification)
2424
endif(NOT WITH_DISTRIBUTE)
2525

26+
if (${CUDNN_MAJOR_VERSION} VERSION_LESS 7)
27+
LIST(REMOVE_ITEM TEST_OPS test_conv2d_fusion_op)
28+
endif()
29+
2630
list(REMOVE_ITEM TEST_OPS test_seq_concat_op) # FIXME(helin): https://github.com/PaddlePaddle/Paddle/issues/8290
2731
list(REMOVE_ITEM TEST_OPS test_modified_huber_loss_op) # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/5184
2832
list(REMOVE_ITEM TEST_OPS test_lstm_unit_op) # # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/5185

0 commit comments

Comments
 (0)