Skip to content

Commit f188b37

Browse files
authored
Move gc test to each test of op (PaddlePaddle#16999)
* move gc test to op_test test=develop * Revert "move gc test to op_test" This reverts commit cf15da6. * enable gc test in some ops test=develop
1 parent 47013af commit f188b37

File tree

2 files changed

+39
-53
lines changed

2 files changed

+39
-53
lines changed

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

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py")
22
string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}")
3+
set(GC_ENVS FLAGS_eager_delete_tensor_gb=0.0 FLAGS_fast_eager_deletion_mode=1 FLAGS_memory_fraction_of_eager_deletion=1.0)
34

45
if(NOT WITH_DISTRIBUTE)
56
list(REMOVE_ITEM TEST_OPS test_recv_op)
@@ -80,13 +81,49 @@ list(REMOVE_ITEM TEST_OPS test_imperative_se_resnext)
8081
list(REMOVE_ITEM TEST_OPS test_imperative_mnist)
8182
list(REMOVE_ITEM TEST_OPS test_ir_memory_optimize_transformer)
8283
list(REMOVE_ITEM TEST_OPS test_layers)
84+
85+
# Some ops need to check results when gc is enabled
86+
# Currently, only ops that register NoNeedBufferVarsInference need to do this test
87+
set(TEST_OPS_WITH_GC
88+
test_concat_op
89+
test_elementwise_add_op
90+
test_elementwise_sub_op
91+
test_fill_constant_batch_size_like_op
92+
test_fill_zeros_like2_op
93+
test_gather_op
94+
test_gaussian_random_batch_size_like_op
95+
test_linear_chain_crf_op
96+
test_lod_reset_op
97+
test_lookup_table_op
98+
test_mean_op
99+
test_pad2d_op
100+
test_scatter_op
101+
test_sequence_concat
102+
test_seq_conv
103+
test_seq_pool
104+
test_sequence_expand_as
105+
test_sequence_expand
106+
test_sequence_pad_op
107+
test_sequence_unpad_op
108+
test_sequence_scatter_op
109+
test_sequence_slice_op
110+
test_slice_op
111+
test_space_to_depth_op
112+
test_squared_l2_distance_op
113+
test_uniform_random_batch_size_like_op)
114+
115+
foreach(TEST_OP ${TEST_OPS_WITH_GC})
116+
list(REMOVE_ITEM TEST_OPS ${TEST_OP})
117+
py_test_modules(${TEST_OP} MODULES ${TEST_OP} ENVS ${GC_ENVS})
118+
endforeach()
119+
83120
foreach(TEST_OP ${TEST_OPS})
84121
py_test_modules(${TEST_OP} MODULES ${TEST_OP})
85122
endforeach(TEST_OP)
86123
py_test_modules(test_adam_op_multi_thread MODULES test_adam_op ENVS FLAGS_inner_op_parallelism=4)
87124
py_test_modules(test_warpctc_op MODULES test_warpctc_op ENVS FLAGS_warpctc_dir=${WARPCTC_LIB_DIR} SERIAL)
88-
py_test_modules(test_bilinear_interp_op MODULES test_bilinear_interp_op SERIAL)
89-
py_test_modules(test_nearest_interp_op MODULES test_nearest_interp_op SERIAL)
125+
py_test_modules(test_bilinear_interp_op MODULES test_bilinear_interp_op ENVS ${GC_ENVS} SERIAL)
126+
py_test_modules(test_nearest_interp_op MODULES test_nearest_interp_op ENVS ${GC_ENVS} SERIAL)
90127
py_test_modules(test_imperative_resnet MODULES test_imperative_resnet ENVS
91128
FLAGS_cudnn_deterministic=1 SERIAL)
92129
py_test_modules(test_imperative_mnist MODULES test_imperative_mnist ENVS

python/paddle/fluid/tests/unittests/test_eager_deletion_no_need_buffer_vars_inference.py

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)