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

Method GetClient

tensorflow/compiler/xrt/client/xrt_grpc_eager_client.cc:95–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93XrtGrpcEagerClientCache::~XrtGrpcEagerClientCache() { threads_.clear(); }
94
95xla::StatusOr<XrtGrpcEagerClient*> XrtGrpcEagerClientCache::GetClient(
96 const string& target) {
97 auto it = clients_.find(target);
98 if (it == clients_.end()) {
99 tensorflow::SharedGrpcChannelPtr shared = cache_->FindWorkerChannel(target);
100 if (!shared) {
101 return errors::NotFound("Unknown target ", target);
102 }
103 auto worker = absl::make_unique<XrtGrpcEagerClient>(
104 shared, threads_[AssignClientToThread(target)].completion_queue());
105
106 it = clients_.emplace(target, std::move(worker)).first;
107 }
108
109 return it->second.get();
110}
111
112size_t XrtGrpcEagerClientCache::AssignClientToThread(const string& target) {
113 // Round-robin target assignment, but keeps the same target on the same

Callers 2

CreateMethod · 0.45
TEST_FFunction · 0.45

Calls 7

NotFoundFunction · 0.85
findMethod · 0.45
endMethod · 0.45
FindWorkerChannelMethod · 0.45
completion_queueMethod · 0.45
emplaceMethod · 0.45
getMethod · 0.45

Tested by 1

TEST_FFunction · 0.36