CommunicationManager Class Reference

HiCR: HiCR::backend::pthreads::CommunicationManager Class Reference
HiCR
HiCR::backend::pthreads::CommunicationManager Class Referencefinal

#include <communicationManager.hpp>

Inheritance diagram for HiCR::backend::pthreads::CommunicationManager:
HiCR::CommunicationManager

Public Member Functions

 CommunicationManager (const size_t fenceCount=1)
 
 ~CommunicationManager () override
 
__INLINE__ std::shared_ptr< HiCR::GlobalMemorySlotgetGlobalMemorySlotImpl (const HiCR::backend::hwloc::GlobalMemorySlot::tag_t tag, const HiCR::backend::hwloc::GlobalMemorySlot::globalKey_t globalKey) override
 
__INLINE__ std::shared_ptr< HiCR::GlobalMemorySlotpromoteLocalMemorySlot (const std::shared_ptr< HiCR::LocalMemorySlot > &memorySlot, HiCR::GlobalMemorySlot::tag_t tag) override
 
__INLINE__ void destroyPromotedGlobalMemorySlot (const std::shared_ptr< HiCR::GlobalMemorySlot > &memorySlot) override
 
- Public Member Functions inherited from HiCR::CommunicationManager
__INLINE__ void exchangeGlobalMemorySlots (GlobalMemorySlot::tag_t tag, const std::vector< globalKeyMemorySlotPair_t > &memorySlots)
 
__INLINE__ std::shared_ptr< GlobalMemorySlotgetGlobalMemorySlot (GlobalMemorySlot::tag_t tag, GlobalMemorySlot::globalKey_t globalKey)
 
virtual uint8_t * serializeGlobalMemorySlot (const std::shared_ptr< HiCR::GlobalMemorySlot > &globalSlot) const
 
virtual std::shared_ptr< GlobalMemorySlotdeserializeGlobalMemorySlot (uint8_t *buffer, GlobalMemorySlot::tag_t tag)
 
virtual std::shared_ptr< GlobalMemorySlotpromoteLocalMemorySlot (const std::shared_ptr< LocalMemorySlot > &localMemorySlot, GlobalMemorySlot::tag_t tag)
 
__INLINE__ void deregisterGlobalMemorySlot (const std::shared_ptr< GlobalMemorySlot > &memorySlot)
 
__INLINE__ void destroyGlobalMemorySlot (const std::shared_ptr< GlobalMemorySlot > &memorySlot)
 
virtual void destroyPromotedGlobalMemorySlot (const std::shared_ptr< GlobalMemorySlot > &memorySlot)
 
__INLINE__ void queryMemorySlotUpdates (std::shared_ptr< LocalMemorySlot > memorySlot)
 
__INLINE__ void memcpy (const std::shared_ptr< LocalMemorySlot > &destination, size_t dst_offset, const std::shared_ptr< LocalMemorySlot > &source, size_t src_offset, size_t size)
 
__INLINE__ void memcpy (const std::shared_ptr< GlobalMemorySlot > &destination, size_t dst_offset, const std::shared_ptr< LocalMemorySlot > &source, size_t src_offset, size_t size)
 
__INLINE__ void memcpy (const std::shared_ptr< LocalMemorySlot > &destination, size_t dst_offset, const std::shared_ptr< GlobalMemorySlot > &source, size_t src_offset, size_t size)
 
__INLINE__ void fence (GlobalMemorySlot::tag_t tag)
 
__INLINE__ void fence (const std::shared_ptr< LocalMemorySlot > &slot, size_t expectedSent, size_t expectedRecvd)
 
__INLINE__ void fence (const std::shared_ptr< GlobalMemorySlot > &slot, size_t expectedSent, size_t expectedRecvd)
 
__INLINE__ bool acquireGlobalLock (const std::shared_ptr< GlobalMemorySlot > &memorySlot)
 
__INLINE__ void releaseGlobalLock (const std::shared_ptr< GlobalMemorySlot > &memorySlot)
 
virtual __INLINE__ void flushSent ()
 
virtual __INLINE__ void flushReceived ()
 

Additional Inherited Members

- Public Types inherited from HiCR::CommunicationManager
using globalKeyMemorySlotPair_t = std::pair< GlobalMemorySlot::globalKey_t, std::shared_ptr< LocalMemorySlot > >
 
using globalKeyToMemorySlotMap_t = std::map< GlobalMemorySlot::globalKey_t, std::shared_ptr< GlobalMemorySlot > >
 
using globalMemorySlotTagKeyMap_t = std::map< GlobalMemorySlot::tag_t, globalKeyToMemorySlotMap_t >
 
- Protected Member Functions inherited from HiCR::CommunicationManager
__INLINE__ void registerGlobalMemorySlot (const std::shared_ptr< GlobalMemorySlot > &memorySlot)
 
