MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / StartStep

Method StartStep

tensorflow/core/distributed_runtime/master_session.cc:1721–1765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1719}
1720
1721Status MasterSession::StartStep(const BuildGraphOptions& opts, bool is_partial,
1722 ReffedClientGraph** out_rcg, int64* out_count) {
1723 const uint64 hash = HashBuildGraphOptions(opts);
1724 {
1725 mutex_lock l(mu_);
1726 // TODO(suharshs): We cache partial run graphs and run graphs separately
1727 // because there is preprocessing that needs to only be run for partial
1728 // run calls.
1729 RCGMap* m = is_partial ? &partial_run_graphs_ : &run_graphs_;
1730 auto iter = m->find(hash);
1731 if (iter == m->end()) {
1732 // We have not seen this subgraph before. Build the subgraph and
1733 // cache it.
1734 VLOG(1) << "Unseen hash " << hash << " for "
1735 << BuildGraphOptionsString(opts) << " is_partial = " << is_partial
1736 << "\n";
1737 std::unique_ptr<ClientGraph> client_graph;
1738 TF_RETURN_IF_ERROR(execution_state_->BuildGraph(opts, &client_graph));
1739 WorkerCacheInterface* worker_cache = get_worker_cache();
1740 /*auto entry = new ReffedClientGraph(
1741 handle_, opts, std::move(client_graph), session_opts_,
1742 stats_publisher_factory_, is_partial, worker_cache,
1743 !should_delete_worker_sessions_);*/
1744 ReffedClientGraph *entry = nullptr;
1745 if (env_->run_graph_mode || env_->run_graph_mode_lite) {
1746 entry = new ReffedClientGraphV2(
1747 handle_, opts, std::move(client_graph), session_opts_,
1748 stats_publisher_factory_, execution_state_.get(), is_partial,
1749 worker_cache, env_, !should_delete_worker_sessions_);
1750 LOG(INFO) << "Use ReffedClientGraphV2 for partition and run graph.";
1751 } else {
1752 entry = new ReffedClientGraph(
1753 handle_, opts, std::move(client_graph), session_opts_,
1754 stats_publisher_factory_, execution_state_.get(), is_partial,
1755 worker_cache, env_, !should_delete_worker_sessions_);
1756 }
1757 iter = m->insert({hash, entry}).first;
1758 VLOG(1) << "Preparing to execute new graph";
1759 }
1760 *out_rcg = iter->second;
1761 (*out_rcg)->Ref();
1762 *out_count = (*out_rcg)->get_and_increment_execution_count();
1763 }
1764 return Status::OK();
1765}
1766
1767void MasterSession::ClearRunsTable(std::vector<ReffedClientGraph*>* to_unref,
1768 RCGMap* rcg_map) {

Callers

nothing calls this directly

Calls 9

HashBuildGraphOptionsFunction · 0.85
BuildGraphOptionsStringFunction · 0.85
findMethod · 0.45
endMethod · 0.45
BuildGraphMethod · 0.45
getMethod · 0.45
insertMethod · 0.45
RefMethod · 0.45

Tested by

no test coverage detected