Browse Source

!27 Rebuild graph before RunGraph if needed

Merge pull request !27 from Simson/master
tags/v0.3.0-alpha
mindspore-ci-bot Gitee 6 years ago
parent
commit
3bde6404de
2 changed files with 10 additions and 1 deletions
  1. +7
    -0
      mindspore/ccsrc/transform/graph_runner.cc
  2. +3
    -1
      mindspore/ccsrc/utils/context/ms_context.cc

+ 7
- 0
mindspore/ccsrc/transform/graph_runner.cc View File

@@ -138,6 +138,13 @@ Status GraphRunner::RunGraph(const RunOptions& options, const std::vector<GeTens
return Status::FAILED;
}

// The information of some nodes could be changed after fusion in some cases
// Therefore a graph needs to be rebuilt in above situation
if (sess_->IsGraphNeedRebuild(wrap_ptr->id_)) {
sess_->RemoveGraph(wrap_ptr->id_);
sess_->AddGraph(wrap_ptr->id_, *(wrap_ptr->graph_ptr_), wrap_ptr->options_);
}

ge::Status ret = sess_->RunGraph(wrap_ptr->id_, ge_inputs, ge_outputs);
if (ret != ge::GRAPH_SUCCESS) {
MS_LOG(ERROR) << "Call GE RunGraph Failed, ret is: " << ret;


+ 3
- 1
mindspore/ccsrc/utils/context/ms_context.cc View File

@@ -358,7 +358,9 @@ void MsContext::GetGeOptions(std::map<std::string, std::string>* ge_options) con
MS_LOG(ERROR) << "Set proto lib path failed!";
}

// Disbale the global variable acc, only enable it whlie adding training graph in pipeline
// Enable auto mixed precision according to the context options
(*ge_options)["ge.exec.auto_mix_precision"] = std::to_string(auto_mixed_precision_flag_);
// Disable the global variable acc, only enable it whlie adding training graph in pipeline
(*ge_options)["ge.exec.variable_acc"] = "0";
#endif
}


Loading…
Cancel
Save