Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions gloo/allgather.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ void allgather(AllgatherOptions& opts) {
in->size);
}

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

Expand Down
4 changes: 4 additions & 0 deletions gloo/allgather_ring.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class AllgatherRing : public Algorithm {
virtual ~AllgatherRing() {}

void run() {
// Short circuit if there is only a single process or the output is empty.
if (this->contextSize_ == 1 || count_ == 0) {
return;
}
const int rank = this->contextRank_;
const int numRounds = this->contextSize_ - 1;

Expand Down
4 changes: 2 additions & 2 deletions gloo/allgatherv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ void allgatherv(AllgathervOptions& opts) {
}
}

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

Expand Down
4 changes: 2 additions & 2 deletions gloo/test/allgather_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::Combine(
::testing::ValuesIn(kTransportsForClassAlgorithms),
::testing::Range(2, 10),
::testing::Values(4, 100, 1000, 10000),
::testing::Values(0, 4, 100, 1000, 10000),
::testing::Range(1, 4)));

using NewParam = std::tuple<Transport, int, int, bool>;
Expand Down Expand Up @@ -157,7 +157,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::Combine(
::testing::ValuesIn(kTransportsForFunctionAlgorithms),
::testing::Values(1, 2, 4, 7),
::testing::Values(4, 100, 1000, 10000),
::testing::Values(0, 4, 100, 1000, 10000),
::testing::Values(false, true)));

TEST_F(AllgatherNewTest, TestTimeout) {
Expand Down
2 changes: 1 addition & 1 deletion gloo/test/allgatherv_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::Combine(
::testing::ValuesIn(kTransportsForFunctionAlgorithms),
::testing::Values(1, 2, 4, 7),
::testing::Values(1, 10, 100, 1000),
::testing::Values(0, 1, 10, 100, 1000),
::testing::Values(false, true)));

TEST_F(AllgathervTest, TestTimeout) {
Expand Down