in gloo/benchmark/main.cc [791:824]
void run() override {
const int niters = this->options_.messages;
// Only send on process with rank 0
if (this->context_->rank == srcRank_) {
for (int i = 0; i < niters; i++) {
buf_->send(dstRank_, kSlot);
// If we run synchronously, call waitSend after each send
if (!async_) {
buf_->waitSend();
}
}
// If we run asynchronously, call waitSend after all sends
if (async_) {
for (int i = 0; i < niters; i++) {
buf_->waitSend();
}
}
// Only recv on process with rank 1
} else {
for (int i = 0; i < niters; i++) {
buf_->recv(srcRank_, kSlot);
// If we run synchronously, call waitRecv after each recv
if (!async_) {
buf_->waitRecv();
}
}
// If we run asynchronously, call waitRecv after all recvs
if (async_) {
for (int i = 0; i < niters; i++) {
buf_->waitRecv();
}
}
}
}