From 49d7bc5cb5a065fd8dd55368a6c75a248dfd7bab Mon Sep 17 00:00:00 2001 From: gouzil <66515297+gouzil@users.noreply.github.com> Date: Thu, 4 May 2023 15:20:22 +0800 Subject: [PATCH] [test]mv fluid op [reader, prim_ops, nccl, reduce_ops, lite] to test (#53429) * [test]mv fluid reader to test/ * [test]mv fluid op prim_ops to test/cpp/fluid/prim_ops * [test]mv fluid op nccl to /test/cpp/fluid/nccl/ * [test]mv fluid op reduce_ops to test/cpp/fluid/reduce_ops * [test]mv fluid op lite to test/cpp/fluid/lite * [test]fix lite * [test]fix prim op path * [fluid]clean prim ops cmakelists --- paddle/fluid/operators/lite/CMakeLists.txt | 2 - paddle/fluid/operators/nccl/CMakeLists.txt | 14 ------- .../fluid/operators/prim_ops/CMakeLists.txt | 39 ------------------- paddle/fluid/operators/reader/CMakeLists.txt | 1 - .../fluid/operators/reduce_ops/CMakeLists.txt | 21 ---------- test/cpp/fluid/CMakeLists.txt | 13 ++++--- test/cpp/fluid/lite/CMakeLists.txt | 2 + .../cpp/fluid}/lite/lite_engine_op_test.cc | 0 test/cpp/fluid/nccl/CMakeLists.txt | 13 +++++++ .../cpp/fluid}/nccl/nccl_op_test.cu.cc | 0 test/cpp/fluid/prim_ops/CMakeLists.txt | 39 +++++++++++++++++++ .../cpp/fluid}/prim_ops/prim_op_test.cc | 0 test/cpp/fluid/reader/CMakeLists.txt | 1 + .../reader/reader_blocking_queue_test.cc | 0 test/cpp/fluid/reduce_ops/CMakeLists.txt | 20 ++++++++++ .../reduce_ops/check_reduce_rank_test.cu | 0 16 files changed, 82 insertions(+), 83 deletions(-) create mode 100644 test/cpp/fluid/lite/CMakeLists.txt rename {paddle/fluid/operators => test/cpp/fluid}/lite/lite_engine_op_test.cc (100%) create mode 100644 test/cpp/fluid/nccl/CMakeLists.txt rename {paddle/fluid/operators => test/cpp/fluid}/nccl/nccl_op_test.cu.cc (100%) create mode 100644 test/cpp/fluid/prim_ops/CMakeLists.txt rename {paddle/fluid/operators => test/cpp/fluid}/prim_ops/prim_op_test.cc (100%) create mode 100644 test/cpp/fluid/reader/CMakeLists.txt rename {paddle/fluid/operators => test/cpp/fluid}/reader/reader_blocking_queue_test.cc (100%) create mode 100644 test/cpp/fluid/reduce_ops/CMakeLists.txt rename {paddle/fluid/operators => test/cpp/fluid}/reduce_ops/check_reduce_rank_test.cu (100%) diff --git a/paddle/fluid/operators/lite/CMakeLists.txt b/paddle/fluid/operators/lite/CMakeLists.txt index c272e8bc94c..ca3b6264837 100644 --- a/paddle/fluid/operators/lite/CMakeLists.txt +++ b/paddle/fluid/operators/lite/CMakeLists.txt @@ -1,3 +1 @@ op_library(lite_engine_op DEPS lite_engine lite_tensor_utils) -cc_test_old(test_lite_engine_op SRCS lite_engine_op_test.cc DEPS lite_engine_op - analysis) diff --git a/paddle/fluid/operators/nccl/CMakeLists.txt b/paddle/fluid/operators/nccl/CMakeLists.txt index 218d53aa630..629b41b4b58 100644 --- a/paddle/fluid/operators/nccl/CMakeLists.txt +++ b/paddle/fluid/operators/nccl/CMakeLists.txt @@ -22,17 +22,3 @@ if(WITH_GPU OR WITH_ROCM) ${OPERATOR_DEPS} nccl_common PARENT_SCOPE) endif() - -if(WITH_GPU AND NOT WIN32) - nv_test( - nccl_op_test - SRCS nccl_op_test.cu.cc - DEPS nccl_op gpu_info device_context) -endif() - -if(WITH_ROCM AND NOT WIN32) - hip_test( - nccl_op_test - SRCS nccl_op_test.cu.cc - DEPS nccl_op gpu_info device_context) -endif() diff --git a/paddle/fluid/operators/prim_ops/CMakeLists.txt b/paddle/fluid/operators/prim_ops/CMakeLists.txt index 85741b2f5f3..7a1278219bb 100644 --- a/paddle/fluid/operators/prim_ops/CMakeLists.txt +++ b/paddle/fluid/operators/prim_ops/CMakeLists.txt @@ -4,42 +4,3 @@ if(WITH_UNITY_BUILD) include(unity_build_rule.cmake) endif() register_operators() - -set(PRIM_OP_SRCS - reshape_p_op.cc - broadcast_p_op.cc - reduce_sum_p_op.cc - transpose_p_op.cc - split_p_op.cc - concat_p_op.cc - slice_select_p_op.cc - slice_assign_p_op.cc - gather_p_op.cc - scatter_add_p_op.cc - add_p_op.cc - sub_p_op.cc - mul_p_op.cc - div_p_op.cc - sqrt_p_op.cc - tanh_p_op.cc - sin_p_op.cc - cos_p_op.cc - exp_p_op.cc - matmul_p_op.cc - fill_constant_p_op.cc - log_p_op.cc - select_p_op.cc - eq_p_op.cc - gt_p_op.cc - ge_p_op.cc - ne_p_op.cc - pow_p_op.cc - max_p_op.cc - erf_p_op.cc - bernoulli_p_op.cc - abs_p_op.cc - cast_p_op.cc - rsqrt_p_op.cc - uniform_random_p_op.cc) - -cc_test_old(prim_op_test SRCS prim_op_test.cc ${PRIM_OP_SRCS} DEPS op_registry) diff --git a/paddle/fluid/operators/reader/CMakeLists.txt b/paddle/fluid/operators/reader/CMakeLists.txt index 9dd59de98d5..61622f516c4 100644 --- a/paddle/fluid/operators/reader/CMakeLists.txt +++ b/paddle/fluid/operators/reader/CMakeLists.txt @@ -35,6 +35,5 @@ reader_library(create_py_reader_op SRCS create_py_reader_op.cc DEPS py_reader) op_library(read_op DEPS py_reader buffered_reader) -cc_test(reader_blocking_queue_test SRCS reader_blocking_queue_test.cc) # Export local libraries to parent # set(READER_LIBRARY ${LOCAL_READER_LIBS} PARENT_SCOPE) diff --git a/paddle/fluid/operators/reduce_ops/CMakeLists.txt b/paddle/fluid/operators/reduce_ops/CMakeLists.txt index 27a2ff68d3a..070c9f7262a 100644 --- a/paddle/fluid/operators/reduce_ops/CMakeLists.txt +++ b/paddle/fluid/operators/reduce_ops/CMakeLists.txt @@ -12,24 +12,3 @@ if(WITH_GPU) else() register_operators() endif() - -if(WITH_GPU) - if(${CMAKE_CUDA_COMPILER_VERSION} LESS 11.0) - nv_test( - check_reduce_rank_test - SRCS check_reduce_rank_test.cu - DEPS tensor cub) - else() - nv_test( - check_reduce_rank_test - SRCS check_reduce_rank_test.cu - DEPS tensor) - endif() -endif() - -if(WITH_ROCM) - hip_test( - check_reduce_rank_test - SRCS check_reduce_rank_test.cu - DEPS tensor) -endif() diff --git a/test/cpp/fluid/CMakeLists.txt b/test/cpp/fluid/CMakeLists.txt index cabad612e0d..31ba506aa91 100644 --- a/test/cpp/fluid/CMakeLists.txt +++ b/test/cpp/fluid/CMakeLists.txt @@ -7,17 +7,18 @@ endif() # add_subdirectory(dlnne) # add_subdirectory(elementwise) # add_subdirectory(fused) -# if(WITH_LITE) -# add_subdirectory(lite) -# endif() +if(WITH_LITE) + add_subdirectory(lite) +endif() # add_subdirectory(math) # if(WITH_MKLDNN) # add_subdirectory(mkldnn) # endif() -# add_subdirectory(nccl) +add_subdirectory(nccl) # if(WITH_PSCORE) # add_subdirectory(pscore) # endif() -# add_subdirectory(prim_ops) -# add_subdirectory(reduce_ops) +add_subdirectory(prim_ops) +add_subdirectory(reader) +add_subdirectory(reduce_ops) # add_subdirectory(tensorrt) diff --git a/test/cpp/fluid/lite/CMakeLists.txt b/test/cpp/fluid/lite/CMakeLists.txt new file mode 100644 index 00000000000..c9dbdb8665e --- /dev/null +++ b/test/cpp/fluid/lite/CMakeLists.txt @@ -0,0 +1,2 @@ +cc_test_old(test_lite_engine_op SRCS lite_engine_op_test.cc DEPS lite_engine_op + analysis) diff --git a/paddle/fluid/operators/lite/lite_engine_op_test.cc b/test/cpp/fluid/lite/lite_engine_op_test.cc similarity index 100% rename from paddle/fluid/operators/lite/lite_engine_op_test.cc rename to test/cpp/fluid/lite/lite_engine_op_test.cc diff --git a/test/cpp/fluid/nccl/CMakeLists.txt b/test/cpp/fluid/nccl/CMakeLists.txt new file mode 100644 index 00000000000..d0482bee421 --- /dev/null +++ b/test/cpp/fluid/nccl/CMakeLists.txt @@ -0,0 +1,13 @@ +if(WITH_GPU AND NOT WIN32) + nv_test( + nccl_op_test + SRCS nccl_op_test.cu.cc + DEPS nccl_op gpu_info device_context) +endif() + +if(WITH_ROCM AND NOT WIN32) + hip_test( + nccl_op_test + SRCS nccl_op_test.cu.cc + DEPS nccl_op gpu_info device_context) +endif() diff --git a/paddle/fluid/operators/nccl/nccl_op_test.cu.cc b/test/cpp/fluid/nccl/nccl_op_test.cu.cc similarity index 100% rename from paddle/fluid/operators/nccl/nccl_op_test.cu.cc rename to test/cpp/fluid/nccl/nccl_op_test.cu.cc diff --git a/test/cpp/fluid/prim_ops/CMakeLists.txt b/test/cpp/fluid/prim_ops/CMakeLists.txt new file mode 100644 index 00000000000..578284c2611 --- /dev/null +++ b/test/cpp/fluid/prim_ops/CMakeLists.txt @@ -0,0 +1,39 @@ +set(PRIM_OP_PATH ${PADDLE_SOURCE_DIR}/paddle/fluid/operators/prim_ops/) + +set(PRIM_OP_SRCS + ${PRIM_OP_PATH}reshape_p_op.cc + ${PRIM_OP_PATH}broadcast_p_op.cc + ${PRIM_OP_PATH}reduce_sum_p_op.cc + ${PRIM_OP_PATH}transpose_p_op.cc + ${PRIM_OP_PATH}split_p_op.cc + ${PRIM_OP_PATH}concat_p_op.cc + ${PRIM_OP_PATH}slice_select_p_op.cc + ${PRIM_OP_PATH}slice_assign_p_op.cc + ${PRIM_OP_PATH}gather_p_op.cc + ${PRIM_OP_PATH}scatter_add_p_op.cc + ${PRIM_OP_PATH}add_p_op.cc + ${PRIM_OP_PATH}sub_p_op.cc + ${PRIM_OP_PATH}mul_p_op.cc + ${PRIM_OP_PATH}div_p_op.cc + ${PRIM_OP_PATH}sqrt_p_op.cc + ${PRIM_OP_PATH}tanh_p_op.cc + ${PRIM_OP_PATH}sin_p_op.cc + ${PRIM_OP_PATH}cos_p_op.cc + ${PRIM_OP_PATH}exp_p_op.cc + ${PRIM_OP_PATH}matmul_p_op.cc + ${PRIM_OP_PATH}fill_constant_p_op.cc + ${PRIM_OP_PATH}log_p_op.cc + ${PRIM_OP_PATH}select_p_op.cc + ${PRIM_OP_PATH}eq_p_op.cc + ${PRIM_OP_PATH}gt_p_op.cc + ${PRIM_OP_PATH}ge_p_op.cc + ${PRIM_OP_PATH}ne_p_op.cc + ${PRIM_OP_PATH}pow_p_op.cc + ${PRIM_OP_PATH}max_p_op.cc + ${PRIM_OP_PATH}erf_p_op.cc + ${PRIM_OP_PATH}bernoulli_p_op.cc + ${PRIM_OP_PATH}abs_p_op.cc + ${PRIM_OP_PATH}cast_p_op.cc + ${PRIM_OP_PATH}rsqrt_p_op.cc + ${PRIM_OP_PATH}uniform_random_p_op.cc) +cc_test_old(prim_op_test SRCS prim_op_test.cc ${PRIM_OP_SRCS} DEPS op_registry) diff --git a/paddle/fluid/operators/prim_ops/prim_op_test.cc b/test/cpp/fluid/prim_ops/prim_op_test.cc similarity index 100% rename from paddle/fluid/operators/prim_ops/prim_op_test.cc rename to test/cpp/fluid/prim_ops/prim_op_test.cc diff --git a/test/cpp/fluid/reader/CMakeLists.txt b/test/cpp/fluid/reader/CMakeLists.txt new file mode 100644 index 00000000000..1bd2ad7cdd0 --- /dev/null +++ b/test/cpp/fluid/reader/CMakeLists.txt @@ -0,0 +1 @@ +cc_test(reader_blocking_queue_test SRCS reader_blocking_queue_test.cc) diff --git a/paddle/fluid/operators/reader/reader_blocking_queue_test.cc b/test/cpp/fluid/reader/reader_blocking_queue_test.cc similarity index 100% rename from paddle/fluid/operators/reader/reader_blocking_queue_test.cc rename to test/cpp/fluid/reader/reader_blocking_queue_test.cc diff --git a/test/cpp/fluid/reduce_ops/CMakeLists.txt b/test/cpp/fluid/reduce_ops/CMakeLists.txt new file mode 100644 index 00000000000..8c04b94138b --- /dev/null +++ b/test/cpp/fluid/reduce_ops/CMakeLists.txt @@ -0,0 +1,20 @@ +if(WITH_GPU) + if(${CMAKE_CUDA_COMPILER_VERSION} LESS 11.0) + nv_test( + check_reduce_rank_test + SRCS check_reduce_rank_test.cu + DEPS tensor cub) + else() + nv_test( + check_reduce_rank_test + SRCS check_reduce_rank_test.cu + DEPS tensor) + endif() +endif() + +if(WITH_ROCM) + hip_test( + check_reduce_rank_test + SRCS check_reduce_rank_test.cu + DEPS tensor) +endif() diff --git a/paddle/fluid/operators/reduce_ops/check_reduce_rank_test.cu b/test/cpp/fluid/reduce_ops/check_reduce_rank_test.cu similarity index 100% rename from paddle/fluid/operators/reduce_ops/check_reduce_rank_test.cu rename to test/cpp/fluid/reduce_ops/check_reduce_rank_test.cu -- GitLab