virtual void queryMemorySlotUpdatesImpl (std::shared_ptr< LocalMemorySlot > memorySlot)=0
 
virtual void deregisterGlobalMemorySlotImpl (const std::shared_ptr< GlobalMemorySlot > &memorySlot)
 
virtual void destroyGlobalMemorySlotImpl (std::shared_ptr< GlobalMemorySlot > memorySlot)=0
 
virtual void memcpyImpl (const std::shared_ptr< LocalMemorySlot > &destination, size_t dst_offset, const std::shared_ptr< LocalMemorySlot > &source, size_t src_offset, size_t size)
 
virtual void memcpyImpl (const std::shared_ptr< GlobalMemorySlot > &destination, size_t dst_offset, const std::shared_ptr< LocalMemorySlot > &source, size_t src_offset, size_t size)
 
virtual void memcpyImpl (const std::shared_ptr< LocalMemorySlot > &destination, size_t dst_offset, const std::shared_ptr< GlobalMemorySlot > &source, size_t src_offset, size_t size)
 
virtual void fenceImpl (const std::shared_ptr< LocalMemorySlot > &slot, size_t expectedSent, size_t expectedRcvd)
 
virtual void fenceImpl (const std::shared_ptr< GlobalMemorySlot > &slot, size_t expectedSent, size_t expectedRcvd)
 
virtual bool acquireGlobalLockImpl (std::shared_ptr< GlobalMemorySlot > memorySlot)=0
 
virtual void releaseGlobalLockImpl (std::shared_ptr< GlobalMemorySlot > memorySlot)=0
 
__INLINE__ auto & getGlobalMemorySlotsToDestroyPerTag ()
 
__INLINE__ auto & getGlobalMemorySlotTagKeyMap ()
 
__INLINE__ void increaseMessageRecvCounter (HiCR::LocalMemorySlot &memorySlot) noexcept
 
__INLINE__ void increaseMessageSentCounter (HiCR::LocalMemorySlot &memorySlot) noexcept
 
__INLINE__ void setMessagesRecv (HiCR::LocalMemorySlot &memorySlot, const size_t count) noexcept
 
__INLINE__ void setMessagesSent (HiCR::LocalMemorySlot &memorySlot, const size_t count) noexcept
 

Detailed Description

Implementation of the Pthreads communication manager

This backend uses pthread-based mutexes and barriers to prevent concurrent access violations

Constructor & Destructor Documentation

◆ CommunicationManager()

HiCR::backend::pthreads::CommunicationManager::CommunicationManager ( const size_t  fenceCount = 1)
inline

Constructor for the memory manager class for the Pthreads backend

Parameters
[in]fenceCountSpecifies how many times a fence has to be called for it to release callers

◆ ~CommunicationManager()

HiCR::backend::pthreads::CommunicationManager::~CommunicationManager ( )
inlineoverridevirtual

The destructor deletes all created barrier/mutex locks

Reimplemented from HiCR::CommunicationManager.

Member Function Documentation

◆ destroyPromotedGlobalMemorySlot()

__INLINE__ void HiCR::backend::pthreads::CommunicationManager::destroyPromotedGlobalMemorySlot ( const std::shared_ptr< HiCR::GlobalMemorySlot > &  memorySlot)
inlineoverride

Dummy override for the deregisterGlobalMemorySlot function, for PoC development

Parameters
[in]memorySlotMemory slot to deregister.

◆ getGlobalMemorySlotImpl()

__INLINE__ std::shared_ptr< HiCR::GlobalMemorySlot > HiCR::backend::pthreads::CommunicationManager::getGlobalMemorySlotImpl ( const HiCR::backend::hwloc::GlobalMemorySlot::tag_t  tag,
const HiCR::backend::hwloc::GlobalMemorySlot::globalKey_t  globalKey 
)
inlineoverridevirtual

Backend-internal implementation of the getGlobalMemorySlot function

Retrieves the map of globally registered slots

Parameters
[in]tagTag that identifies a subset of all global memory slots
[in]globalKeyThe sorting key inside the tag subset that distinguished between registered slots
Returns
The map of registered global memory slots, filtered by tag and mapped by key

Implements HiCR::CommunicationManager.

◆ promoteLocalMemorySlot()

__INLINE__ std::shared_ptr< HiCR::GlobalMemorySlot > HiCR::backend::pthreads::CommunicationManager::promoteLocalMemorySlot ( const std::shared_ptr< HiCR::LocalMemorySlot > &  memorySlot,
HiCR::GlobalMemorySlot::tag_t  tag 
)
inlineoverride

Promotes a local memory slot to a global memory slot. Not really needed for this backend, provided for PoC development

Parameters
[in]memorySlotLocal memory slot to promote
[in]tagTag to associate with the promoted global memory slot
Returns
The promoted global memory slot

The documentation for this class was generated from the following file: