From 0ded3f0457eb564620ca776bac81f79eb0dd0b5c Mon Sep 17 00:00:00 2001 From: gouzil <66515297+gouzil@users.noreply.github.com> Date: Fri, 5 May 2023 10:26:27 +0800 Subject: [PATCH] [test]mv fluid *test* to test (#53472) * [test]mv fluid *test* to test/cpp/fluid * [phi] fix link error --- paddle/fluid/operators/CMakeLists.txt | 27 ------ test/cpp/fluid/CMakeLists.txt | 85 +++++++++++++++++++ .../cpp/fluid}/assign_op_test.cc | 0 .../cpp/fluid}/beam_search_decode_op_test.cc | 0 .../fluid}/beam_search_decode_op_xpu_test.cc | 0 .../cpp/fluid}/copy_cross_scope_test.cc | 0 .../cpp/fluid}/dropout_op_test.cc | 0 .../cpp/fluid}/feed_forward_test.cu | 0 .../cpp/fluid}/gather_test.cc | 0 .../cpp/fluid}/op_debug_string_test.cc | 0 .../cpp/fluid}/save_load_combine_op_test.cc | 0 .../cpp/fluid}/save_load_op_test.cc | 0 .../cpp/fluid}/scatter_test.cc | 0 .../cpp/fluid}/share_buffer_op_test.cc | 0 .../test_common_infer_shape_functions.cc | 0 .../test_leaky_relu_grad_grad_functor.cc | 2 +- .../test_leaky_relu_grad_grad_functor.cu | 2 +- .../test_leaky_relu_grad_grad_functor.h | 0 18 files changed, 87 insertions(+), 29 deletions(-) rename {paddle/fluid/operators => test/cpp/fluid}/assign_op_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/beam_search_decode_op_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/beam_search_decode_op_xpu_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/copy_cross_scope_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/dropout_op_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/feed_forward_test.cu (100%) rename {paddle/fluid/operators => test/cpp/fluid}/gather_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/op_debug_string_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/save_load_combine_op_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/save_load_op_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/scatter_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/share_buffer_op_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/test_common_infer_shape_functions.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/test_leaky_relu_grad_grad_functor.cc (93%) rename {paddle/fluid/operators => test/cpp/fluid}/test_leaky_relu_grad_grad_functor.cu (93%) rename {paddle/fluid/operators => test/cpp/fluid}/test_leaky_relu_grad_grad_functor.h (100%) diff --git a/paddle/fluid/operators/CMakeLists.txt b/paddle/fluid/operators/CMakeLists.txt index 984dacfa8bf..a0d89394ece 100644 --- a/paddle/fluid/operators/CMakeLists.txt +++ b/paddle/fluid/operators/CMakeLists.txt @@ -151,7 +151,6 @@ if (WITH_GPU OR WITH_ROCM) set(COMMON_OP_DEPS ${COMMON_OP_DEPS} depthwise_conv prelu bert_encoder_functor) endif() if(WITH_XPU) - cc_test(beam_search_decode_op_xpu_test SRCS beam_search_decode_op_xpu_test.cc DEPS lod_tensor) set(COMMON_OP_DEPS ${COMMON_OP_DEPS} xpulib) endif() set(COMMON_OP_DEPS ${COMMON_OP_DEPS} layer) @@ -169,25 +168,6 @@ set(COMMON_OP_DEPS ${COMMON_OP_DEPS} op_version_registry) set(OPERATOR_DEPS ${OPERATOR_DEPS} ${COMMON_OP_DEPS}) set(GLOB_OPERATOR_DEPS ${OPERATOR_DEPS} CACHE INTERNAL "Global Op dependencies") -cc_test(test_common_infer_shape_functions SRCS test_common_infer_shape_functions.cc DEPS common_infer_shape_functions ${COMMON_OP_DEPS} activation_op elementwise_add_op softmax_op softmax) -cc_test(gather_test SRCS gather_test.cc DEPS tensor) -cc_test(assign_op_test SRCS assign_op_test.cc DEPS generated_static_op) -cc_test(scatter_test SRCS scatter_test.cc DEPS tensor math_function) -cc_test(beam_search_decode_op_test SRCS beam_search_decode_op_test.cc DEPS lod_tensor) -cc_test(save_load_op_test SRCS save_load_op_test.cc DEPS save_op load_op) -cc_test(save_load_combine_op_test SRCS save_load_combine_op_test.cc DEPS save_combine_op load_combine_op) -if (WITH_GPU) - nv_test(dropout_op_test SRCS dropout_op_test.cc DEPS dropout_op tensor generator) - nv_test(test_leaky_relu_grad_grad_functor SRCS test_leaky_relu_grad_grad_functor.cc test_leaky_relu_grad_grad_functor.cu DEPS tensor device_context eigen3) - nv_test(feed_forward_test SRCS feed_forward_test.cu DEPS elementwise_add_op matmul_op tensor generator) -elseif(WITH_ROCM) - hip_test(dropout_op_test SRCS dropout_op_test.cc DEPS dropout_op tensor generator) - hip_test(test_leaky_relu_grad_grad_functor SRCS test_leaky_relu_grad_grad_functor.cc test_leaky_relu_grad_grad_functor.cu DEPS tensor device_context eigen3) -else() - cc_test(test_leaky_relu_grad_grad_functor SRCS test_leaky_relu_grad_grad_functor.cc DEPS tensor device_context eigen3) -endif() -cc_test(share_buffer_op_cpp_test SRCS share_buffer_op_test.cc DEPS lod_tensor device_context generated_static_op) - cc_library(tensor_formatter SRCS tensor_formatter.cc DEPS ${OP_HEADER_DEPS}) if (WITH_PYTHON) cc_library(py_func_op SRCS py_func_op.cc DEPS op_registry python pybind) @@ -195,9 +175,6 @@ endif() set(GLOB_OP_LIB ${OP_LIBRARY} CACHE INTERNAL "Global OP library") -cc_test_old(op_debug_string_test SRCS op_debug_string_test.cc DEPS elementwise_add_op ${COMMON_OP_DEPS}) - - if(WITH_MKLDNN) include(mkldnn/inplace_op_tests.cmake) include(mkldnn/caching_tests.cmake) @@ -211,10 +188,6 @@ if(WITH_UNITY_BUILD) target_link_libraries(paddle_operators_unity ${OP_HEADER_DEPS} ${COMMON_OP_DEPS}) endif() -if (WITH_GPU) -cc_test(copy_cross_scope_test SRCS copy_cross_scope_test.cc DEPS op_registry copy_cross_scope_op scope device_context enforce executor) -endif() - copy_if_different(${pybind_file} ${pybind_file_final}) if (WITH_CUSTOM_DEVICE) diff --git a/test/cpp/fluid/CMakeLists.txt b/test/cpp/fluid/CMakeLists.txt index ad9160b9750..029cf3db905 100644 --- a/test/cpp/fluid/CMakeLists.txt +++ b/test/cpp/fluid/CMakeLists.txt @@ -22,3 +22,88 @@ add_subdirectory(prim_ops) add_subdirectory(reader) add_subdirectory(reduce_ops) # add_subdirectory(tensorrt) + +set(COMMON_OP_DEPS ${COMMON_OP_DEPS} executor) + +if(WITH_XPU) + cc_test( + beam_search_decode_op_xpu_test + SRCS beam_search_decode_op_xpu_test.cc + DEPS lod_tensor) + set(COMMON_OP_DEPS ${COMMON_OP_DEPS} xpulib) +endif() + +cc_test( + test_common_infer_shape_functions + SRCS test_common_infer_shape_functions.cc + DEPS common_infer_shape_functions ${COMMON_OP_DEPS} activation_op + elementwise_add_op softmax_op softmax) +cc_test( + gather_test + SRCS gather_test.cc + DEPS tensor) +cc_test( + assign_op_test + SRCS assign_op_test.cc + DEPS generated_static_op) +cc_test( + scatter_test + SRCS scatter_test.cc + DEPS tensor math_function) +cc_test( + beam_search_decode_op_test + SRCS beam_search_decode_op_test.cc + DEPS lod_tensor) +cc_test( + save_load_op_test + SRCS save_load_op_test.cc + DEPS save_op load_op) +cc_test( + save_load_combine_op_test + SRCS save_load_combine_op_test.cc + DEPS save_combine_op load_combine_op) + +if(WITH_GPU) + nv_test( + dropout_op_test + SRCS dropout_op_test.cc + DEPS dropout_op tensor generator) + nv_test( + test_leaky_relu_grad_grad_functor + SRCS test_leaky_relu_grad_grad_functor.cc + test_leaky_relu_grad_grad_functor.cu + DEPS tensor device_context eigen3) + nv_test( + feed_forward_test + SRCS feed_forward_test.cu + DEPS elementwise_add_op matmul_op tensor generator) +elseif(WITH_ROCM) + hip_test( + dropout_op_test + SRCS dropout_op_test.cc + DEPS dropout_op tensor generator) + hip_test( + test_leaky_relu_grad_grad_functor + SRCS test_leaky_relu_grad_grad_functor.cc + test_leaky_relu_grad_grad_functor.cu + DEPS tensor device_context eigen3) +else() + cc_test( + test_leaky_relu_grad_grad_functor + SRCS test_leaky_relu_grad_grad_functor.cc + DEPS tensor device_context eigen3) +endif() +cc_test( + share_buffer_op_cpp_test + SRCS share_buffer_op_test.cc + DEPS lod_tensor device_context generated_static_op) + +cc_test_old(op_debug_string_test SRCS op_debug_string_test.cc DEPS + elementwise_add_op ${COMMON_OP_DEPS}) + +if(WITH_GPU) + cc_test( + copy_cross_scope_test + SRCS copy_cross_scope_test.cc + DEPS op_registry copy_cross_scope_op scope device_context enforce executor) +endif() diff --git a/paddle/fluid/operators/assign_op_test.cc b/test/cpp/fluid/assign_op_test.cc similarity index 100% rename from paddle/fluid/operators/assign_op_test.cc rename to test/cpp/fluid/assign_op_test.cc diff --git a/paddle/fluid/operators/beam_search_decode_op_test.cc b/test/cpp/fluid/beam_search_decode_op_test.cc similarity index 100% rename from paddle/fluid/operators/beam_search_decode_op_test.cc rename to test/cpp/fluid/beam_search_decode_op_test.cc diff --git a/paddle/fluid/operators/beam_search_decode_op_xpu_test.cc b/test/cpp/fluid/beam_search_decode_op_xpu_test.cc similarity index 100% rename from paddle/fluid/operators/beam_search_decode_op_xpu_test.cc rename to test/cpp/fluid/beam_search_decode_op_xpu_test.cc diff --git a/paddle/fluid/operators/copy_cross_scope_test.cc b/test/cpp/fluid/copy_cross_scope_test.cc similarity index 100% rename from paddle/fluid/operators/copy_cross_scope_test.cc rename to test/cpp/fluid/copy_cross_scope_test.cc diff --git a/paddle/fluid/operators/dropout_op_test.cc b/test/cpp/fluid/dropout_op_test.cc similarity index 100% rename from paddle/fluid/operators/dropout_op_test.cc rename to test/cpp/fluid/dropout_op_test.cc diff --git a/paddle/fluid/operators/feed_forward_test.cu b/test/cpp/fluid/feed_forward_test.cu similarity index 100% rename from paddle/fluid/operators/feed_forward_test.cu rename to test/cpp/fluid/feed_forward_test.cu diff --git a/paddle/fluid/operators/gather_test.cc b/test/cpp/fluid/gather_test.cc similarity index 100% rename from paddle/fluid/operators/gather_test.cc rename to test/cpp/fluid/gather_test.cc diff --git a/paddle/fluid/operators/op_debug_string_test.cc b/test/cpp/fluid/op_debug_string_test.cc similarity index 100% rename from paddle/fluid/operators/op_debug_string_test.cc rename to test/cpp/fluid/op_debug_string_test.cc diff --git a/paddle/fluid/operators/save_load_combine_op_test.cc b/test/cpp/fluid/save_load_combine_op_test.cc similarity index 100% rename from paddle/fluid/operators/save_load_combine_op_test.cc rename to test/cpp/fluid/save_load_combine_op_test.cc diff --git a/paddle/fluid/operators/save_load_op_test.cc b/test/cpp/fluid/save_load_op_test.cc similarity index 100% rename from paddle/fluid/operators/save_load_op_test.cc rename to test/cpp/fluid/save_load_op_test.cc diff --git a/paddle/fluid/operators/scatter_test.cc b/test/cpp/fluid/scatter_test.cc similarity index 100% rename from paddle/fluid/operators/scatter_test.cc rename to test/cpp/fluid/scatter_test.cc diff --git a/paddle/fluid/operators/share_buffer_op_test.cc b/test/cpp/fluid/share_buffer_op_test.cc similarity index 100% rename from paddle/fluid/operators/share_buffer_op_test.cc rename to test/cpp/fluid/share_buffer_op_test.cc diff --git a/paddle/fluid/operators/test_common_infer_shape_functions.cc b/test/cpp/fluid/test_common_infer_shape_functions.cc similarity index 100% rename from paddle/fluid/operators/test_common_infer_shape_functions.cc rename to test/cpp/fluid/test_common_infer_shape_functions.cc diff --git a/paddle/fluid/operators/test_leaky_relu_grad_grad_functor.cc b/test/cpp/fluid/test_leaky_relu_grad_grad_functor.cc similarity index 93% rename from paddle/fluid/operators/test_leaky_relu_grad_grad_functor.cc rename to test/cpp/fluid/test_leaky_relu_grad_grad_functor.cc index 9a06a9a2762..2dceaf49379 100644 --- a/paddle/fluid/operators/test_leaky_relu_grad_grad_functor.cc +++ b/test/cpp/fluid/test_leaky_relu_grad_grad_functor.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/fluid/operators/test_leaky_relu_grad_grad_functor.h" +#include "test/cpp/fluid/test_leaky_relu_grad_grad_functor.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/test_leaky_relu_grad_grad_functor.cu b/test/cpp/fluid/test_leaky_relu_grad_grad_functor.cu similarity index 93% rename from paddle/fluid/operators/test_leaky_relu_grad_grad_functor.cu rename to test/cpp/fluid/test_leaky_relu_grad_grad_functor.cu index 6f0f840b8c5..9778ab82e7b 100644 --- a/paddle/fluid/operators/test_leaky_relu_grad_grad_functor.cu +++ b/test/cpp/fluid/test_leaky_relu_grad_grad_functor.cu @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/fluid/operators/test_leaky_relu_grad_grad_functor.h" +#include "test/cpp/fluid/test_leaky_relu_grad_grad_functor.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/test_leaky_relu_grad_grad_functor.h b/test/cpp/fluid/test_leaky_relu_grad_grad_functor.h similarity index 100% rename from paddle/fluid/operators/test_leaky_relu_grad_grad_functor.h rename to test/cpp/fluid/test_leaky_relu_grad_grad_functor.h -- GitLab