未验证 提交 03dbae4c 编写于 作者: G Guo Sheng 提交者: GitHub

Fix the defalut value of CPU_NUM to be consistent with Paddle framework. (#2823)

Fix the leaving out of subprocess importing.
上级 645c1fdc
...@@ -4,6 +4,7 @@ import copy ...@@ -4,6 +4,7 @@ import copy
import logging import logging
import multiprocessing import multiprocessing
import os import os
import subprocess
if os.environ.get('FLAGS_eager_delete_tensor_gb', None) is None: if os.environ.get('FLAGS_eager_delete_tensor_gb', None) is None:
os.environ['FLAGS_eager_delete_tensor_gb'] = '0' os.environ['FLAGS_eager_delete_tensor_gb'] = '0'
...@@ -667,7 +668,8 @@ def train(args): ...@@ -667,7 +668,8 @@ def train(args):
if training_role == "PSERVER" or (not TrainTaskConfig.use_gpu): if training_role == "PSERVER" or (not TrainTaskConfig.use_gpu):
place = fluid.CPUPlace() place = fluid.CPUPlace()
dev_count = int(os.environ.get('CPU_NUM', multiprocessing.cpu_count())) # the default setting of CPU_NUM in paddle framework is 1
dev_count = int(os.environ.get('CPU_NUM', 1))
else: else:
check_cuda(TrainTaskConfig.use_gpu) check_cuda(TrainTaskConfig.use_gpu)
gpu_id = int(os.environ.get('FLAGS_selected_gpus', 0)) gpu_id = int(os.environ.get('FLAGS_selected_gpus', 0))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册