From 2efb282c861b2eba83bdfdbe3c8f7b3d0de16a25 Mon Sep 17 00:00:00 2001 From: guru4elephant <35550832+guru4elephant@users.noreply.github.com> Date: Thu, 25 Jul 2019 09:39:23 +0800 Subject: [PATCH] split test_dist_se_resnext.py into 4 testcases (#18743) * split test_dist_se_resnext.py into 4 testcases --- .../fluid/tests/unittests/CMakeLists.txt | 22 ++++++++-- .../unittests/test_dist_se_resnext_async.py | 43 ++++++++++++++++++ ...resnext.py => test_dist_se_resnext_dgc.py} | 31 ------------- .../unittests/test_dist_se_resnext_sync.py | 43 ++++++++++++++++++ .../test_dist_se_resnext_sync_with_memopt.py | 44 +++++++++++++++++++ 5 files changed, 148 insertions(+), 35 deletions(-) create mode 100644 python/paddle/fluid/tests/unittests/test_dist_se_resnext_async.py rename python/paddle/fluid/tests/unittests/{test_dist_se_resnext.py => test_dist_se_resnext_dgc.py} (63%) create mode 100644 python/paddle/fluid/tests/unittests/test_dist_se_resnext_sync.py create mode 100644 python/paddle/fluid/tests/unittests/test_dist_se_resnext_sync_with_memopt.py diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt index ac87a7e930..e814e30dea 100644 --- a/python/paddle/fluid/tests/unittests/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -56,12 +56,15 @@ if(APPLE) list(REMOVE_ITEM TEST_OPS test_desc_clone) list(REMOVE_ITEM TEST_OPS test_program_code) endif(NOT WITH_DISTRIBUTE) - message(WARNING "These tests has been disabled in OSX before being fixed:\n test_fuse_elewise_add_act_pass \n test_detection_map_op \n test_dist_se_resnext") + message(WARNING "These tests has been disabled in OSX before being fixed:\n test_fuse_elewise_add_act_pass \n test_detection_map_op \n test_dist_se_resnext_*") # this op is not support on mac list(REMOVE_ITEM TEST_OPS test_fusion_seqexpand_concat_fc_op) # TODO: add the unitest back when it fixed list(REMOVE_ITEM TEST_OPS test_detection_map_op) - list(REMOVE_ITEM TEST_OPS test_dist_se_resnext) + list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_dgc) + list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_sync) + list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_async) + list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_sync_with_memopt) # TODO(tangwei12): add the unitest back when it fixed list(REMOVE_ITEM TEST_OPS test_dist_word2vec) list(REMOVE_ITEM TEST_OPS test_fuse_elewise_add_act_pass) @@ -132,7 +135,10 @@ list(REMOVE_ITEM TEST_OPS test_dist_transpiler) list(REMOVE_ITEM TEST_OPS test_parallel_executor_crf) list(REMOVE_ITEM TEST_OPS test_parallel_executor_crf_auto_growth) list(REMOVE_ITEM TEST_OPS test_parallel_executor_fetch_feed) -list(REMOVE_ITEM TEST_OPS test_dist_se_resnext) +list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_dgc) +list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_sync) +list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_async) +list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_sync_with_memopt) list(REMOVE_ITEM TEST_OPS test_dgc_op) list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_nccl) list(REMOVE_ITEM TEST_OPS test_dist_transformer) @@ -230,7 +236,15 @@ if(WITH_DISTRIBUTE) set_tests_properties(test_dist_mnist_backward_deps PROPERTIES TIMEOUT 350) set_tests_properties(test_dist_mnist_lars PROPERTIES TIMEOUT 350) set_tests_properties(test_dist_word2vec PROPERTIES TIMEOUT 350) - py_test_modules(test_dist_se_resnext MODULES test_dist_se_resnext) + + list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_dgc) + list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_sync) + list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_async) + list(REMOVE_ITEM TEST_OPS test_dist_se_resnext_sync_with_memopt) + py_test_modules(test_dist_se_resnext_dgc MODULES test_dist_se_resnext_dgc) + py_test_modules(test_dist_se_resnext_sync MODULES test_dist_se_resnext_sync) + py_test_modules(test_dist_se_resnext_async MODULES test_dist_se_resnext_async) + py_test_modules(test_dist_se_resnext_sync_with_memopt MODULES test_dist_se_resnext_sync_with_memopt) py_test_modules(test_dist_se_resnext_nccl MODULES test_dist_se_resnext_nccl) bash_test_modules(test_launch MODULES test_launch.sh) # FIXME(typhoonzero): add these tests back diff --git a/python/paddle/fluid/tests/unittests/test_dist_se_resnext_async.py b/python/paddle/fluid/tests/unittests/test_dist_se_resnext_async.py new file mode 100644 index 0000000000..0d99728965 --- /dev/null +++ b/python/paddle/fluid/tests/unittests/test_dist_se_resnext_async.py @@ -0,0 +1,43 @@ +# Copyright (c) 2018 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. + +from __future__ import print_function +import unittest +from test_dist_base import TestDistBase +import os + + +def skip_ci(func): + on_ci = bool(int(os.environ.get("SKIP_UNSTABLE_CI", '0'))) + + def __func__(*args, **kwargs): + if on_ci: + return + return func(*args, **kwargs) + + return __func__ + + +class TestDistSeResneXt2x2Async(TestDistBase): + def _setup_config(self): + self._sync_mode = False + self._use_reader_alloc = False + + @skip_ci + def test_dist_train(self): + self.check_with_place("dist_se_resnext.py", delta=100) + + +if __name__ == "__main__": + unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_dist_se_resnext.py b/python/paddle/fluid/tests/unittests/test_dist_se_resnext_dgc.py similarity index 63% rename from python/paddle/fluid/tests/unittests/test_dist_se_resnext.py rename to python/paddle/fluid/tests/unittests/test_dist_se_resnext_dgc.py index 4e9ca01f43..24ef0736a0 100644 --- a/python/paddle/fluid/tests/unittests/test_dist_se_resnext.py +++ b/python/paddle/fluid/tests/unittests/test_dist_se_resnext_dgc.py @@ -29,37 +29,6 @@ def skip_ci(func): return __func__ -class TestDistSeResneXt2x2(TestDistBase): - def _setup_config(self): - self._sync_mode = True - self._use_reader_alloc = False - - @skip_ci - def test_dist_train(self): - self.check_with_place("dist_se_resnext.py", delta=1e-7) - - -class TestDistseResnXt2x2WithMemopt(TestDistBase): - def _setup_config(self): - self._sync_mode = True - self._mem_opt = True - self._use_reader_alloc = False - - @skip_ci - def test_dist_train(self): - self.check_with_place("dist_se_resnext.py", delta=1e-7) - - -class TestDistSeResneXt2x2Async(TestDistBase): - def _setup_config(self): - self._sync_mode = False - self._use_reader_alloc = False - - @skip_ci - def test_dist_train(self): - self.check_with_place("dist_se_resnext.py", delta=100) - - class TestDistSeResnetNCCL2DGC(TestDistBase): def _setup_config(self): self._sync_mode = True diff --git a/python/paddle/fluid/tests/unittests/test_dist_se_resnext_sync.py b/python/paddle/fluid/tests/unittests/test_dist_se_resnext_sync.py new file mode 100644 index 0000000000..23987f4eff --- /dev/null +++ b/python/paddle/fluid/tests/unittests/test_dist_se_resnext_sync.py @@ -0,0 +1,43 @@ +# Copyright (c) 2018 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. + +from __future__ import print_function +import unittest +from test_dist_base import TestDistBase +import os + + +def skip_ci(func): + on_ci = bool(int(os.environ.get("SKIP_UNSTABLE_CI", '0'))) + + def __func__(*args, **kwargs): + if on_ci: + return + return func(*args, **kwargs) + + return __func__ + + +class TestDistSeResneXt2x2(TestDistBase): + def _setup_config(self): + self._sync_mode = True + self._use_reader_alloc = False + + @skip_ci + def test_dist_train(self): + self.check_with_place("dist_se_resnext.py", delta=1e-7) + + +if __name__ == "__main__": + unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_dist_se_resnext_sync_with_memopt.py b/python/paddle/fluid/tests/unittests/test_dist_se_resnext_sync_with_memopt.py new file mode 100644 index 0000000000..e39e07a58e --- /dev/null +++ b/python/paddle/fluid/tests/unittests/test_dist_se_resnext_sync_with_memopt.py @@ -0,0 +1,44 @@ +# Copyright (c) 2018 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. + +from __future__ import print_function +import unittest +from test_dist_base import TestDistBase +import os + + +def skip_ci(func): + on_ci = bool(int(os.environ.get("SKIP_UNSTABLE_CI", '0'))) + + def __func__(*args, **kwargs): + if on_ci: + return + return func(*args, **kwargs) + + return __func__ + + +class TestDistseResnXt2x2WithMemopt(TestDistBase): + def _setup_config(self): + self._sync_mode = True + self._mem_opt = True + self._use_reader_alloc = False + + @skip_ci + def test_dist_train(self): + self.check_with_place("dist_se_resnext.py", delta=1e-7) + + +if __name__ == "__main__": + unittest.main() -- GitLab