MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / AllgatherRing

Method AllgatherRing

src/network/network.cpp:216–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216void Network::AllgatherRing(char* input, const comm_size_t* block_start, const comm_size_t* block_len, char* output, comm_size_t) {
217 // use output as receive buffer
218 std::memcpy(output + block_start[rank_], input, block_len[rank_]);
219 int out_rank = (rank_ + 1) % num_machines_;
220 int in_rank = (rank_ - 1 + num_machines_) % num_machines_;
221 int out_block = rank_;
222 int in_block = in_rank;
223 for (int i = 1; i < num_machines_; ++i) {
224 // send and recv at same time
225 linkers_->SendRecv(out_rank, output + block_start[out_block], block_len[out_block],
226 in_rank, output + block_start[in_block], block_len[in_block]);
227 out_block = (out_block - 1 + num_machines_) % num_machines_;
228 in_block = (in_block - 1 + num_machines_) % num_machines_;
229 }
230}
231
232void Network::ReduceScatter(char* input, comm_size_t input_size, int type_size,
233 const comm_size_t* block_start, const comm_size_t* block_len, char* output,

Callers

nothing calls this directly

Calls 1

SendRecvMethod · 0.45

Tested by

no test coverage detected