Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PIR]Move some unittest to deprecated #63419

Merged
merged 34 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3cc8d10
move unittest
YuanRisheng Apr 11, 2024
99811ef
Merge branch 'develop' of github.com:YuanRisheng/Paddle into move_uni…
YuanRisheng Apr 11, 2024
cb65cd6
revert dygraph to static
YuanRisheng Apr 12, 2024
1d40cb1
fix py3
YuanRisheng Apr 12, 2024
7bd66c0
revert cinn
YuanRisheng Apr 12, 2024
ff9449b
Merge branch 'develop' of github.com:YuanRisheng/Paddle into move_uni…
YuanRisheng Apr 12, 2024
85ca508
fix build
YuanRisheng Apr 12, 2024
0f8872d
fix py3
YuanRisheng Apr 12, 2024
55a4bf1
fix mac
YuanRisheng Apr 15, 2024
9303846
fix cinn
YuanRisheng Apr 15, 2024
0ba53be
fix py3
YuanRisheng Apr 15, 2024
b6552d1
fix windows
YuanRisheng Apr 15, 2024
2759a73
resolve conflict
YuanRisheng Apr 15, 2024
2cf70ec
delete same unittest
YuanRisheng Apr 16, 2024
df55840
Merge branch 'develop' of github.com:YuanRisheng/Paddle into move_uni…
YuanRisheng Apr 16, 2024
e82ebef
fix py3
YuanRisheng Apr 16, 2024
9c32232
resolve conflict
YuanRisheng Apr 16, 2024
d1058ca
fix distributed
YuanRisheng Apr 16, 2024
488e2b3
resolve conflict
YuanRisheng Apr 16, 2024
2d4be87
fix compile
YuanRisheng Apr 16, 2024
4893642
delete code
YuanRisheng Apr 16, 2024
9177f14
fix py3
YuanRisheng Apr 16, 2024
5b93f74
resolve conflict
YuanRisheng Apr 16, 2024
352e696
delete code
YuanRisheng Apr 16, 2024
7348685
fix converage
YuanRisheng Apr 17, 2024
90d4150
resolve conflict & fix windows
YuanRisheng Apr 17, 2024
6fbf9cd
fix coverage
YuanRisheng Apr 17, 2024
2724d15
resolve conflict
YuanRisheng Apr 17, 2024
9c0de05
fix build
YuanRisheng Apr 17, 2024
04dafba
fix py3
YuanRisheng Apr 17, 2024
f2a8312
resolve conflict
YuanRisheng Apr 18, 2024
99ec971
resolve conflict
YuanRisheng Apr 18, 2024
0e80d8e
Merge branch 'develop' of github.com:YuanRisheng/Paddle into move_uni…
YuanRisheng Apr 18, 2024
267b4f9
Merge branch 'develop' of github.com:YuanRisheng/Paddle into move_uni…
YuanRisheng Apr 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,5 @@ if(${len} GREATER_EQUAL 1)
endif()

set_pit_tests_properties()

add_subdirectory(deprecated)
5 changes: 0 additions & 5 deletions test/asp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ if((WITH_DISTRIBUTE)
test_fleet_with_asp_sharding ENVS ${dist_ENVS})
endif()
endif()

set_tests_properties(test_asp_pruning_dynamic PROPERTIES TIMEOUT 30)
set_tests_properties(test_asp_pruning_static PROPERTIES TIMEOUT 30)
set_tests_properties(test_asp_optimize_dynamic PROPERTIES TIMEOUT 30)
set_tests_properties(test_asp_optimize_static PROPERTIES TIMEOUT 30)
1 change: 0 additions & 1 deletion test/autograd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ endforeach()

