未验证 提交 e0ccaeaf 编写于 作者: L Leo Chen 提交者: GitHub

[new-exec] fit empty program for new executor (#41328)

上级 2a01a157
......@@ -516,6 +516,12 @@ void InterpreterCore::RunInstruction(const Instruction& instr_node) {
void InterpreterCore::ExecuteInstructionList(
const std::vector<Instruction>& vec_instr) {
unfinished_op_numer_ = vec_instr.size();
if (unfinished_op_numer_ == 0) {
VLOG(4) << "No op to run, return";
return;
}
// NOTE(zhiqiu): get the prepared deps from std::future, and async prepare
// those for the next step
auto atomic_deps = async_work_queue_->AtomicDeps();
......@@ -524,8 +530,6 @@ void InterpreterCore::ExecuteInstructionList(
async_work_queue_->PrepareAtomicDeps(dependecy_count_);
async_work_queue_->PrepareAtomicVarRef(global_scope_->VecMetaInfo());
unfinished_op_numer_ = vec_instr.size();
exception_holder_.Clear();
for (size_t i = 0; i < dependecy_count_.size(); ++i) {
......
......@@ -277,6 +277,18 @@ class SwitchExecutorInterfaceWithFeed(unittest.TestCase):
for x, y in zip(gt, res):
self.assertTrue(np.array_equal(x, y))
def test_empty_program(self):
program = paddle.static.Program()
exe = paddle.static.Executor(self.place)
for i in range(10):
out = exe.run() # old executor
for i in range(10):
print(i, flush=1)
os.environ['FLAGS_USE_STANDALONE_EXECUTOR'] = '1'
out = exe.run(program, feed=None)
del os.environ['FLAGS_USE_STANDALONE_EXECUTOR']
class TestException(unittest.TestCase):
def setUp(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册