Skip to content

Commit

Permalink
fixed noncollective_communication test
Browse files Browse the repository at this point in the history
  • Loading branch information
gberg617 committed Jan 17, 2025
1 parent 8275b6d commit 0c0da25
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/axom/lumberjack/MPIUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/

#include "axom/lumberjack/MPIUtility.hpp"

#include <cstring>

namespace axom
Expand Down
2 changes: 1 addition & 1 deletion src/axom/lumberjack/NonCollectiveRootCommunicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ bool NonCollectiveRootCommunicator::isOutputNode()
int NonCollectiveRootCommunicator::mpiTag() const { return m_mpiTag; }

} // end namespace lumberjack
} // end namespace axom
} // end namespace axom
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ TEST(lumberjack_NonCollectiveRootCommunicator, noncollective_communication)

std::vector<const char*> receivedPackedMessages;

// send message only from even ranks
if((c.rank() % 2) == 0)
// send message only from even ranks that are non-zero
if((c.rank() % 2) == 0 && c.rank() != 0)
{
c.push(message.c_str(), receivedPackedMessages);
}

MPI_Barrier(MPI_COMM_WORLD);

// receive messages from rank 0 after barrier
if(c.rank() == 0)
{
c.push(message.c_str(), receivedPackedMessages);
}
Expand All @@ -51,7 +59,7 @@ TEST(lumberjack_NonCollectiveRootCommunicator, noncollective_communication)
}
if(!found)
{
std::cout << "Error: Message not received:" << currMessage << std::endl;
std::cout << "Error: Message not received: " << currMessage << std::endl;
}
EXPECT_EQ(found, true);
}
Expand Down Expand Up @@ -95,4 +103,4 @@ TEST(lumberjack_NonCollectiveRootCommunicator, multiple_communicators)
c2.finalize();

MPI_Barrier(MPI_COMM_WORLD);
}
}

0 comments on commit 0c0da25

Please sign in to comment.