set_tests_properties(test_autograd_dynamic PROPERTIES TIMEOUT 100)
set_tests_properties(test_autograd_functional_dynamic PROPERTIES TIMEOUT 200)
set_tests_properties(test_autograd_functional_static PROPERTIES TIMEOUT 160)
set_tests_properties(test_minimize PROPERTIES TIMEOUT 60)
if(NOT WIN32)
set_tests_properties(test_autograd_functional_prim PROPERTIES TIMEOUT 60)
Expand Down
4 changes: 0 additions & 4 deletions test/book/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ foreach(src ${TEST_OPS})
py_test(${src} SRCS ${src}.py)
set_tests_properties(${src} PROPERTIES FIXTURES_SETUP ${src}_infer_model)
endforeach()
set_tests_properties(test_word2vec_book PROPERTIES TIMEOUT 120)
set_tests_properties(test_recognize_digits PROPERTIES TIMEOUT 120)
set_tests_properties(test_image_classification PROPERTIES TIMEOUT 200)
set_tests_properties(test_fit_a_line PROPERTIES TIMEOUT 120)
33 changes: 1 addition & 32 deletions test/collective/fleet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ if((WITH_GPU OR WITH_XPU) AND LOCAL_ALL_PLAT)
set_tests_properties(test_fleet_sharding_meta_optimizer
PROPERTIES TIMEOUT "350" LABELS "RUN_TYPE=DIST")
endif()
if(LOCAL_ALL_ARCH AND (LINUX OR WIN32))
py_test_modules(
test_fleet_static_mp_layers MODULES test_fleet_static_mp_layers ENVS
"http_proxy=;https_proxy=;PYTHONPATH=../..:${PADDLE_BINARY_DIR}/python")
endif()
if(WITH_DGC)
if(LOCAL_ALL_ARCH AND LOCAL_ALL_PLAT)
py_test_modules(
Expand Down Expand Up @@ -74,12 +69,6 @@ if((WITH_ROCM) AND LOCAL_ALL_PLAT)
"PADDLE_DIST_UT_PORT=21204;http_proxy=;https_proxy=;PYTHONPATH=../..:${PADDLE_BINARY_DIR}/python"
)
endif()
if(LOCAL_ALL_ARCH AND (LINUX OR WIN32))
py_test_modules(
test_fleet_fp16_allreduce_meta_optimizer MODULES
test_fleet_fp16_allreduce_meta_optimizer ENVS
"http_proxy=;https_proxy=;PYTHONPATH=../..:${PADDLE_BINARY_DIR}/python")
endif()
if((WITH_GPU OR WITH_XPU) AND LOCAL_ALL_PLAT)
bash_test_modules(
test_rnn_dp
Expand Down Expand Up @@ -260,13 +249,6 @@ if(LOCAL_ALL_ARCH AND LOCAL_ALL_PLAT)
)
set_tests_properties(test_pipeline PROPERTIES TIMEOUT "160")
endif()
if(LOCAL_ALL_ARCH AND (LINUX OR APPLE))
py_test_modules(
test_fleet_utils MODULES test_fleet_utils ENVS
"http_proxy=;https_proxy=;PYTHONPATH=../..:${PADDLE_BINARY_DIR}/python")
set_tests_properties(test_fleet_utils PROPERTIES TIMEOUT "120" LABELS
"RUN_TYPE=DIST")
endif()
if(LOCAL_ALL_ARCH AND LOCAL_ALL_PLAT)
bash_test_modules(
test_static_model_parallel
Expand Down Expand Up @@ -428,15 +410,7 @@ if(LOCAL_ALL_ARCH AND LOCAL_ALL_PLAT)
test_recv_save_op MODULES test_recv_save_op ENVS
"http_proxy=;https_proxy=;PYTHONPATH=../..:${PADDLE_BINARY_DIR}/python")
endif()
if(LOCAL_ALL_ARCH AND LOCAL_ALL_PLAT)
py_test_modules(
test_communicator_sync
MODULES
test_communicator_sync
ENVS
"FLAGS_communicator_send_queue_size=1;FLAGS_communicator_max_merge_var_num=1;http_proxy=;https_proxy=;PYTHONPATH=../..:${PADDLE_BINARY_DIR}/python"
)
endif()

