From 39bd2fb5e4b46db2ef54388eb715956137087ceb Mon Sep 17 00:00:00 2001 From: tangwei12 Date: Thu, 20 Aug 2020 19:15:32 +0800 Subject: [PATCH] add print test_dist UT elapsed time (#26397) * add print test_dist UT elapsed time * UT elapsed time optimize --- .../fluid/tests/unittests/test_dist_fleet_base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_dist_fleet_base.py b/python/paddle/fluid/tests/unittests/test_dist_fleet_base.py index 620b5e16a1d..beb0069eb77 100644 --- a/python/paddle/fluid/tests/unittests/test_dist_fleet_base.py +++ b/python/paddle/fluid/tests/unittests/test_dist_fleet_base.py @@ -57,7 +57,7 @@ class FleetDistRunnerBase(object): if args.role.upper() == "PSERVER": role = role_maker.UserDefinedRoleMaker( is_collective=False, - init_gloo=True, + init_gloo=False, path=args.gloo_path, current_id=args.current_id, role=role_maker.Role.SERVER, @@ -66,7 +66,7 @@ class FleetDistRunnerBase(object): else: role = role_maker.UserDefinedRoleMaker( is_collective=False, - init_gloo=True, + init_gloo=False, path=args.gloo_path, current_id=args.current_id, role=role_maker.Role.WORKER, @@ -160,7 +160,13 @@ class TestFleetBase(unittest.TestCase): def _setup_config(self): raise NotImplementedError("tests should have _setup_config implemented") + def tearDown(self): + t = time.time() - self.startTime + print('%s: %.3f' % (self.__class__.__name__, t)) + def setUp(self): + self.startTime = time.time() + self._mode = "sync" self._reader = "pyreader" self._trainers = 2 -- GitLab