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

Method MPIBackgroundThread

tensorflow/contrib/mpi/mpi_rendezvous_mgr.cc:277–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277void MPIRendezvousMgr::MPIBackgroundThread() {
278 std::list<std::unique_ptr<MPISendTensorCall>> active_sends;
279
280 while (1) {
281 MPI_Status status;
282
283 // Check for incoming Tensor requests
284 RecvTensorRequest request;
285 if (ProbeForData(TAG_REQTENSOR, &status, &request)) {
286 this->AddRequest(request, status.MPI_SOURCE);
287 }
288
289 // Check for incoming Tensor reply
290 MPIRecvTensorResponse mRes;
291 if (ProbeForData(TAG_SENDTENSOR, &status, &mRes)) {
292 const int64 step_id = mRes.step_id();
293 std::string key = mRes.key();
294
295 std::shared_ptr<MPIRequestTensorCall> call;
296 GetRecvCall(step_id, key, &call);
297 call->recv_call_(mRes);
298 RemoveRecvCall(step_id, key);
299 }
300
301 // Remove sends that have been completed
302 active_sends.remove_if(
303 [](std::unique_ptr<MPISendTensorCall>& i) { return i->IsFinished(); });
304
305 // send a Tensor request
306 RequestQueueEntry req;
307 if (GetRequest(&req)) req.second();
308
309 // Send a Tensor response
310 SendQueueEntry send;
311 if (GetResponse(&send)) {
312 std::unique_ptr<MPISendTensorCall> p(send.second());
313 active_sends.push_back(std::move(p));
314 }
315
316 // std::this_thread::sleep_for(std::chrono::microseconds(1));
317 }
318}
319
320} // namespace tensorflow
321#endif // TENSORFLOW_USE_MPI

Callers

nothing calls this directly

Calls 6

AddRequestMethod · 0.95
secondMethod · 0.80
step_idMethod · 0.45
keyMethod · 0.45
IsFinishedMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected