Skip to content

Commit

Permalink
tests: mpi tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed Aug 7, 2023
1 parent a0427a7 commit a937060
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tests/test/mpi/test_mpi_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ TEST_CASE_METHOD(MpiBaseTestFixture, "Check joining world", "[mpi]")

auto chainedMsgs = faabric::util::getChainedFunctions(msgA);
REQUIRE(chainedMsgs.size() == worldSize - 1);
auto msgB = plannerCli.getMessageResult(msgA.appid(), *chainedMsgs.begin(), 500);
auto msgB =
plannerCli.getMessageResult(msgA.appid(), *chainedMsgs.begin(), 500);

// Create another context and make sure it's not initialised
MpiContext cB;
Expand Down
5 changes: 5 additions & 0 deletions tests/test/mpi/test_multiple_mpi_worlds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ TEST_CASE_METHOD(MpiBaseTestFixture, "Test creating two MPI worlds", "[mpi]")
int worldSizeA = 3;
auto reqA = faabric::util::batchExecFactory(userA, funcA, 1);
auto& msgA = *reqA->mutable_messages(0);
msgA.set_ismpi(true);
msgA.set_mpiworldid(worldIdA);
msgA.set_mpiworldsize(worldSizeA);
plannerCli.callFunctions(reqA);
Expand All @@ -73,6 +74,7 @@ TEST_CASE_METHOD(MpiBaseTestFixture, "Test creating two MPI worlds", "[mpi]")
int worldSizeB = 6;
auto reqB = faabric::util::batchExecFactory(userB, funcB, 1);
auto& msgB = *reqB->mutable_messages(0);
msgB.set_ismpi(true);
msgB.set_mpiworldid(worldIdB);
msgB.set_mpiworldsize(worldSizeB);
plannerCli.callFunctions(reqB);
Expand All @@ -90,6 +92,9 @@ TEST_CASE_METHOD(MpiBaseTestFixture, "Test creating two MPI worlds", "[mpi]")

// Check that chained function calls are made as expected
auto actual = sch.getRecordedMessagesAll();
// The first recorded message is sent as part of the test fixture, so we
// remove it
actual.erase(actual.begin());
int expectedMsgCount = worldSizeA + worldSizeB;
REQUIRE(actual.size() == expectedMsgCount);

Expand Down
6 changes: 2 additions & 4 deletions tests/utils/fixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,8 @@ class RemoteMpiTestFixture : public MpiBaseTestFixture
// Set up the other world and add it to the global set of hosts
faabric::HostResources otherResources;
otherResources.set_slots(ranksOtherWorld);
sch.addHostToGlobalSet(otherHost);

// Queue the resource response for this other host
faabric::scheduler::queueResourceResponse(otherHost, otherResources);
sch.addHostToGlobalSet(
otherHost, std::make_shared<faabric::HostResources>(otherResources));
}

protected:
Expand Down

0 comments on commit a937060

Please sign in to comment.