OpenM++ runtime library (libopenm)
msgMpiSend.h
Go to the documentation of this file.
1
5// Copyright (c) 2013-2015 OpenM++
6// This code is licensed under the MIT license (see LICENSE.txt for details)
7
8#ifndef MSG_MPI_SEND_H
9#define MSG_MPI_SEND_H
10
11using namespace std;
12
13#include "msgCommon.h"
14#include "msgMpiPacked.h"
15
16namespace openm
17{
20 {
21 public:
23 MpiSendBase(int i_selfRank, int i_sendTo, MsgTag i_msgTag);
24
26 virtual ~MpiSendBase(void) noexcept;
27
29 bool isCompleted(void);
30
31 protected:
32 int msgTag; // MPI message tag
33 int selfRank; // source (ourself) MPI process rank
34 int sendToRank; // destination MPI process rank
35 MPI_Request mpiRq; // send request
36
37 protected:
38 // cleanup MPI send resources
39 void cleanup(void) noexcept;
40
41 private:
42 MpiSendBase(const MpiSendBase & i_send) = delete;
43 MpiSendBase & operator=(const MpiSendBase & i_send) = delete;
44 };
45
47 class MpiSendArray : public IMsgSendArray, public MpiSendBase
48 {
49 public:
52 int i_selfRank, int i_sendTo, MsgTag i_msgTag, const type_info & i_type, size_t i_size, void * i_valueArr
53 );
54
56 ~MpiSendArray(void) noexcept { }
57
59 bool isCompleted(void) { return MpiSendBase::isCompleted(); }
60
61 private:
62 unique_ptr<uint8_t[]> sendValueArr; // copy of data to send
63
64 private:
65 MpiSendArray(const MpiSendArray & i_send) = delete;
66 MpiSendArray & operator=(const MpiSendArray & i_send) = delete;
67 };
68
71 {
72 public:
75 int i_selfRank, int i_sendTo, const IRowBaseVec & i_rowVec, const IPackedAdapter & i_adapter
76 );
77
79 ~MpiSendPacked(void) noexcept { }
80
82 bool isCompleted(void) { return MpiSendBase::isCompleted(); }
83
84 private:
85 vector<uint8_t> packedData; // data to send
86
87 private:
88 MpiSendPacked(const MpiSendPacked & i_send) = delete;
89 MpiSendPacked & operator=(const MpiSendPacked & i_send) = delete;
90 };
91}
92
93#endif // MSG_MPI_SEND_H
public interface to send value array
Definition: msgCommon.h:37
public interface to send packed data.
Definition: msgCommon.h:59
non-blocking MPI send of value array
Definition: msgMpiSend.h:48
bool isCompleted(void)
check is send completed by MPI_Test.
Definition: msgMpiSend.h:59
MpiSendArray(int i_selfRank, int i_sendTo, MsgTag i_msgTag, const type_info &i_type, size_t i_size, void *i_valueArr)
create non-blocking MPI sender for value array and call MPI_Isend.
Definition: msgMpiSend.cpp:76
~MpiSendArray(void) noexcept
cleanup message sender resources.
Definition: msgMpiSend.h:56
base class for non-blocking MPI send
Definition: msgMpiSend.h:20
bool isCompleted(void)
check is send completed by MPI_Test.
Definition: msgMpiSend.cpp:39
MpiSendBase(int i_selfRank, int i_sendTo, MsgTag i_msgTag)
create non-blocking MPI sender.
Definition: msgMpiSend.cpp:22
virtual ~MpiSendBase(void) noexcept
cleanup message sender resources by MPI_Request_free.
Definition: msgMpiSend.cpp:30
non-blocking MPI send of packed data
Definition: msgMpiSend.h:71
bool isCompleted(void)
check is send completed by MPI_Test.
Definition: msgMpiSend.h:82
~MpiSendPacked(void) noexcept
cleanup message sender resources.
Definition: msgMpiSend.h:79
MpiSendPacked(int i_selfRank, int i_sendTo, const IRowBaseVec &i_rowVec, const IPackedAdapter &i_adapter)
create non-blocking MPI sender pack the data and call MPI_Isend.
Definition: msgMpiSend.cpp:103
OpenM++: message passing library common classes and interfaces.
OpenM++ message passing library: pack and unpack wrapper class for MPI-based implementation.
openM++ namespace
Definition: log.h:32
MsgTag
tag to identify message content
Definition: msg.h:29
std::vector< IRowBaseUptr > IRowBaseVec
db rows: vector of unique pointers to db row
Definition: omHelper.h:239
public interface to pack and unpack rows of metadata db-table
Definition: msg.h:99