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

Method CreateExecutors

tensorflow/core/common_runtime/direct_session.cc:1886–2054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1884}
1885
1886Status DirectSession::CreateExecutors(
1887 const CallableOptions& callable_options,
1888 std::unique_ptr<ExecutorsAndKeys>* out_executors_and_keys,
1889 std::unique_ptr<FunctionInfo>* out_func_info,
1890 RunStateArgs* run_state_args) {
1891 BuildGraphOptions options;
1892 options.callable_options = callable_options;
1893 options.use_function_convention = !run_state_args->is_partial_run;
1894 options.collective_graph_key =
1895 callable_options.run_options().experimental().collective_graph_key();
1896 if (options_.config.experimental()
1897 .collective_deterministic_sequential_execution()) {
1898 options.collective_order = GraphCollectiveOrder::kEdges;
1899 } else if (options_.config.experimental().collective_nccl()) {
1900 options.collective_order = GraphCollectiveOrder::kAttrs;
1901 }
1902
1903 std::unique_ptr<FunctionInfo> func_info(new FunctionInfo);
1904 std::unique_ptr<ExecutorsAndKeys> ek(new ExecutorsAndKeys);
1905
1906 ek->callable_options = callable_options;
1907
1908 std::unordered_map<string, std::unique_ptr<Graph>> graphs;
1909 TF_RETURN_IF_ERROR(CreateGraphs(
1910 options, &graphs, &func_info->flib_def, run_state_args, &ek->input_types,
1911 &ek->output_types, &ek->collective_graph_key));
1912
1913 if (run_state_args->is_partial_run) {
1914 ek->graph = std::move(run_state_args->graph);
1915 std::unordered_set<StringPiece, StringPieceHasher> names;
1916 for (const string& input : callable_options.feed()) {
1917 TensorId id(ParseTensorName(input));
1918 names.emplace(id.first);
1919 }
1920 for (const string& output : callable_options.fetch()) {
1921 TensorId id(ParseTensorName(output));
1922 names.emplace(id.first);
1923 }
1924 for (Node* n : ek->graph->nodes()) {
1925 if (names.count(n->name()) > 0) {
1926 ek->name_to_node.insert({n->name(), n});
1927 }
1928 }
1929 }
1930 ek->items.reserve(graphs.size());
1931 const auto& optimizer_opts =
1932 options_.config.graph_options().optimizer_options();
1933
1934 int graph_def_version = graphs.begin()->second->versions().producer();
1935
1936 const auto* session_metadata =
1937 options_.config.experimental().has_session_metadata()
1938 ? &options_.config.experimental().session_metadata()
1939 : nullptr;
1940 func_info->proc_flr.reset(new ProcessFunctionLibraryRuntime(
1941 device_mgr_, options_.env, graph_def_version,
1942 func_info->flib_def.get(), optimizer_opts, thread_pools_[0].first,
1943 nullptr, nullptr, session_metadata));

Callers

nothing calls this directly

Calls 15

ParseTensorNameFunction · 0.85
InternalFunction · 0.85
EnsureMemoryTypesFunction · 0.85
DeviceTypeClass · 0.85
NewExecutorFunction · 0.85
FrameAndIterClass · 0.85
collective_graph_keyMethod · 0.80
session_metadataMethod · 0.80
LookupDeviceMethod · 0.80
GetFLRMethod · 0.80
op_segmentMethod · 0.80
executor_typeMethod · 0.80

Tested by

no test coverage detected