| 119 | } |
| 120 | |
| 121 | void Network::Allgather(char* input, comm_size_t send_size, char* output) { |
| 122 | if (num_machines_ <= 1) { |
| 123 | Log::Fatal("Please initilize the network interface first"); |
| 124 | return; |
| 125 | } |
| 126 | // assign blocks |
| 127 | block_start_[0] = 0; |
| 128 | block_len_[0] = send_size; |
| 129 | for (int i = 1; i < num_machines_; ++i) { |
| 130 | block_start_[i] = block_start_[i - 1] + block_len_[i - 1]; |
| 131 | block_len_[i] = send_size; |
| 132 | } |
| 133 | // start all gather |
| 134 | Allgather(input, block_start_.data(), block_len_.data(), output, send_size * num_machines_); |
| 135 | } |
| 136 | |
| 137 | void Network::Allgather(char* input, const comm_size_t* block_start, const comm_size_t* block_len, char* output, comm_size_t all_size) { |
| 138 | if (num_machines_ <= 1) { |