if((WITH_GPU OR WITH_XPU) AND LOCAL_ALL_PLAT)
bash_test_modules(
test_fleet_pipeline_meta_optimizer
Expand All @@ -459,11 +433,6 @@ if(LOCAL_ALL_ARCH AND (LINUX OR WIN32))
test_fleet_amp_init MODULES test_fleet_amp_init ENVS
"http_proxy=;https_proxy=;PYTHONPATH=../..:${PADDLE_BINARY_DIR}/python")
endif()
if(LOCAL_ALL_ARCH AND (LINUX OR WIN32))
py_test_modules(
test_fleet_meta_optimizer_base MODULES test_fleet_meta_optimizer_base ENVS
"http_proxy=;https_proxy=;PYTHONPATH=../..:${PADDLE_BINARY_DIR}/python")
endif()
if((WITH_GPU OR WITH_XPU) AND LOCAL_ALL_PLAT)
bash_test_modules(
test_fleet_raw_program_meta_optimizer
Expand Down
1 change: 0 additions & 1 deletion test/contrib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ py_test_modules(
FLAGS_cudnn_batchnorm_spatial_persistent=true
FLAGS_conv_workspace_size_limit=1000)

set_tests_properties(test_image_classification_fp16 PROPERTIES TIMEOUT 120)
set_tests_properties(test_multi_precision_fp16_train PROPERTIES TIMEOUT 120)
5 changes: 2 additions & 3 deletions test/cpp/prim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ set(prim_eager_deps
set(prim_generated_deps final_dygraph_function final_dygraph_node
dygraph_function dygraph_node)

paddle_test(test_comp_static SRCS test_static_prim.cc)

if(NOT (NOT WITH_PYTHON AND ON_INFER))
if(WITH_CINN)
set(prim_eager_deps ${prim_eager_deps})
Expand All @@ -33,8 +31,9 @@ endif()
if(NOT WIN32)
paddle_test(test_vjp_pir SRCS test_vjp.cc)
endif()

if(WITH_ONNXRUNTIME AND WIN32)
# Copy onnxruntime for some c++ test in Windows, since the test will
# be build only in CI, so suppose the generator in Windows is Ninja.
copy_onnx(test_comp_static)
copy_onnx(test_comp_eager)
endif()
3 changes: 0 additions & 3 deletions test/cpp_extension/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ if(WITH_TESTING)
set_tests_properties(test_cpp_extension_jit PROPERTIES TIMEOUT 120)
endif()
endif()

py_test(test_mixed_extension_setup SRCS test_mixed_extension_setup.py)
set_tests_properties(test_mixed_extension_setup PROPERTIES TIMEOUT 120)
4 changes: 0 additions & 4 deletions test/custom_op/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,13 @@ if(WITH_TESTING)
PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 180)
endif()

py_test(test_custom_raw_op_kernel_op SRCS test_custom_raw_op_kernel_op.py)
set_tests_properties(test_custom_raw_op_kernel_op PROPERTIES TIMEOUT 180)
py_test(test_custom_tensor_operator SRCS test_custom_tensor_operator.py)
set_tests_properties(test_custom_tensor_operator PROPERTIES TIMEOUT 180)

# CPU custom op tests: only compile .cc file
py_test(test_dispatch_jit SRCS test_dispatch_jit.py)
py_test(test_multi_out_jit SRCS test_multi_out_jit.py)
py_test(test_custom_attrs_jit SRCS test_custom_attrs_jit.py)
py_test(test_custom_cast_op_jit SRCS test_custom_cast_op_jit.py)
set_tests_properties(test_custom_cast_op_jit PROPERTIES TIMEOUT 180)
py_test(test_custom_concat SRCS test_custom_concat.py)
set_tests_properties(
test_custom_concat PROPERTIES ENVIRONMENT
Expand Down
3 changes: 0 additions & 3 deletions test/custom_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ if(WITH_CUSTOM_DEVICE AND NOT WITH_GPU)
PLUGIN_TAG=${PLUGIN_TAG}
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE})

set_tests_properties(test_custom_cpu_plugin PROPERTIES TIMEOUT 120)
set_tests_properties(test_custom_cpu_profiler_plugin PROPERTIES TIMEOUT 120)
set_tests_properties(test_fleet_launch_custom_device PROPERTIES TIMEOUT 120)
set_tests_properties(test_custom_cpu_to_static PROPERTIES TIMEOUT 180)
set_tests_properties(test_custom_op_setup PROPERTIES TIMEOUT 120)

# cpp testing
paddle_test(extension_header_test SRCS extension_header_test.cc DEPS phi
Expand Down
167 changes: 167 additions & 0 deletions test/deprecated/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
remove_definitions(-DPADDLE_DLL_EXPORT)
set(CC_TESTS_DIR
${PADDLE_BINARY_DIR}/test/cpp
CACHE INTERNAL "c++ tests directory")
set(PYTHON_TESTS_DIR
${PADDLE_BINARY_DIR}/test
CACHE INTERNAL "python tests directory")

function(py_test_modules TARGET_NAME)
if(WITH_TESTING)
set(options SERIAL)
set(oneValueArgs "")
set(multiValueArgs MODULES DEPS ENVS)
cmake_parse_arguments(py_test_modules "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})

if(WITH_COVERAGE AND NOT (WITH_INCREMENTAL_COVERAGE
AND "$ENV{PADDLE_GIT_DIFF_PY_FILE}" STREQUAL ""))
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PADDLE_BINARY_DIR}/python
${py_test_modules_ENVS}
COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data
${PYTHON_EXECUTABLE} -m coverage run --branch -p
${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PADDLE_BINARY_DIR}/python
${py_test_modules_ENVS} ${PYTHON_EXECUTABLE}
${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()

if(py_test_modules_SERIAL)
set_property(TEST ${TARGET_NAME} PROPERTY RUN_SERIAL 1)
endif()
if(WIN32)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 150)
endif()
endif()
endfunction()

function(bash_test_modules TARGET_NAME)
if(NOT WITH_TESTING)
return()
endif()

set(options SERIAL)
set(oneValueArgs TIMEOUT START_BASH)
set(multiValueArgs DEPS ENVS LABELS)
cmake_parse_arguments(bash_test_modules "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})

set(timeout 350)
if(${bash_test_modules_TIMEOUT})
set(timeout ${bash_test_modules_TIMEOUT})
endif()

if(WITH_COVERAGE)
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PADDLE_BINARY_DIR}/python
TEST_TARGET_NAME=${TARGET_NAME} TEST_TIMEOUT=${timeout}
${bash_test_modules_ENVS} WITH_COVERAGE=ON
COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data bash
${CMAKE_CURRENT_BINARY_DIR}/${bash_test_modules_START_BASH}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PADDLE_BINARY_DIR}/python
TEST_TARGET_NAME=${TARGET_NAME} TEST_TIMEOUT=${timeout}
${bash_test_modules_ENVS} bash
${CMAKE_CURRENT_BINARY_DIR}/${bash_test_modules_START_BASH}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()

