Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fix hanging when kNullOp exists, safter checking in executor (#3482)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen authored and piiswrong committed Nov 30, 2016
1 parent 1398578 commit 09ff15b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/executor/graph_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -548,12 +548,17 @@ void GraphExecutor::InitCachedOps() {
vars.resize(std::unique(vars.begin(), vars.end()) - vars.begin());
};
dedup(use_vars);
for (auto v : use_vars) {
if (std::binary_search(mutate_vars.begin(), mutate_vars.end(), v)) {
LOG(FATAL) << "var duplication happens for op " << inode.source->attrs.name;
}
}
dedup(mutate_vars);
dedup(all_vars);
Engine::Get()->PushSync([exec](RunContext rctx) {
exec->Setup();
}, Context::CPU(), {}, all_vars);
auto exec_fun = [exec, is_async, is_gpu](
auto exec_fun = [exec, is_async, is_gpu] (
RunContext ctx, Engine::CallbackOnComplete on_complete) {
if (is_async) {
exec->op_ctx.async_on_complete = on_complete;
Expand Down Expand Up @@ -585,8 +590,8 @@ void GraphExecutor::RunOps(bool is_train, size_t topo_start, size_t topo_end) {
for (size_t nid = topo_start; nid < topo_end; ++nid) {
const auto& inode = idx[nid];
if (inode.source->is_variable()) continue;
if (op_nodes_[nid].skip_exec_node) continue;
OpNode& opnode = op_nodes_[nid];
if (op_nodes_[nid].skip_exec_node) continue;
opnode.exec->op_ctx.is_train = is_train;
if (opnode.exec->exec_type() == Operator::kCrossDeviceCopy) {
CHECK_EQ(inode.inputs.size(), 1);
Expand Down

0 comments on commit 09ff15b

Please sign in to comment.