From b73a71d11e9897e359921ece22d97f3fa7b93dc6 Mon Sep 17 00:00:00 2001 From: Dang Qingqing Date: Tue, 16 Apr 2019 19:26:12 +0800 Subject: [PATCH] Fix test_profiler when the machine has many cores test=develop --- python/paddle/fluid/tests/unittests/test_profiler.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/paddle/fluid/tests/unittests/test_profiler.py b/python/paddle/fluid/tests/unittests/test_profiler.py index 39d778b82a..367b60831c 100644 --- a/python/paddle/fluid/tests/unittests/test_profiler.py +++ b/python/paddle/fluid/tests/unittests/test_profiler.py @@ -26,6 +26,10 @@ import paddle.fluid.proto.profiler.profiler_pb2 as profiler_pb2 class TestProfiler(unittest.TestCase): + @classmethod + def setUpClass(cls): + os.environ['CPU_NUM'] = str(4) + def net_profiler(self, state, use_parallel_executor=False): profile_path = os.path.join(tempfile.gettempdir(), "profile") open(profile_path, "w").write("")