From ba74dcf5de27ccad2ca976a9f21477ca94148608 Mon Sep 17 00:00:00 2001 From: Carlos Segarra Date: Fri, 15 Oct 2021 09:16:37 +0000 Subject: [PATCH] setting result in scheduler, and deeply comparing mpi messages --- src/scheduler/MpiWorld.cpp | 3 --- tests/test/scheduler/test_exec_graph.cpp | 19 ++++--------------- tests/utils/exec_graph_utils.cpp | 3 ++- tests/utils/faabric_utils.h | 3 +++ tests/utils/message_utils.cpp | 12 ++++++++++++ 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/scheduler/MpiWorld.cpp b/src/scheduler/MpiWorld.cpp index 0192bf9a6..83d5223c3 100644 --- a/src/scheduler/MpiWorld.cpp +++ b/src/scheduler/MpiWorld.cpp @@ -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 executedAt; diff --git a/tests/test/scheduler/test_exec_graph.cpp b/tests/test/scheduler/test_exec_graph.cpp index f6efac9a4..032aa2cea 100644 --- a/tests/test/scheduler/test_exec_graph.cpp +++ b/tests/test/scheduler/test_exec_graph.cpp @@ -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 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); @@ -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); } } diff --git a/tests/utils/exec_graph_utils.cpp b/tests/utils/exec_graph_utils.cpp index 1b8457047..2eca1e279 100644 --- a/tests/utils/exec_graph_utils.cpp +++ b/tests/utils/exec_graph_utils.cpp @@ -11,7 +11,8 @@ void checkExecGraphNodeEquality(const scheduler::ExecGraphNode& nodeA, { // Check the message itself if (isMpi) { - REQUIRE(nodeA.msg.mpirank() == nodeB.msg.mpirank()); + // REQUIRE(nodeA.msg.mpirank() == nodeB.msg.mpirank()); + checkMpiMessageEquivalence(nodeA.msg, nodeB.msg); } else { checkMessageEquality(nodeA.msg, nodeB.msg); } diff --git a/tests/utils/faabric_utils.h b/tests/utils/faabric_utils.h index 27b933b73..a7162fcaf 100644 --- a/tests/utils/faabric_utils.h +++ b/tests/utils/faabric_utils.h @@ -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); diff --git a/tests/utils/message_utils.cpp b/tests/utils/message_utils.cpp index 843dc9762..f0220b64d 100644 --- a/tests/utils/message_utils.cpp +++ b/tests/utils/message_utils.cpp @@ -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()); +} }