Skip to content

Commit

Permalink
Add convenience method for allgather (#8804)
Browse files Browse the repository at this point in the history
  • Loading branch information
rongou committed Feb 15, 2023
1 parent f27a725 commit 74572b5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/collective/communicator-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@ inline void Broadcast(std::string *sendrecv_data, int root) {
}
}

/**
* @brief Gathers data from all processes and distributes it to all processes.
*
* This assumes all ranks have the same size, and input data has been sliced into the
* corresponding position.
*
* @param send_receive_buffer Buffer storing the data.
* @param size Size of the data in bytes.
*/
inline void Allgather(void *send_receive_buffer, std::size_t size) {
Communicator::Get()->AllGather(send_receive_buffer, size);
}

/*!
* \brief Perform in-place allreduce. This function is NOT thread-safe.
*
Expand Down

0 comments on commit 74572b5

Please sign in to comment.