未验证 提交 f188b370 编写于 作者: Z Zeng Jinle 提交者: GitHub

Move gc test to each test of op (#16999)

* move gc test to op_test
test=develop

* Revert "move gc test to op_test"

This reverts commit cf15da65c38f57c91f53b3d8b3c2365d4aa86016.

* enable gc test in some ops
test=develop
上级 47013af0
file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py")
string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}")
set(GC_ENVS FLAGS_eager_delete_tensor_gb=0.0 FLAGS_fast_eager_deletion_mode=1 FLAGS_memory_fraction_of_eager_deletion=1.0)
if(NOT WITH_DISTRIBUTE)
list(REMOVE_ITEM TEST_OPS test_recv_op)
......@@ -80,13 +81,49 @@ list(REMOVE_ITEM TEST_OPS test_imperative_se_resnext)
list(REMOVE_ITEM TEST_OPS test_imperative_mnist)
list(REMOVE_ITEM TEST_OPS test_ir_memory_optimize_transformer)
list(REMOVE_ITEM TEST_OPS test_layers)
# Some ops need to check results when gc is enabled
# Currently, only ops that register NoNeedBufferVarsInference need to do this test
set(TEST_OPS_WITH_GC
test_concat_op
test_elementwise_add_op
test_elementwise_sub_op
test_fill_constant_batch_size_like_op
test_fill_zeros_like2_op
test_gather_op
test_gaussian_random_batch_size_like_op
test_linear_chain_crf_op
test_lod_reset_op
test_lookup_table_op
test_mean_op
test_pad2d_op
test_scatter_op
test_sequence_concat
test_seq_conv
test_seq_pool
test_sequence_expand_as
test_sequence_expand
test_sequence_pad_op
test_sequence_unpad_op
test_sequence_scatter_op
test_sequence_slice_op
test_slice_op
test_space_to_depth_op
test_squared_l2_distance_op
test_uniform_random_batch_size_like_op)
foreach(TEST_OP ${TEST_OPS_WITH_GC})
list(REMOVE_ITEM TEST_OPS ${TEST_OP})
py_test_modules(${TEST_OP} MODULES ${TEST_OP} ENVS ${GC_ENVS})
endforeach()
foreach(TEST_OP ${TEST_OPS})
py_test_modules(${TEST_OP} MODULES ${TEST_OP})
endforeach(TEST_OP)
py_test_modules(test_adam_op_multi_thread MODULES test_adam_op ENVS FLAGS_inner_op_parallelism=4)
py_test_modules(test_warpctc_op MODULES test_warpctc_op ENVS FLAGS_warpctc_dir=${WARPCTC_LIB_DIR} SERIAL)
py_test_modules(test_bilinear_interp_op MODULES test_bilinear_interp_op SERIAL)
py_test_modules(test_nearest_interp_op MODULES test_nearest_interp_op SERIAL)
py_test_modules(test_bilinear_interp_op MODULES test_bilinear_interp_op ENVS ${GC_ENVS} SERIAL)
py_test_modules(test_nearest_interp_op MODULES test_nearest_interp_op ENVS ${GC_ENVS} SERIAL)
py_test_modules(test_imperative_resnet MODULES test_imperative_resnet ENVS
FLAGS_cudnn_deterministic=1 SERIAL)
py_test_modules(test_imperative_mnist MODULES test_imperative_mnist ENVS
......
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import paddle.fluid as fluid
import importlib
fluid.core._set_eager_deletion_mode(0.0, 1.0, True)
from test_bilinear_interp_op import *
from test_concat_op import *
from test_elementwise_add_op import *
from test_elementwise_sub_op import *
from test_fill_constant_batch_size_like_op import *
from test_fill_zeros_like2_op import *
from test_gather_op import *
from test_gaussian_random_batch_size_like_op import *
from test_linear_chain_crf_op import *
from test_lod_reset_op import *
from test_lookup_table_op import *
from test_mean_op import *
from test_nearest_interp_op import *
from test_pad2d_op import *
from test_scatter_op import *
from test_sequence_concat import *
from test_seq_conv import *
from test_seq_pool import *
from test_sequence_expand_as import *
from test_sequence_expand import *
from test_sequence_pad_op import *
from test_sequence_unpad_op import *
from test_sequence_scatter_op import *
from test_sequence_slice_op import *
from test_slice_op import *
from test_space_to_depth_op import *
from test_squared_l2_distance_op import *
from test_uniform_random_batch_size_like_op import *
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册