1 #ifndef MPI_CoreToCoreWMessage_H
2 #define MPI_CoreToCoreWMessage_H
5 #include "MPI_CoreToCoreMessage.h"
49 inline static CORE_UniquePointer<SelfClass>
New() {
88 const T& data,
const tMPITag& tag) {
89 MPI_Send(&data,1,MPI_Type::GetPrimaryType<T>(),dstCore,tag,env.
getWorld());
102 const T* data,
const tMPICount& nData,
const tMPITag& tag) {
103 MPI_Send(data,nData,MPI_Type::GetPrimaryType<T>(),dstCore,tag,env.
getWorld());
118 const std::valarray<T>& data,
const tMPITag& tag) {
119 MPI_Send(&data[0],data.size(),MPI_Type::GetPrimaryType<T>(),dstCore,tag,env.
getWorld());
131 const std::valarray<T>& data,
const tMPITag& tag)
override {
133 Send(env,dstCore,data,tag);
148 const T* data,
const tMPICount& nData,
const tMPIType& dataType,
const tMPITag& tag)
override {
149 Send(env,dstCore,data,nData,dataType,tag);
160 const T* data,
const tMPICount& nData,
const tMPIType& dataType,
const tMPITag& tag) {
161 MPI_Send(data,nData,dataType,dstCore,tag,env.
getWorld());
178 T& data,
const tMPITag& tag) {
179 MPI_Recv(&data,1,MPI_Type::GetPrimaryType<T>(),srcCore,tag,env.
getWorld(),MPI_STATUS_IGNORE);
196 T* buffer,
const tMPICount& nData,
const tMPITag& tag) {
197 MPI_Recv(buffer,nData,MPI_Type::GetPrimaryType<T>(),srcCore,tag,env.
getWorld(),MPI_STATUS_IGNORE);
213 std::valarray<T>& data,
const tMPITag& tag) {
214 MPI_Recv(&data[0],data.size(),MPI_Type::GetPrimaryType<T>(),srcCore,tag,env.
getWorld(),MPI_STATUS_IGNORE);
225 std::valarray<T>& data,
const tMPITag& tag,tMPIStatus& status) {
226 MPI_Recv(&data[0],data.size(),MPI_Type::GetPrimaryType<T>(),srcCore,tag,env.
getWorld(),&status);
238 std::valarray<T>& data,
const tMPITag& tag)
override {
239 Receive(env,srcCore,data,tag,mStatus);
251 std::valarray<T>& data,
const tMPIInteger& nData,
253 tMPIStatus& status) {
254 MPI_Probe(srcCore,tag,env.
getWorld(),&status);
255 MPI_Get_count(&status,MPI_Type::GetPrimaryType<T>(), &nData);
257 MPI_recv(&data[0],nData,MPI_Type::GetPrimaryType<T>(),srcCore,tag,env.
getWorld(),&status);
275 T* buffer,
const tMPICount& nData,
const tMPIType& dataType,
const tMPITag& tag,
276 tMPIStatus& status) {
277 MPI_Recv(buffer,nData,dataType,dstCore,tag,env.
getWorld(),&status);
288 T* buffer,
const tMPICount& nData,
const tMPIType& dataType,
const tMPITag& tag) {
289 MPI_Recv(buffer,nData,dataType,dstCore,tag,env.
getWorld(),MPI_STATUS_IGNORE);
301 T* buffer,
const tMPICount& nData,
const tMPIType& dataType,
const tMPITag& tag)
override {
302 Receive(env,dstCore,buffer,nData,dataType,tag,mStatus);
323 const T& sentData,
const tMPITag& sentTag,
324 T& receivedData,
const tMPITag& receivedTag,
325 tMPIStatus& status) {
326 MPI_Sendrecv(&sentData,1,MPI_Type::GetPrimaryType<T>(),
328 &receivedData,1,MPI_Type::GetPrimaryType<T>(),
343 const T& sentData,
const tMPITag& sentTag,
344 T& receivedData,
const tMPITag& receivedTag)
override {
345 SendNReceive(env,dstCore,srcCore,sentData,sentTag,receivedData,receivedTag,mStatus);
364 const T* sentData,
const int& nSentData,
const tMPITag& sentTag,
365 T* receivedData,
const int& nReceivedData,
const tMPITag& receivedTag) {
366 ASSERT_IN(sentData!=receivedData);
367 ASSERT_IN(nSentData==nReceivedData);
368 MPI_Sendrecv(sentData,nSentData,MPI_Type::GetPrimaryType<T>(),
370 receivedData,nReceivedData,MPI_Type::GetPrimaryType<T>(),
395 const std::valarray<T>& sentData,
const tMPITag& sentTag,
396 std::valarray<T>& receivedData,
const tMPITag& receivedTag,
397 tMPIStatus& status) {
399 ASSERT_IN(&sentData!=&receivedData);
400 if (receivedData.size()<sentData.size()) receivedData.resize( sentData.size());
402 MPI_Sendrecv(&sentData[0],sentData.size(),MPI_Type::GetPrimaryType<T>(),
404 &receivedData[0],receivedData.size(),MPI_Type::GetPrimaryType<T>(),
422 const std::valarray<T>& sentData,
const tMPITag& sentTag,
423 std::valarray<T>& receivedData,
const tMPITag& receivedTag)
override {
426 receivedData,receivedTag,mStatus);
448 const T* sentData,
const tMPICount& nSentData,
const tMPIType& sentDataType,
const tMPITag& sentTag,
449 T* receivedData,
const tMPICount& nReceivedData,
const tMPIType& receivedDataType,
const tMPITag& receivedTag,
450 MPI_Status& status) {
451 ASSERT_IN(&sentData!=&receivedData);
453 MPI_Sendrecv(&sentData[0],nSentData,sentDataType,
455 &receivedData[0],nReceivedData,receivedDataType,
474 const T* sentData,
const tMPICount& nSentData,
const tMPIType& sentDataType,
const tMPITag& sentTag,
475 T* receivedData,
const tMPICount& nReceivedData,
const tMPIType& receivedDataType,
const tMPITag& receivedTag) {
476 ASSERT_IN(&sentData!=&receivedData);
478 MPI_Sendrecv(&sentData[0],nSentData,sentDataType,
480 &receivedData[0],nReceivedData,receivedDataType,
499 const T* sentData,
const tMPICount& nSentData,
const tMPIType& sentDataType,
const tMPITag& sentTag,
500 T* receivedData,
const tMPICount& nReceivedData,
const tMPIType& receivedDataType,
const tMPITag& receivedTag) {
501 ASSERT_IN(&sentData!=&receivedData);
503 MPI_Sendrecv(&sentData[0],nSentData,sentDataType,
505 &receivedData[0],nReceivedData,receivedDataType,
525 const T* sentData,
const tMPICount& nSentData,
const tMPIType& sentDataType,
const tMPITag& sentTag,
526 T* receivedData,
const tMPICount& nReceivedData,
const tMPIType& receivedDataType,
const tMPITag& receivedTag)
override {
528 sentData,nSentData,sentDataType,sentTag,
529 receivedData,nReceivedData,receivedDataType,receivedTag,
554 T* data,
const int& nData,
const tMPITag& sentTag,
const tMPITag& receivedTag,
555 MPI_Status& status) {
556 MPI_Sendrecv_replace(data,nData,MPI_Type::GetPrimaryType<T>(),
572 T* data,
const int& nData,
const tMPITag& sentTag,
const tMPITag& receivedTag,
573 MPI_Status& status) {
574 MPI_Sendrecv_replace(data,nData,MPI_Type::GetPrimaryType<T>(),
591 T* data,
const int& nData,
const tMPITag& tag) {
592 MPI_Sendrecv_replace(data,nData,MPI_Type::GetPrimaryType<T>(),
611 std::valarray<T>& data,
const tMPITag& sendTag,
const tMPITag& receivedTag) {
612 MPI_Sendrecv_replace(&data[0],data.size(),MPI_Type::GetPrimaryType<T>(),
629 std::valarray<T>& data,
const tMPITag& tag,
630 tMPIStatus& status) {
631 MPI_Sendrecv_replace(&data[0],data.size(),MPI_Type::GetPrimaryType<T>(),
645 std::valarray<T>& data,
const tMPITag& tag) {
646 MPI_Sendrecv_replace(&data[0],data.size(),MPI_Type::GetPrimaryType<T>(),
660 std::valarray<T>& data,
const tMPITag& tag)
override {
661 Exchange(env,dstCore,data,tag,mStatus);
679 T* data,
const int& nData,
const tMPIType& dataType,
const tMPITag& tag) {
681 MPI_Sendrecv_replace(data,nData,dataType,
702 const tMPICoreId& srcCore,
705 tMPICount& nElements) {
706 MPI_Probe(srcCore,tag,env.
getWorld(),&status);
707 MPI_Get_count(&status,MPI_Type::GetPrimaryType<T>(),&nElements);
716 MPI_Get_count(&status,MPI_Type::GetPrimaryType<T>(),&nElements);
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class is a interface class to send / receive message with primitive type T from one to core to o...
Definition: MPI_CoreToCoreMessage.h:29
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: MPI_CoreToCoreMessage.h:70
This class is a class to send / receive blocking message from one to core to one core.
Definition: MPI_CoreToCoreWMessage.h:19
static void Send(const MPI_Environment &env, const tMPICoreId &dstCore, const T &data, const tMPITag &tag)
blocking send a data with tag to dstCore
Definition: MPI_CoreToCoreWMessage.h:87
virtual void exchange(const MPI_Environment &env, const tMPICoreId &dstCore, std::valarray< T > &data, const tMPITag &tag) override
receiving a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:659
static tBoolean Receive(const MPI_Environment &env, const tMPICoreId &srcCore, std::valarray< T > &data, const tMPITag &tag)
receive a data with tag from source core
Definition: MPI_CoreToCoreWMessage.h:212
virtual void SendNReceive(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, const T &sentData, const tMPITag &sentTag, T &receivedData, const tMPITag &receivedTag, tMPIStatus &status)
receiving a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:322
static void Send(const MPI_Environment &env, const tMPICoreId &dstCore, const std::valarray< T > &data, const tMPITag &tag)
blocking send a data with tag to dstCore
Definition: MPI_CoreToCoreWMessage.h:117
static void SendNReceive(const MPI_Environment &env, const tMPICoreId &dstCore, const T *sentData, const int &nSentData, const tMPITag &sentTag, T *receivedData, const int &nReceivedData, const tMPITag &receivedTag)
blocking swapping a data with tag to dst Core and receive a data from src core
Definition: MPI_CoreToCoreWMessage.h:363
static void Exchange(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, T *data, const int &nData, const tMPITag &sentTag, const tMPITag &receivedTag, MPI_Status &status)
blocking sending a data with tag to dst Core and receive a data from src core in the same location da...
Definition: MPI_CoreToCoreWMessage.h:553
virtual void sendNReceive(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, const std::valarray< T > &sentData, const tMPITag &sentTag, std::valarray< T > &receivedData, const tMPITag &receivedTag) override
receiving a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:421
virtual int wait() override
wait the end of the message return 0 : do not wait
Definition: MPI_CoreToCoreWMessage.h:729
static void Receive(const MPI_Environment &env, const tMPICoreId &dstCore, T *buffer, const tMPICount &nData, const tMPIType &dataType, const tMPITag &tag, tMPIStatus &status)
blocking send a data with tag to dstCore
Definition: MPI_CoreToCoreWMessage.h:274
static tBoolean Receive(const MPI_Environment &env, const tMPICoreId &srcCore, std::valarray< T > &data, const tMPIInteger &nData, const tMPITag &tag, tMPIStatus &status)
receive a data with tag from source core
Definition: MPI_CoreToCoreWMessage.h:250
static void SendNReceive(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, const std::valarray< T > &sentData, const tMPITag &sentTag, std::valarray< T > &receivedData, const tMPITag &receivedTag, tMPIStatus &status)
blocking swapping a data with tag to dst Core and receive a data from src core
Definition: MPI_CoreToCoreWMessage.h:394
virtual void send(const MPI_Environment &env, const tMPICoreId &dstCore, const T *data, const tMPICount &nData, const tMPIType &dataType, const tMPITag &tag) override
blocking send a data with tag to dstCore
Definition: MPI_CoreToCoreWMessage.h:147
virtual void receive(const MPI_Environment &env, const tMPICoreId &dstCore, T *buffer, const tMPICount &nData, const tMPIType &dataType, const tMPITag &tag) override
blocking send a data with tag to dstCore
Definition: MPI_CoreToCoreWMessage.h:300
static tBoolean Receive(const MPI_Environment &env, const tMPICoreId &srcCore, std::valarray< T > &data, const tMPITag &tag, tMPIStatus &status)
receive a data with tag from source core
Definition: MPI_CoreToCoreWMessage.h:224
static void Exchange(const MPI_Environment &env, const tMPICoreId &dstCore, std::valarray< T > &data, const tMPITag &tag, tMPIStatus &status)
blocking sending a data with tag to dst Core and receive a data from src core in the same location da...
Definition: MPI_CoreToCoreWMessage.h:628
static void Exchange(const MPI_Environment &env, const tMPICoreId &dstCore, std::valarray< T > &data, const tMPITag &tag)
blocking sending a data with tag to dst Core and receive a data from src core in the same location da...
Definition: MPI_CoreToCoreWMessage.h:644
static void Receive(const MPI_Environment &env, const tMPICoreId &srcCore, T *buffer, const tMPICount &nData, const tMPITag &tag)
blocking receive a data with tag from srcCore
Definition: MPI_CoreToCoreWMessage.h:195
virtual void getElementsNumber(tMPICount &nElements) override
get the number of element of the message
Definition: MPI_CoreToCoreWMessage.h:722
void GetElementsNumber(const tMPIStatus &status, tMPICount &nElements)
get the number of elements in the message with status
Definition: MPI_CoreToCoreWMessage.h:715
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: MPI_CoreToCoreWMessage.h:69
static void SendNReceive(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, const T *sentData, const tMPICount &nSentData, const tMPIType &sentDataType, const tMPITag &sentTag, T *receivedData, const tMPICount &nReceivedData, const tMPIType &receivedDataType, const tMPITag &receivedTag)
receiving a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:473
static tBoolean Receive(const MPI_Environment &env, const tMPICoreId &srcCore, T &data, const tMPITag &tag)
blocking receive a data with tag from source core
Definition: MPI_CoreToCoreWMessage.h:177
static void Exchange(const MPI_Environment &env, const tMPICoreId &dstCore, T *data, const int &nData, const tMPITag &sentTag, const tMPITag &receivedTag, MPI_Status &status)
blocking sending a data with tag to dst Core and receive a data from src core in the same location da...
Definition: MPI_CoreToCoreWMessage.h:571
MPI_CoreToCoreWMessage()
create
Definition: MPI_CoreToCoreWMessage.h:35
static void Receive(const MPI_Environment &env, const tMPICoreId &dstCore, T *buffer, const tMPICount &nData, const tMPIType &dataType, const tMPITag &tag)
blocking send a data with tag to dstCore
Definition: MPI_CoreToCoreWMessage.h:287
virtual void sendNReceive(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, const T *sentData, const tMPICount &nSentData, const tMPIType &sentDataType, const tMPITag &sentTag, T *receivedData, const tMPICount &nReceivedData, const tMPIType &receivedDataType, const tMPITag &receivedTag) override
receiving a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:524
static CORE_UniquePointer< SelfClass > New()
create an unique instance of the class This
Definition: MPI_CoreToCoreWMessage.h:49
virtual tBoolean isFinished() override
test if the communication is fnished
Definition: MPI_CoreToCoreWMessage.h:736
static void Send(const MPI_Environment &env, const tMPICoreId &dstCore, const T *data, const tMPICount &nData, const tMPIType &dataType, const tMPITag &tag)
blocking send a data with tag to dstCore
Definition: MPI_CoreToCoreWMessage.h:159
virtual void send(const MPI_Environment &env, const tMPICoreId &dstCore, const std::valarray< T > &data, const tMPITag &tag) override
sending a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:130
static void Exchange(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, std::valarray< T > &data, const tMPITag &sendTag, const tMPITag &receivedTag)
blocking sending a data with tag to dst Core and receive a data from src core in the same location da...
Definition: MPI_CoreToCoreWMessage.h:610
static void Exchange(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, T *data, const int &nData, const tMPITag &tag)
blocking sending a data with tag to dst Core and receive a data from src core in the same location da...
Definition: MPI_CoreToCoreWMessage.h:590
static void SendNReceive(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, const T *sentData, const tMPICount &nSentData, const tMPIType &sentDataType, const tMPITag &sentTag, T *receivedData, const tMPICount &nReceivedData, const tMPIType &receivedDataType, const tMPITag &receivedTag, MPI_Status &status)
receiving a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:447
static void SendNReceive(const MPI_Environment &env, const tMPICoreId &dstCore, const T *sentData, const tMPICount &nSentData, const tMPIType &sentDataType, const tMPITag &sentTag, T *receivedData, const tMPICount &nReceivedData, const tMPIType &receivedDataType, const tMPITag &receivedTag)
receiving a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:498
virtual ~MPI_CoreToCoreWMessage(void)
destroy
Definition: MPI_CoreToCoreWMessage.h:42
static void Exchange(const MPI_Environment &env, const tMPICoreId &dstCore, T *data, const int &nData, const tMPIType &dataType, const tMPITag &tag)
blocking sending a data with tag to dst Core and receive a data from dst core in the same location da...
Definition: MPI_CoreToCoreWMessage.h:678
static void GetElementsNumber(const MPI_Environment &env, const tMPICoreId &srcCore, const tMPITag &tag, tMPIStatus &status, tMPICount &nElements)
get the elements number of the sending message before receiving it
Definition: MPI_CoreToCoreWMessage.h:701
static void Send(const MPI_Environment &env, const tMPICoreId &dstCore, const T *data, const tMPICount &nData, const tMPITag &tag)
blocking send a data with tag to dstCore
Definition: MPI_CoreToCoreWMessage.h:101
virtual void receive(const MPI_Environment &env, const tMPICoreId &srcCore, std::valarray< T > &data, const tMPITag &tag) override
receiving a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:237
virtual void sendNReceive(const MPI_Environment &env, const tMPICoreId &dstCore, const tMPICoreId &srcCore, const T &sentData, const tMPITag &sentTag, T &receivedData, const tMPITag &receivedTag) override
receiving a data with flag to dstCore
Definition: MPI_CoreToCoreWMessage.h:342
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: MPI_CoreToCoreWMessage.h:58
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