Skip to content

Commit

Permalink
no need to acquire a lock to set a message id in mpi (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed Dec 27, 2021
1 parent d25c14b commit 37f8702
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/scheduler/MpiWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ static thread_local std::set<int> iSendRequests;

static thread_local std::map<int, std::pair<int, int>> reqIdToRanks;

static thread_local int localMsgCount = 1;

// These long-lived sockets are used by each world to communicate rank-to-host
// mappings. They are thread-local to ensure separation between concurrent
// worlds executing on the same host
Expand Down Expand Up @@ -624,7 +626,7 @@ void MpiWorld::send(int sendRank,
bool isLocal = otherHost == thisHost;

// Generate a message ID
int msgId = (int)faabric::util::generateGid();
int msgId = (localMsgCount + 1) % INT32_MAX;

// Create the message
auto m = std::make_shared<faabric::MPIMessage>();
Expand Down

0 comments on commit 37f8702

Please sign in to comment.