1 #ifndef MPI_MessageData_H
2 #define MPI_MessageData_H
5 #include "MPI_Object.h"
23 tMPIInteger mIsAvaliable;
24 tMPIInteger mIsFinished;
76 inline static CORE_UniquePointer<MPI_MessageData>
New() {
77 CORE_UniquePointer<MPI_MessageData> p(
new MPI_MessagData(),
96 const tMPICoreId& sourceCore,
98 MPI_Iprobe(sourceCore,tag,env.
getWorld(),&mIsAvaliable,&mStatus);
105 const tMPITag& tag) {
106 MPI_Iprobe(MPI_ANY_SOURCE,tag,env.
getWorld(),&mIsAvaliable,&mStatus);
113 MPI_Iprobe(MPI_ANY_SOURCE,MPI_ANY_TAG,env.
getWorld(),&mIsAvaliable,&mStatus);
118 inline tMPIRequest&
request() {
return mRequest; }
124 return (mIsAvaliable==1);
130 return (mIsAvaliable==1)?mStatus.MPI_SOURCE:-1;
135 return (mIsAvaliable==1)?mStatus.MPI_TAG:-1;
144 return (MPI_Get_count(&mStatus,MPI_Type::GetPrimaryType<T>(),&nElements)==MPI_SUCCESS);
150 MPI_Test(&mRequest,&mIsFinished,&mStatus);
151 return (mIsFinished==1);
168 return (MPI_Wait(&mRequest,&mStatus)==MPI_SUCCESS);
173 inline static void WaitAll(std::valarray<MPI_MessageData>& messages) {
174 tBoolean allAreFinished=
true;
178 for (
auto& message:messages) {
180 allAreFinished=allAreFinished && (
isFinished==1);
182 }
while (!allAreFinished);
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 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 describes a message status & request.
Definition: MPI_MessageData.h:17
virtual ~MPI_MessageData(void)
destroy
Definition: MPI_MessageData.h:39
tBoolean isFinished()
return true if the message has been received
Definition: MPI_MessageData.h:149
tMPICoreId getTag() const
get the tag of the message
Definition: MPI_MessageData.h:134
MPI_MessageData()
create a root environment
Definition: MPI_MessageData.h:31
const tBoolean & isUsed()
return true if the message is obsolete
Definition: MPI_MessageData.h:155
void update(const MPI_Environment &env, const tMPITag &tag)
update the data of the message
Definition: MPI_MessageData.h:104
tBoolean wait()
wait for the message is received
Definition: MPI_MessageData.h:167
void setIsUsed(const tBoolean &b)
turn the message into obsolete state
Definition: MPI_MessageData.h:161
tBoolean isAvaliable() const
return if the mesage is valiable
Definition: MPI_MessageData.h:122
static CORE_UniquePointer< MPI_MessageData > New()
create an unique instance of the class This
Definition: MPI_MessageData.h:76
void update(const MPI_Environment &env)
update the data of the message
Definition: MPI_MessageData.h:111
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: MPI_MessageData.h:56
tMPICoreId getSourceCore() const
get the source core of the mesasage
Definition: MPI_MessageData.h:129
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: MPI_MessageData.h:68
tMPIRequest & request()
return the request of the message
Definition: MPI_MessageData.h:118
static void WaitAll(std::valarray< MPI_MessageData > &messages)
wait for all the messages are received
Definition: MPI_MessageData.h:173
void update(const MPI_Environment &env, const tMPICoreId &sourceCore, const tMPITag &tag)
update the data of the message
Definition: MPI_MessageData.h:95
tBoolean getCount(tMPICount &nElements)
get the number of elements of the message
Definition: MPI_MessageData.h:143
void clear()
clear the data of the message
Definition: MPI_MessageData.h:84
This class is a base class of E-MicromM core package.
Definition: MPI_Object.h:32
This class is a Test class for EMicroM package which uses the module tests.
Definition: MPI_Test.h:15