if(bash_test_modules_SERIAL)
set_property(TEST ${TARGET_NAME} PROPERTY RUN_SERIAL 1)
endif()

if(bash_test_modules_LABELS)
set_tests_properties(${TARGET_NAME} PROPERTIES LABELS
${bash_test_modules_LABELS})
endif()
endfunction()

function(set_pit_tests_properties)
file(STRINGS "${CMAKE_SOURCE_DIR}/test/white_list/pir_op_test_white_list"
PIR_OP_TESTS)
foreach(IR_OP_TEST ${PIR_OP_TESTS})
if(TEST ${IR_OP_TEST})
set_property(
TEST ${IR_OP_TEST}
APPEND
PROPERTY ENVIRONMENT "FLAGS_PIR_OPTEST_WHITE_LIST=True")
endif()
endforeach()

file(STRINGS "${CMAKE_SOURCE_DIR}/test/white_list/pir_op_test_no_check_list"
PIR_OP_NO_CHECK_TESTS)
foreach(IR_OP_TEST ${PIR_OP_NO_CHECK_TESTS})
if(TEST ${IR_OP_TEST})
set_property(
TEST ${IR_OP_TEST}
APPEND
PROPERTY ENVIRONMENT "FLAGS_PIR_NO_CHECK=True")
endif()
endforeach()

file(STRINGS
"${CMAKE_SOURCE_DIR}/test/white_list/pir_op_test_precision_white_list"
PIR_OP_RELAXED_TESTS)
foreach(IR_OP_TEST ${PIR_OP_RELAXED_TESTS})
if(TEST ${IR_OP_TEST})
set_property(
TEST ${IR_OP_TEST}
APPEND
PROPERTY ENVIRONMENT "FLAGS_PIR_OPTEST_RELAX_CHECK=True")
endif()
endforeach()

endfunction()

if(WITH_TESTING)
if(WIN32 AND WIN_UNITTEST_LEVEL LESS 2)
message(STATUS "Skip tests unrelated to CUDA/TRT")
else()
add_subdirectory(amp)
add_subdirectory(asp)
add_subdirectory(autograd)
add_subdirectory(custom_op)
add_subdirectory(custom_runtime)
add_subdirectory(cpp_extension)
add_subdirectory(prim)
add_subdirectory(standalone_executor)
add_subdirectory(tokenizer)
endif()

add_subdirectory(book)
add_subdirectory(contrib)
add_subdirectory(cpp)
add_subdirectory(distribution)
add_subdirectory(ir)
add_subdirectory(legacy_test)
add_subdirectory(quantization)
add_subdirectory(rnn)
add_subdirectory(sequence)

if(WITH_DISTRIBUTE)
add_subdirectory(collective)
add_subdirectory(distributed_passes)
endif()

if(NOT WIN32 OR NOT WITH_GPU)
add_subdirectory(fft)
endif()

endif()

set_pit_tests_properties()
47 changes: 47 additions & 0 deletions test/deprecated/amp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
file(
GLOB TEST_OPS
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"test_*.py")
string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}")

function(py_test_modules TARGET_NAME)
if(WITH_TESTING)
set(options SERIAL)
set(oneValueArgs "")
set(multiValueArgs MODULES DEPS ENVS)
cmake_parse_arguments(py_test_modules "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})

if(WITH_COVERAGE AND NOT (WITH_INCREMENTAL_COVERAGE
AND "$ENV{PADDLE_GIT_DIFF_PY_FILE}" STREQUAL ""))
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PADDLE_BINARY_DIR}/python
${py_test_modules_ENVS}
COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data
${PYTHON_EXECUTABLE} -m coverage run --branch -p
${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PADDLE_BINARY_DIR}/python
${py_test_modules_ENVS} ${PYTHON_EXECUTABLE}
${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()

if(py_test_modules_SERIAL)
set_property(TEST ${TARGET_NAME} PROPERTY RUN_SERIAL 1)
endif()
if(WIN32)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 150)
endif()
endif()
endfunction()

foreach(TEST_OP ${TEST_OPS})
py_test_modules(${TEST_OP} MODULES ${TEST_OP})
endforeach()
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import unittest

import numpy as np

sys.path.append("../../amp")
from amp_base_models import build_while_model

import paddle
Expand Down
Loading