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

Method InitializeRemoteWorker

tensorflow/core/common_runtime/eager/context.cc:763–805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763Status EagerContext::InitializeRemoteWorker(
764 std::unique_ptr<eager::EagerClientCache> remote_eager_workers,
765 const DeviceMgr* remote_device_mgr,
766 const std::vector<string>& remote_contexts, uint64 context_id,
767 std::function<Rendezvous*(const int64)> rendezvous_creator,
768 std::unique_ptr<eager::RemoteMgr, std::function<void(eager::RemoteMgr*)>>
769 remote_mgr) {
770 if (context_id == kInvalidContextId) {
771 return errors::InvalidArgument(
772 "Failed to initialize remote for worker context due to invalid ",
773 "context id");
774 }
775 mutex_lock l(remote_state_mu_);
776
777 if (remote_device_manager_ != nullptr || server_ != nullptr ||
778 keep_alive_thread_ != nullptr) {
779 return errors::FailedPrecondition(
780 "EagerContext::InitializeRemoteWorker Failed. ",
781 "Already initialized remote as a master context.");
782 }
783 is_master_ = false;
784
785 remote_contexts_ = remote_contexts;
786 context_id_ = context_id;
787
788 rendezvous_creator_ = std::move(rendezvous_creator);
789 remote_eager_workers_ = std::move(remote_eager_workers);
790 remote_mgr_ = std::move(remote_mgr);
791
792 remote_unowned_device_manager_ = remote_device_mgr;
793 InitDeviceMapAndAsync();
794
795 ClearCaches();
796 default_executor_.ClearError();
797 {
798 tensorflow::mutex_lock l(executor_map_mu_);
799 for (auto& entry : thread_local_executor_) {
800 entry.second->ClearError();
801 }
802 }
803
804 return Status::OK();
805}
806#endif // !IS_MOBILE_PLATFORM
807
808} // namespace tensorflow

Callers 2

TEST_FFunction · 0.80
CreateContextMethod · 0.80

Calls 3

InvalidArgumentFunction · 0.85
FailedPreconditionFunction · 0.85
ClearErrorMethod · 0.80

Tested by 1

TEST_FFunction · 0.64