未验证 提交 064e549b 编写于 作者: 石晓伟 提交者: GitHub

force single thread when CINN is on (#44103)

上级 6eed9f49
......@@ -16,6 +16,7 @@ import multiprocessing
import os
import six
import sys
import warnings
from .. import compat as cpt
from . import framework
from .framework import _get_paddle_place, _get_paddle_place_list
......@@ -373,6 +374,12 @@ class CompiledProgram(object):
else:
self._exec_strategy.num_threads = len(places) * 2
if "FLAGS_use_cinn" in core.globals() and core.globals(
)["FLAGS_use_cinn"] and self._exec_strategy.num_threads != 1:
warnings.warn("At present, when CINN is turned on, each process can " \
"only contain one thread, so reset the number of threads to 1 here.")
self._exec_strategy.num_threads = 1
if self._build_strategy.num_trainers > 1:
assert self._is_data_parallel, \
"If you use multi-trainer to train the model, you should use "\
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册