OpenM++ runtime library (libopenm)
msgMpiRecv.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_RECV_H
9#define MSG_MPI_RECV_H
10
11using namespace std;
12
13#include "msgCommon.h"
14
15namespace openm
16{
19 {
20 public:
32 int i_selfRank, int i_recvFrom, MsgTag i_msgTag, const type_info & i_type, size_t i_size, void * io_valueArr
33 ) :
34 msgTag((int)i_msgTag),
35 isReceived(false),
36 selfRank(i_selfRank),
37 recvFromRank(i_recvFrom),
38 resultSize(i_size),
39 resultValueArr(io_valueArr),
40 mpiType(MpiPacked::toMpiType(i_type))
41 { }
42
43 ~MpiRecvArray(void) noexcept { }
44
46 bool tryReceive(void);
47
48 private:
49 int msgTag; // MPI message tag
50 bool isReceived; // if true the data received and unpacked
51 int selfRank; // destination (ourself) MPI process rank
52 int recvFromRank; // source MPI process rank
53 size_t resultSize; // expected size of array
54 void * resultValueArr; // received data
55 MPI_Datatype mpiType; // MPI type to receive
56
57 private:
58 MpiRecvArray(const MpiRecvArray & i_recv) = delete;
59 MpiRecvArray & operator=(const MpiRecvArray & i_recv) = delete;
60 };
61
64 {
65 public:
75 int i_selfRank, int i_recvFrom, IRowBaseVec & io_resultRowVec, const IPackedAdapter & i_adapter
76 ) :
77 isReceived(false),
78 selfRank(i_selfRank),
79 recvFromRank(i_recvFrom),
80 resultRowVec(io_resultRowVec),
81 packAdp(i_adapter)
82 { }
83
84 ~MpiRecvPacked(void) noexcept { }
85
87 bool tryReceive(void);
88
89 private:
90 bool isReceived; // if true the data received and unpacked
91 int selfRank; // destination (ourself) MPI process rank
92 int recvFromRank; // source MPI process rank
93 IRowBaseVec & resultRowVec; // received data
94 const IPackedAdapter & packAdp; // adapter to unpack received data
95
96 private:
97 MpiRecvPacked(const MpiRecvPacked & i_recv) = delete;
98 MpiRecvPacked & operator=(const MpiRecvPacked & i_recv) = delete;
99 };
100}
101
102#endif // MSG_MPI_RECV_H
public interface to receive value array
Definition: msgCommon.h:90
public interface to receive packed data
Definition: msgCommon.h:112
wrapper class around of MPI_Pack and MPI_Unpack
Definition: msgMpiPacked.h:19
non-blocking receive of value array
Definition: msgMpiRecv.h:19
MpiRecvArray(int i_selfRank, int i_recvFrom, MsgTag i_msgTag, const type_info &i_type, size_t i_size, void *io_valueArr)
create receiver for value array.
Definition: msgMpiRecv.h:31
bool tryReceive(void)
try to non-blocking receive value array, return true if completed.
Definition: msgMpiRecv.cpp:16
non-blocking receive of packed data
Definition: msgMpiRecv.h:64
MpiRecvPacked(int i_selfRank, int i_recvFrom, IRowBaseVec &io_resultRowVec, const IPackedAdapter &i_adapter)
create receiver for packed data.
Definition: msgMpiRecv.h:74
bool tryReceive(void)
try to receive and unpack the data, return return true if completed.
Definition: msgMpiRecv.cpp:46
OpenM++: message passing library common classes and interfaces.
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