OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
MPI_IsendW.hpp
1 #ifndef MPI_ISEND_HPP
2 #define MPI_ISEND_HPP
3 
4 
5 #include <mpi.h>
6 
17 {
18 public:
19  static inline void send(size_t proc , size_t tag ,const void * buf, size_t sz, MPI_Request & req)
20  {
21  MPI_Isend(buf, sz,MPI_BYTE, proc, tag , MPI_COMM_WORLD,&req);
22  }
23 };
24 
31 template<typename T, typename Mem, typename gr> class MPI_IsendW
32 {
33 public:
34  static inline void send(size_t proc , size_t tag ,openfpm::vector<T,Mem,gr> & v, MPI_Request & req)
35  {
36  MPI_Isend(v.getPointer(), v.size() * sizeof(T),MPI_BYTE, proc, tag , MPI_COMM_WORLD,&req);
37  }
38 };
39 
40 
44 template<typename Mem, typename gr> class MPI_IsendW<int,Mem,gr>
45 {
46 public:
47  static inline void send(size_t proc , size_t tag ,openfpm::vector<int,Mem,gr> & v, MPI_Request & req)
48  {
49  MPI_Isend(v.getPointer(), v.size(),MPI_INT, proc, tag , MPI_COMM_WORLD,&req);
50  }
51 };
52 
56 template<typename Mem, typename gr> class MPI_IsendW<unsigned int,Mem,gr>
57 {
58 public:
59  static inline void send(size_t proc , size_t tag ,openfpm::vector<unsigned int,Mem,gr> & v, MPI_Request & req)
60  {
61  MPI_Isend(v.getPointer(), v.size(),MPI_UNSIGNED, proc, tag , MPI_COMM_WORLD,&req);
62  }
63 };
64 
68 template<typename Mem, typename gr> class MPI_IsendW<short,Mem,gr>
69 {
70 public:
71  static inline void send(size_t proc , size_t tag ,openfpm::vector<short,Mem,gr> & v, MPI_Request & req)
72  {
73  MPI_Isend(v.getPointer(), v.size(),MPI_SHORT, proc, tag , MPI_COMM_WORLD,&req);
74  }
75 };
76 
80 template<typename Mem, typename gr> class MPI_IsendW<unsigned short,Mem,gr>
81 {
82 public:
83  static inline void send(size_t proc , size_t tag ,openfpm::vector<unsigned short,Mem,gr> & v, MPI_Request & req)
84  {
85  MPI_Isend(v.getPointer(), v.size(),MPI_UNSIGNED_SHORT, proc, tag , MPI_COMM_WORLD,&req);
86  }
87 };
88 
92 template<typename Mem, typename gr> class MPI_IsendW<char,Mem,gr>
93 {
94 public:
95  static inline void send(size_t proc , size_t tag ,openfpm::vector<char,Mem,gr> & v, MPI_Request & req)
96  {
97  MPI_Isend(v.getPointer(), v.size(),MPI_CHAR, proc, tag , MPI_COMM_WORLD,&req);
98  }
99 };
100 
104 template<typename Mem, typename gr> class MPI_IsendW<unsigned char,Mem,gr>
105 {
106 public:
107  static inline void send(size_t proc , size_t tag ,openfpm::vector<unsigned char,Mem,gr> & v, MPI_Request & req)
108  {
109  MPI_Isend(v.getPointer(), v.size(),MPI_UNSIGNED_CHAR, proc, tag , MPI_COMM_WORLD,&req);
110  }
111 };
112 
116 template<typename Mem, typename gr> class MPI_IsendW<size_t,Mem,gr>
117 {
118 public:
119  static inline void send(size_t proc , size_t tag ,openfpm::vector<size_t,Mem,gr> & v, MPI_Request & req)
120  {
121  MPI_Isend(v.getPointer(), v.size(),MPI_UNSIGNED_LONG, proc, tag , MPI_COMM_WORLD,&req);
122  }
123 };
124 
128 template<typename Mem, typename gr> class MPI_IsendW<long int,Mem,gr>
129 {
130 public:
131  static inline void send(size_t proc , size_t tag ,openfpm::vector<long int,Mem,gr> & v, MPI_Request & req)
132  {
133  MPI_Isend(v.getPointer(), v.size(),MPI_LONG, proc, tag , MPI_COMM_WORLD,&req);
134  }
135 };
136 
140 template<typename Mem, typename gr> class MPI_IsendW<float,Mem,gr>
141 {
142 public:
143  static inline void send(size_t proc , size_t tag ,openfpm::vector<float,Mem,gr> & v, MPI_Request & req)
144  {
145  MPI_Isend(v.getPointer(), v.size(),MPI_FLOAT, proc, tag , MPI_COMM_WORLD,&req);
146  }
147 };
148 
152 template<typename Mem, typename gr> class MPI_IsendW<double,Mem,gr>
153 {
154 public:
155  static inline void send(size_t proc , size_t tag ,openfpm::vector<double,Mem,gr> & v, MPI_Request & req)
156  {
157  MPI_Isend(v.getPointer(), v.size(),MPI_DOUBLE, proc, tag , MPI_COMM_WORLD,&req);
158  }
159 };
160 
161 #endif
Set of wrapping classing for MPI_Isend.
Definition: MPI_IsendW.hpp:16
size_t size()
Stub size.
Definition: map_vector.hpp:70
Implementation of 1-D std::vector like structure.
Definition: map_vector.hpp:61
General send for a vector of any type.
Definition: MPI_IsendW.hpp:31