Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions gloo/allgather.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ void allgather(AllgatherOptions& opts) {
const size_t inBytes = out->size / context->size;
const size_t outBytes = out->size;

// Short circuit if the output is empty.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this be better before calculating sendRank & recvRank i.e under sanity checks?

if (outBytes == 0) {
return;
}

// If the input buffer is specified, this is NOT an in place operation,
// and the output buffer needs to be primed with the input.
if (in != nullptr) {
Expand All @@ -53,8 +58,8 @@ void allgather(AllgatherOptions& opts) {
in->size);
}

// Short circuit if there is only a single process or the output is empty.
if (context->size == 1 || outBytes == 0) {
// Short circuit if there is only a single process.
if (context->size == 1) {
return;
}

Expand Down
Loading