OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
MPI_IallreduceW.hpp
1 #ifndef MPI_IALLREDUCEW_HPP
2 #define MPI_IALLREDUCEW_HPP
3 
4 #include <mpi.h>
5 
19 template<typename T> class MPI_IallreduceW
20 {
21 public:
22  static inline void reduce(T & buf,MPI_Op op, MPI_Request & req)
23  {
24  std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " cannot recognize " << typeid(T).name() << "\n";
25  }
26 };
27 
28 
32 template<> class MPI_IallreduceW<int>
33 {
34 public:
35  static inline void reduce(int & buf,MPI_Op op, MPI_Request & req)
36  {
37  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_INT, op, MPI_COMM_WORLD,&req));
38  }
39 };
40 
44 template<> class MPI_IallreduceW<unsigned int>
45 {
46 public:
47  static inline void reduce(unsigned int & buf,MPI_Op op, MPI_Request & req)
48  {
49  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_UNSIGNED, op, MPI_COMM_WORLD,&req));
50  }
51 };
52 
56 template<> class MPI_IallreduceW<short>
57 {
58 public:
59  static inline void reduce(short & buf,MPI_Op op, MPI_Request & req)
60  {
61  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_SHORT, op, MPI_COMM_WORLD,&req));
62  }
63 };
64 
68 template<> class MPI_IallreduceW<unsigned short>
69 {
70 public:
71  static inline void reduce(unsigned short & buf,MPI_Op op, MPI_Request & req)
72  {
73  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_UNSIGNED_SHORT, op, MPI_COMM_WORLD,&req));
74  }
75 };
76 
80 template<> class MPI_IallreduceW<char>
81 {
82 public:
83  static inline void reduce(char & buf,MPI_Op op, MPI_Request & req)
84  {
85  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_CHAR, op, MPI_COMM_WORLD,&req));
86  }
87 };
88 
92 template<> class MPI_IallreduceW<unsigned char>
93 {
94 public:
95  static inline void reduce(unsigned char & buf,MPI_Op op, MPI_Request & req)
96  {
97  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_UNSIGNED_CHAR, op, MPI_COMM_WORLD,&req));
98  }
99 };
100 
104 template<> class MPI_IallreduceW<size_t>
105 {
106 public:
107  static inline void reduce(size_t & buf,MPI_Op op, MPI_Request & req)
108  {
109  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_UNSIGNED_LONG, op, MPI_COMM_WORLD,&req));
110  }
111 };
112 
116 template<> class MPI_IallreduceW<long int>
117 {
118 public:
119  static inline void reduce(long int & buf,MPI_Op op, MPI_Request & req)
120  {
121  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_LONG, op, MPI_COMM_WORLD,&req));
122  }
123 };
124 
128 template<> class MPI_IallreduceW<float>
129 {
130 public:
131  static inline void reduce(float & buf,MPI_Op op, MPI_Request & req)
132  {
133  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_FLOAT, op, MPI_COMM_WORLD,&req));
134  }
135 };
136 
140 template<> class MPI_IallreduceW<double>
141 {
142 public:
143  static inline void reduce(double & buf,MPI_Op op, MPI_Request & req)
144  {
145  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_DOUBLE, op, MPI_COMM_WORLD,&req));
146  }
147 };
148 
150 
154 /*template<> class MPI_IallreduceW<openfpm::vector<int>>
155 {
156 public:
157  static inline void reduce(openfpm::vector<int> & buf,MPI_Op op, MPI_Request & req)
158  {
159  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_INT, op, MPI_COMM_WORLD,&req);
160  }
161 };*/
162 
166 /*template<> class MPI_IallreduceW<openfpm::vector<short>>
167 {
168 public:
169  static inline void reduce(openfpm::vector<short> & buf,MPI_Op op, MPI_Request & req)
170  {
171  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_SHORT, op, MPI_COMM_WORLD,&req);
172  }
173 };*/
174 
178 /*template<> class MPI_IallreduceW<openfpm::vector<char>>
179 {
180 public:
181  static inline void reduce(openfpm::vector<char> & buf,MPI_Op op, MPI_Request & req)
182  {
183  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_CHAR, op, MPI_COMM_WORLD,&req);
184  }
185 };*/
186 
190 /*template<> class MPI_IallreduceW<openfpm::vector<size_t>>
191 {
192 public:
193  static inline void reduce(openfpm::vector<size_t> & buf,MPI_Op op, MPI_Request & req)
194  {
195  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_UNSIGNED_LONG, op, MPI_COMM_WORLD,&req);
196  }
197 };*/
198 
202 /*template<> class MPI_IallreduceW<openfpm::vector<float>>
203 {
204 public:
205  static inline void reduce(openfpm::vector<float> & buf,MPI_Op op, MPI_Request & req)
206  {
207  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_FLOAT, op, MPI_COMM_WORLD,&req);
208  }
209 };*/
210 
215 /*template<> class MPI_IallreduceW<openfpm::vector<double>>
216 {
217 public:
218  static inline void reduce(openfpm::vector<double> & buf,MPI_Op op, MPI_Request & req)
219  {
220  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_DOUBLE, op, MPI_COMM_WORLD,&req);
221  }
222 };*/
223 
224 #endif
Set of wrapping classing for MPI_Iallreduce.