Skip to content

Commit cda6031

Browse files
committed
Fix compling with cuDNN v5
test=develop
1 parent 1d3e9bd commit cda6031

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
@@ -36,15 +36,18 @@ endif()
3636

3737
register_operators(EXCLUDES warpctc_op conv_fusion_op)
3838

39-
# warpctc_cudnn need cudnn 7 above
39+
# warpctc_op needs cudnn 7 above
4040
if (WITH_GPU)
4141
if (${CUDNN_MAJOR_VERSION} VERSION_LESS 7)
4242
op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale SRCS warpctc_op.cc warpctc_op.cu.cc)
4343
else()
4444
op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale)
4545
endif()
46-
op_library(conv_fusion_op)
47-
file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(conv2d_fusion);\n")
46+
# conv_fusion_op needs cudnn 7 above
47+
if (NOT ${CUDNN_MAJOR_VERSION} VERSION_LESS 7)
48+
op_library(conv_fusion_op)
49+
file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(conv2d_fusion);\n")
50+
endif()
4851
else()
4952
op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale)
5053
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)