124 std::map<int,SemaphoreMapEntry>
_map;
BooleanSemaphoreService(const BooleanSemaphoreService &)=delete
int _semaphoreTag
Tag used to exchange locking MPI messages.
tarch::multicore::BooleanSemaphore _mapAccessSemaphore
Semaphore for the global master's map of locks.
~BooleanSemaphoreService()=default
Destructor of the service.
std::string toString() const
void acquireLock(int number)
Acquire the lock.
virtual void receiveDanglingMessages() override
Receive any lock-related dangling messages.
bool tryLockSemaphoreOnGlobalMaster(int number, int forRank)
Try to lock a semaphore.
tarch::multicore::BooleanSemaphore _reserverationRequestsSemaphore
std::vector< std::pair< int, int > > _pendingLockRequests
List of pending lock requests.
void releaseLock(int number)
Release a lock.
BooleanSemaphoreService()=default
void lockSemaphoreOnGlobalMaster(int number, int forRank)
static BooleanSemaphoreService _singleton
void serveLockRequests()
Serve pending lock requests.
static BooleanSemaphoreService & getInstance()
Don't use this routine.
void addMapEntryLazily(int number)
Add map entry.
std::map< int, SemaphoreMapEntry > _map
Map of semaphores.
virtual void shutdown() override
int getNumberOfLockedSemaphores()
void unlockSemaphoreOnGlobalMaster(int number, int forRank)
Unlock semaphore on global master.
Boolean semaphore across MPI ranks.
static tarch::logging::Log _log
static int _semaphoreCounter
void leaveCriticalSection()
Tells the semaphore that it is about to leave.
tarch::multicore::BooleanSemaphore _localRankLockRequestSemaphore
const int _semaphoreNumber
void enterCriticalSection()
Waits until I can enter the critical section.
BooleanSemaphore(const BooleanSemaphore &)=delete
You may not copy a semaphore.
BooleanSemaphore & operator=(const BooleanSemaphore &)=delete
You may not copy a semaphore.
BooleanSemaphore()
Create new boolean semaphore spanning all MPI ranks.
Create a lock around a boolean semaphore region.
Represents a program instance within a cluster.
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
SemaphoreMapEntry()
Create new semaphore entry.
std::string toString() const
bool locked
Flag indicating if a semaphore is currently locked.
int rankThatLastLocked
Bookkeeping of who has locked a semaphore last.