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

Method ConnectivityCheck

tensorflow/contrib/verbs/rdma_mgr.cc:136–182  ·  view source on GitHub ↗

Check connectivity by pinging every channel

Source from the content-addressed store, hash-verified

134
135// Check connectivity by pinging every channel
136bool RdmaMgr::ConnectivityCheck() {
137 int i, rcnt = 0, scnt = 0;
138
139 for (const auto& p : channel_table_) {
140 string worker_name = p.first;
141 RdmaChannel* rc = p.second;
142
143 VLOG(2) << "Ping to " << worker_name;
144 CHECK(rc->PingPostSend() == 0) << "Couldn't post send to " << worker_name
145 << " with error: " << std::strerror(errno);
146 for (i = 0; i < rc->adapter_->params_.queue_depth - 1; i++) {
147 rc->Recv();
148 }
149 }
150
151 while (rcnt < num_remote_workers_ || scnt < num_remote_workers_) {
152 int ne;
153 do {
154 ne = ibv_poll_cq(rdma_adapter_->cq_, 2 * num_remote_workers_,
155 rdma_adapter_->wc_);
156 CHECK(ne >= 0) << "poll CQ failed " << ne << "with error"
157 << std::strerror(errno);
158 } while (ne < 1);
159
160 for (i = 0; i < ne; ++i) {
161 ibv_wc_status s = rdma_adapter_->wc_[i].status;
162 // recv complete
163 if ((int)rdma_adapter_->wc_[i].wr_id == RdmaChannel::kPingRecvWrid) {
164 CHECK(s == IBV_WC_SUCCESS)
165 << ": " << ibv_wc_status_str(rdma_adapter_->wc_[i].status) << "("
166 << rdma_adapter_->wc_[i].status << ") for PING_RECV_WRID";
167 ++rcnt;
168 // send complete
169 } else {
170 RdmaChannel* rc =
171 reinterpret_cast<RdmaChannel*>(rdma_adapter_->wc_[i].wr_id);
172 CHECK(s == IBV_WC_SUCCESS)
173 << ": " << ibv_wc_status_str(rdma_adapter_->wc_[i].status) << "("
174 << rdma_adapter_->wc_[i].status << ") to " << rc->remote_name_;
175 ++scnt;
176 }
177 } // for
178 } // while
179 CHECK(rcnt == scnt) << "Connectivity check failed!";
180 rdma_adapter_->StartPolling();
181 return (num_remote_workers_ == rcnt) && (num_remote_workers_ == scnt);
182}
183
184RdmaMgr::~RdmaMgr() {
185 for (const auto& p : channel_table_) delete p.second;

Callers 1

StartMethod · 0.80

Calls 3

PingPostSendMethod · 0.80
StartPollingMethod · 0.80
RecvMethod · 0.45

Tested by

no test coverage detected