Skip to content

Commit

Permalink
updating original message to avoid bug in faasm + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed Jun 6, 2021
1 parent a892359 commit 8321bfc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/faabric/scheduler/MpiContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MpiContext
public:
MpiContext();

void createWorld(const faabric::Message& msg);
void createWorld(faabric::Message& msg);

void joinWorld(const faabric::Message& msg);

Expand Down
5 changes: 4 additions & 1 deletion src/scheduler/MpiContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MpiContext::MpiContext()
, worldId(-1)
{}

void MpiContext::createWorld(const faabric::Message& msg)
void MpiContext::createWorld(faabric::Message& msg)
{
const std::shared_ptr<spdlog::logger>& logger = faabric::util::getLogger();

Expand All @@ -25,6 +25,9 @@ void MpiContext::createWorld(const faabric::Message& msg)
worldId = (int)faabric::util::generateGid();
logger->debug("Initialising world {}", worldId);

// Update the original message to contain the world ID
msg.set_mpiworldid(worldId);

// Create the MPI world
scheduler::MpiWorldRegistry& reg = scheduler::getMpiWorldRegistry();
reg.createWorld(msg, worldId);
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler/MpiWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void MpiWorld::create(const faabric::Message& call, int newId, int newSize)

// Broadcast the resulting rankHostMap to the other hosts
std::set<std::string> hosts(executedAt.begin(), executedAt.end());
// Erase ourselves if we are in the set (could be that we are not)
// Erase ourselves if we are in the set
hosts.erase(thisHost);
// This will block until all other hosts have processed the message
faabric::MpiHostRankMsg hostRankMsg;
Expand Down
2 changes: 0 additions & 2 deletions src/transport/MpiMessageEndpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ faabric::MpiHostRankMsg recvMpiHostRankMsg()
{
faabric::transport::RecvMessageEndpoint endpoint(MPI_PORT);
endpoint.open(faabric::transport::getGlobalMessageContext());
// TODO - preempt data size somehow
faabric::transport::Message m = endpoint.recv();
PARSE_MSG(faabric::MpiHostRankMsg, m.data(), m.size());
// Note - This may be very slow as we poll until unbound
endpoint.close();

return msg;
Expand Down

0 comments on commit 8321bfc

Please sign in to comment.