1 #ifndef MPI_CoreToCoreBMessage_H
2 #define MPI_CoreToCoreBMessage_H
5 #include "MPI_Object.h"
8 #include "MPI_Environment.h"
39 static MPI_Status mStatus;
42 size_t mBufferMPISize;
54 MPI_Type::GetSize<T>(mMPITSize);
57 mOverHead=(int) (1+(MPI_BSEND_OVERHEAD*1.)/mMPITSize);
83 inline static CORE_UniquePointer<MPI_CoreToCoreBMessage<T>>
New() {
100 const T& data,
const tMPITag& flag)
const {
101 MPI_Bsend(&data,1,MPI_Type::GetPrimaryType<T>(),dstCore,flag,env.
getWorld());
109 inline void allocateBuffer(
const tInteger& nElements,
const tInteger& nMessages) {
113 mBufferMPISize=nMessages*(nElements+mOverHead);
114 mBuffer=(T*) malloc(mBufferMPISize*
sizeof(T));
115 mBufferMPISize*=mMPITSize;
118 MPI_Buffer_attach(mBuffer,mBufferMPISize);
123 MPI_Buffer_detach(&mBuffer,&mBufferMPISize);
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:278
This class is a class to send / receive buffered messages from one to core to one core.
Definition: MPI_CoreToCoreBMessage.h:35
static CORE_UniquePointer< MPI_CoreToCoreBMessage< T > > New()
create an unique instance of the class This
Definition: MPI_CoreToCoreBMessage.h:83
void send(const MPI_Environment &env, const tMPICoreId &dstCore, const T &data, const tMPITag &flag) const
buffred sent of a data with flag to dstCore
Definition: MPI_CoreToCoreBMessage.h:99
MPI_CoreToCoreBMessage(const tInteger &nElements, const tInteger &nMessage)
create a buffer message with nMessages which each message is compozed by maximum of nElements of T
Definition: MPI_CoreToCoreBMessage.h:50
void allocateBuffer(const tInteger &nElements, const tInteger &nMessages)
allocate the buffer
Definition: MPI_CoreToCoreBMessage.h:109
void desallocateBuffer()
desallocate the buffer
Definition: MPI_CoreToCoreBMessage.h:122
virtual ~MPI_CoreToCoreBMessage(void)
destroy
Definition: MPI_CoreToCoreBMessage.h:66
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: MPI_CoreToCoreBMessage.h:76
This class is a Environment class to define MPI world.
Definition: MPI_Environment.h:36
const tMPIComm & getWorld() const
get the world of the environment for reading
Definition: MPI_Environment.h:165
This class is a base class of E-MicromM core package.
Definition: MPI_Object.h:32