CommunicationManager Class Reference

HiCR: HiCR::backend::mpi::CommunicationManager Class Reference
HiCR
HiCR::backend::mpi::CommunicationManager Class Reference

#include <communicationManager.hpp>

Inheritance diagram for HiCR::backend::mpi::CommunicationManager:
HiCR::CommunicationManager

Public Member Functions

 CommunicationManager (MPI_Comm comm=MPI_COMM_WORLD)
 
 ~CommunicationManager () override=default
 
const MPI_Comm getComm () const
 
const int getSize () const
 
const int getRank () const
 
- Public Member Functions inherited from HiCR::CommunicationManager
virtual void lock ()
 
virtual void unlock ()
 
__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 ()
 

Protected Member Functions

virtual __INLINE__ void fenceImpl (HiCR::GlobalMemorySlot::tag_t tag) override
 
virtual __INLINE__ void exchangeGlobalMemorySlotsImpl (HiCR::GlobalMemorySlot::tag_t tag, const std::vector< globalKeyMemorySlotPair_t > &memorySlots) override
 
- 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
 

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 >
 

Detailed Description

Implementation of the HiCR MPI backend

This backend is very useful for testing other HiCR modules in isolation (unit tests) without involving the use of threading, which might incur side-effects

Constructor & Destructor Documentation

◆ CommunicationManager()

HiCR::backend::mpi::CommunicationManager::CommunicationManager ( MPI_Comm  comm = MPI_COMM_WORLD)
inline

Constructor for the mpi backend.

Parameters
[in]commThe MPI subcommunicator to use in the communication operations in this backend. If not specified, it will use MPI_COMM_WORLD

◆ ~CommunicationManager()

HiCR::backend::mpi::CommunicationManager::~CommunicationManager ( )
overridevirtualdefault

Default destructor

Reimplemented from HiCR::CommunicationManager.

Member Function Documentation

◆ exchangeGlobalMemorySlotsImpl()

virtual __INLINE__ void HiCR::backend::mpi::CommunicationManager::exchangeGlobalMemorySlotsImpl ( HiCR::GlobalMemorySlot::tag_t  tag,
const std::vector< globalKeyMemorySlotPair_t > &  memorySlots 
)
inlineoverrideprotectedvirtual

Exchanges memory slots among different local instances of HiCR to enable global (remote) communication

Parameters
[in]tagIdentifies a particular subset of global memory slots
[in]memorySlotsArray of local memory slots to make globally accessible

Implements HiCR::CommunicationManager.

◆ fenceImpl()

virtual __INLINE__ void HiCR::backend::mpi::CommunicationManager::fenceImpl ( HiCR::GlobalMemorySlot::tag_t  tag)
inlineoverrideprotectedvirtual

Implementation of the fence operation for the mpi backend. A barrier is sufficient, as MPI_Win_lock/MPI_Win_unlock passive synchronization is used to transfer data

It is assumed that the base class has already locked the mutex before calling this function.

Parameters
[in]tagA tag that releases all processes that share the same value once they have arrived at it

Implements HiCR::CommunicationManager.

◆ getComm()

const MPI_Comm HiCR::backend::mpi::CommunicationManager::getComm ( ) const
inline

MPI Communicator getter

Returns
The internal MPI communicator used during the instantiation of this class

◆ getRank()

const int HiCR::backend::mpi::CommunicationManager::getRank ( ) const
inline

MPI Communicator rank getter

Returns
The rank within the internal MPI communicator used during the instantiation of this class that corresponds to this instance

◆ getSize()

const int HiCR::backend::mpi::CommunicationManager::getSize ( ) const
inline

MPI Communicator size getter

Returns
The size of the internal MPI communicator used during the instantiation of this class

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