Skip to content

Commit

Permalink
setting result in scheduler, and deeply comparing mpi messages
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed Oct 15, 2021
1 parent 797abe4 commit 102b79c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
3 changes: 0 additions & 3 deletions src/scheduler/MpiWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@ void MpiWorld::create(const faabric::Message& call, int newId, int newSize)
msg.set_mpiworldsize(size);
// Log chained functions to generate execution graphs
sch.logChainedFunction(call.id(), msg.id());
SPDLOG_INFO("Logging chained call (MsgId-WorldId: {}-{}, Rank: {}/{}) -> (MsgId-WorldId: {}-{}, Rank: {}/{})",
call.id(), call.mpiworldid(), call.mpirank(), call.mpiworldsize(),
msg.id(), msg.mpiworldid(), msg.mpirank(), msg.mpiworldsize());
}

std::vector<std::string> executedAt;
Expand Down
19 changes: 4 additions & 15 deletions tests/test/scheduler/test_exec_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ TEST_CASE_METHOD(MpiBaseTestFixture,
"[mpi][scheduler]")
{
faabric::scheduler::MpiWorld world;
msg.set_ismpi(true);

// Build the message vector to reconstruct the graph
std::vector<faabric::Message> messages(worldSize);
for (int rank = 0; rank < worldSize; rank++) {
messages.at(rank) = faabric::util::messageFactory("mpi", "hellompi");
messages.at(rank).set_mpirank(rank);
messages.at(rank).set_ismpi(true);
messages.at(rank).set_mpiworldid(worldId);
messages.at(rank).set_mpirank(rank);
messages.at(rank).set_mpiworldsize(worldSize);
}

world.create(msg, worldId, worldSize);
Expand Down Expand Up @@ -110,20 +113,6 @@ TEST_CASE_METHOD(MpiBaseTestFixture,
REQUIRE(countExecGraphNodes(actual) == worldSize);
REQUIRE(countExecGraphNodes(expected) == worldSize);

// Print contents of actual
SPDLOG_INFO("Actual root node. MsgId-World id: {}-{}, Rank: {}/{}",
actual.rootNode.msg.id(),
actual.rootNode.msg.mpiworldid(),
actual.rootNode.msg.mpirank(),
actual.rootNode.msg.mpiworldsize());
for (const auto& node : actual.rootNode.children) {
SPDLOG_INFO("Actual children node. MsgId-World id: {}-{}, Rank: {}/{}",
node.msg.id(),
node.msg.mpiworldid(),
node.msg.mpirank(),
node.msg.mpiworldsize());
}

checkExecGraphEquality(expected, actual, true);
}
}
2 changes: 1 addition & 1 deletion tests/utils/exec_graph_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void checkExecGraphNodeEquality(const scheduler::ExecGraphNode& nodeA,
{
// Check the message itself
if (isMpi) {
REQUIRE(nodeA.msg.mpirank() == nodeB.msg.mpirank());
checkMpiMessageEquivalence(nodeA.msg, nodeB.msg);
} else {
checkMessageEquality(nodeA.msg, nodeB.msg);
}
Expand Down
3 changes: 3 additions & 0 deletions tests/utils/faabric_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ void cleanFaabric();
void checkMessageEquality(const faabric::Message& msgA,
const faabric::Message& msgB);

void checkMpiMessageEquivalence(const faabric::Message& msgA,
const faabric::Message& msgB);

void checkExecGraphNodeEquality(const scheduler::ExecGraphNode& nodeA,
const scheduler::ExecGraphNode& nodeB,
bool isMpi = false);
Expand Down
12 changes: 12 additions & 0 deletions tests/utils/message_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,16 @@ void checkMessageEquality(const faabric::Message& msgA,
REQUIRE(msgA.sgxpolicy() == msgB.sgxpolicy());
REQUIRE(msgA.sgxresult() == msgB.sgxresult());
}

void checkMpiMessageEquivalence(const faabric::Message& msgA,
const faabric::Message& msgB)
{
REQUIRE(msgA.user() == msgB.user());
REQUIRE(msgA.function() == msgB.function());

REQUIRE(msgA.ismpi() == msgB.ismpi());
REQUIRE(msgA.mpiworldid() == msgB.mpiworldid());
REQUIRE(msgA.mpirank() == msgB.mpirank());
REQUIRE(msgA.mpiworldsize() == msgB.mpiworldsize());
}
}

0 comments on commit 102b79c

Please sign in to comment.