OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
MPI_IrecvW.hpp
1#ifndef MPI_IRECV_HPP
2#define MPI_IRECV_HPP
3
4
5#include <mpi.h>
6
13{
14public:
15
25 static inline void recv(size_t proc , size_t tag ,void * buf, size_t sz, MPI_Request & req)
26 {
27 if (sz < 2147483647)
28 {
29 MPI_SAFE_CALL(MPI_Irecv(buf,sz,MPI_BYTE, proc, tag , MPI_COMM_WORLD,&req));
30 }
31 else
32 {
33 MPI_SAFE_CALL(MPI_Irecv(buf,sz >> 8,MPI_DOUBLE, proc, tag , MPI_COMM_WORLD,&req));
34 }
35 }
36};
37
44template<typename T> class MPI_IrecvW
45{
46public:
47 static inline void recv(size_t proc , size_t tag ,openfpm::vector<T> & v, MPI_Request & req)
48 {
49 if (v.size() * sizeof(T) < 2147483647)
50 {
51 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size() * sizeof(T),MPI_BYTE, proc, tag , MPI_COMM_WORLD,&req));
52 }
53 else
54 {
55 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(),(v.size() * sizeof(T)) >> 8,MPI_DOUBLE, proc, tag , MPI_COMM_WORLD,&req));
56 }
57 }
58};
59
60
64template<> class MPI_IrecvW<int>
65{
66public:
67 static inline void recv(size_t proc , size_t tag ,openfpm::vector<int> & v, MPI_Request & req)
68 {
69 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_INT, proc, tag , MPI_COMM_WORLD,&req));
70 }
71};
72
76template<> class MPI_IrecvW<unsigned int>
77{
78public:
79 static inline void recv(size_t proc , size_t tag ,openfpm::vector<unsigned int> & v, MPI_Request & req)
80 {
81 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_UNSIGNED, proc, tag , MPI_COMM_WORLD,&req));
82 }
83};
84
88template<> class MPI_IrecvW<short>
89{
90public:
91 static inline void recv(size_t proc , size_t tag ,openfpm::vector<short> & v, MPI_Request & req)
92 {
93 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_SHORT, proc, tag , MPI_COMM_WORLD,&req));
94 }
95};
96
100template<> class MPI_IrecvW<unsigned short>
101{
102public:
103 static inline void recv(size_t proc , size_t tag ,openfpm::vector<unsigned short> & v, MPI_Request & req)
104 {
105 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_UNSIGNED_SHORT, proc, tag , MPI_COMM_WORLD,&req));
106 }
107};
108
112template<> class MPI_IrecvW<char>
113{
114public:
115 static inline void recv(size_t proc , size_t tag ,openfpm::vector<char> & v, MPI_Request & req)
116 {
117 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_CHAR, proc, tag , MPI_COMM_WORLD,&req));
118 }
119};
120
124template<> class MPI_IrecvW<unsigned char>
125{
126public:
127 static inline void recv(size_t proc , size_t tag ,openfpm::vector<unsigned char> & v, MPI_Request & req)
128 {
129 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_UNSIGNED_CHAR, proc, tag , MPI_COMM_WORLD,&req));
130 }
131};
132
136template<> class MPI_IrecvW<size_t>
137{
138public:
139 static inline void recv(size_t proc , size_t tag ,openfpm::vector<size_t> & v, MPI_Request & req)
140 {
141 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_UNSIGNED_LONG, proc, tag , MPI_COMM_WORLD,&req));
142 }
143};
144
148template<> class MPI_IrecvW<long int>
149{
150public:
151 static inline void recv(size_t proc , size_t tag ,openfpm::vector<long int> & v, MPI_Request & req)
152 {
153 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_LONG, proc, tag , MPI_COMM_WORLD,&req));
154 }
155};
156
160template<> class MPI_IrecvW<float>
161{
162public:
163 static inline void recv(size_t proc , size_t tag ,openfpm::vector<float> & v, MPI_Request & req)
164 {
165 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_FLOAT, proc, tag , MPI_COMM_WORLD,&req));
166 }
167};
168
172template<> class MPI_IrecvW<double>
173{
174public:
175 static inline void recv(size_t proc , size_t tag ,openfpm::vector<double> & v, MPI_Request & req)
176 {
177 MPI_SAFE_CALL(MPI_Irecv(v.getPointer(), v.size(),MPI_DOUBLE, proc, tag , MPI_COMM_WORLD,&req));
178 }
179};
180
181#endif
182
Set of wrapping classing for MPI_Irecv.
static void recv(size_t proc, size_t tag, void *buf, size_t sz, MPI_Request &req)
General recv for general buffer.
General recv for vector of.
Implementation of 1-D std::vector like structure.