| 1046 | } |
| 1047 | |
| 1048 | Status DirectSession::RunInternal( |
| 1049 | int64 step_id, const RunOptions& run_options, |
| 1050 | CallFrameInterface* call_frame, ExecutorsAndKeys* executors_and_keys, |
| 1051 | RunMetadata* run_metadata, |
| 1052 | const thread::ThreadPoolOptions& threadpool_options) { |
| 1053 | const uint64 start_time_usecs = options_.env->NowMicros(); |
| 1054 | const int64 executor_step_count = executors_and_keys->step_count.fetch_add(1); |
| 1055 | RunState run_state(step_id, &devices_); |
| 1056 | |
| 1057 | profiler::TraceMe activity( |
| 1058 | [&] { |
| 1059 | if (options_.config.experimental().has_session_metadata()) { |
| 1060 | const auto& model_metadata = |
| 1061 | options_.config.experimental().session_metadata(); |
| 1062 | return strings::StrCat("SessionRun #id=", step_id, |
| 1063 | ",model_id=", model_metadata.name(), ":", |
| 1064 | model_metadata.version(), "#"); |
| 1065 | } else { |
| 1066 | return strings::StrCat("SessionRun #id=", step_id, "#"); |
| 1067 | } |
| 1068 | }, |
| 1069 | profiler::TraceMeLevel::kInfo); |
| 1070 | |
| 1071 | std::unique_ptr<DebuggerStateInterface> debugger_state; |
| 1072 | if (!run_options.debug_options().debug_tensor_watch_opts().empty()) { |
| 1073 | TF_RETURN_IF_ERROR( |
| 1074 | CreateDebuggerState(executors_and_keys->callable_options, |
| 1075 | run_options.debug_options().global_step(), step_id, |
| 1076 | executor_step_count, &debugger_state)); |
| 1077 | } |
| 1078 | |
| 1079 | run_state.rendez = new IntraProcessRendezvous(device_mgr_); |
| 1080 | #ifndef __ANDROID__ |
| 1081 | // Set up for collectives if ExecutorsAndKeys declares a key. |
| 1082 | if (executors_and_keys->collective_graph_key != |
| 1083 | BuildGraphOptions::kNoCollectiveGraphKey) { |
| 1084 | if (run_options.experimental().collective_graph_key() != |
| 1085 | BuildGraphOptions::kNoCollectiveGraphKey) { |
| 1086 | // If a collective_graph_key was specified in run_options, ensure that it |
| 1087 | // matches what came out of GraphExecutionState::BuildGraph(). |
| 1088 | if (run_options.experimental().collective_graph_key() != |
| 1089 | executors_and_keys->collective_graph_key) { |
| 1090 | return errors::Internal( |
| 1091 | "collective_graph_key in RunOptions ", |
| 1092 | run_options.experimental().collective_graph_key(), |
| 1093 | " should match collective_graph_key from optimized graph ", |
| 1094 | executors_and_keys->collective_graph_key); |
| 1095 | } |
| 1096 | } |
| 1097 | if (!collective_executor_mgr_) { |
| 1098 | std::unique_ptr<DeviceResolverInterface> drl( |
| 1099 | new DeviceResolverLocal(device_mgr_)); |
| 1100 | std::unique_ptr<ParamResolverInterface> cprl( |
| 1101 | new CollectiveParamResolverLocal(options_.config, device_mgr_, |
| 1102 | drl.get(), |
| 1103 | "/job:localhost/replica:0/task:0")); |
| 1104 | collective_executor_mgr_.reset(new CollectiveExecutorMgr( |
| 1105 | options_.config, device_mgr_, std::move(drl), std::move(cprl))); |
nothing calls this directly
no test coverage detected