From 37f8702504f24bbb424f31b2eccc0679626a996e Mon Sep 17 00:00:00 2001 From: Carlos Date: Mon, 27 Dec 2021 15:43:43 +0100 Subject: [PATCH] no need to acquire a lock to set a message id in mpi (#203) --- src/scheduler/MpiWorld.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/scheduler/MpiWorld.cpp b/src/scheduler/MpiWorld.cpp index 57d019200..93ef2e3c9 100644 --- a/src/scheduler/MpiWorld.cpp +++ b/src/scheduler/MpiWorld.cpp @@ -22,6 +22,8 @@ static thread_local std::set iSendRequests; static thread_local std::map> 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 @@ -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();