Skip to content

Commit 0c0da25

Browse files
committed
fixed noncollective_communication test
1 parent 8275b6d commit 0c0da25

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/axom/lumberjack/MPIUtility.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515

1616
#include "axom/lumberjack/MPIUtility.hpp"
17-
1817
#include <cstring>
1918

2019
namespace axom

src/axom/lumberjack/NonCollectiveRootCommunicator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ bool NonCollectiveRootCommunicator::isOutputNode()
9696
int NonCollectiveRootCommunicator::mpiTag() const { return m_mpiTag; }
9797

9898
} // end namespace lumberjack
99-
} // end namespace axom
99+
} // end namespace axom

src/axom/lumberjack/tests/lumberjack_NonCollectiveRootCommunicator.hpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@ TEST(lumberjack_NonCollectiveRootCommunicator, noncollective_communication)
2323

2424
std::vector<const char*> receivedPackedMessages;
2525

26-
// send message only from even ranks
27-
if((c.rank() % 2) == 0)
26+
// send message only from even ranks that are non-zero
27+
if((c.rank() % 2) == 0 && c.rank() != 0)
28+
{
29+
c.push(message.c_str(), receivedPackedMessages);
30+
}
31+
32+
MPI_Barrier(MPI_COMM_WORLD);
33+
34+
// receive messages from rank 0 after barrier
35+
if(c.rank() == 0)
2836
{
2937
c.push(message.c_str(), receivedPackedMessages);
3038
}
@@ -51,7 +59,7 @@ TEST(lumberjack_NonCollectiveRootCommunicator, noncollective_communication)
5159
}
5260
if(!found)
5361
{
54-
std::cout << "Error: Message not received:" << currMessage << std::endl;
62+
std::cout << "Error: Message not received: " << currMessage << std::endl;
5563
}
5664
EXPECT_EQ(found, true);
5765
}
@@ -95,4 +103,4 @@ TEST(lumberjack_NonCollectiveRootCommunicator, multiple_communicators)
95103
c2.finalize();
96104

97105
MPI_Barrier(MPI_COMM_WORLD);
98-
}
106+
}

0 commit comments

Comments
 (0)