OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
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 #ifndef DISABLE_ALL_RTTI
25  std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " cannot recognize " << typeid(T).name() << "\n";
26 #endif
27  }
28 };
29 
30 
34 template<> class MPI_IallreduceW<int>
35 {
36 public:
37  static inline void reduce(int & buf,MPI_Op op, MPI_Request & req)
38  {
39  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_INT, op, MPI_COMM_WORLD,&req));
40  }
41 };
42 
46 template<> class MPI_IallreduceW<unsigned int>
47 {
48 public:
49  static inline void reduce(unsigned int & buf,MPI_Op op, MPI_Request & req)
50  {
51  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_UNSIGNED, op, MPI_COMM_WORLD,&req));
52  }
53 };
54 
58 template<> class MPI_IallreduceW<short>
59 {
60 public:
61  static inline void reduce(short & buf,MPI_Op op, MPI_Request & req)
62  {
63  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_SHORT, op, MPI_COMM_WORLD,&req));
64  }
65 };
66 
70 template<> class MPI_IallreduceW<unsigned short>
71 {
72 public:
73  static inline void reduce(unsigned short & buf,MPI_Op op, MPI_Request & req)
74  {
75  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_UNSIGNED_SHORT, op, MPI_COMM_WORLD,&req));
76  }
77 };
78 
82 template<> class MPI_IallreduceW<char>
83 {
84 public:
85  static inline void reduce(char & buf,MPI_Op op, MPI_Request & req)
86  {
87  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_CHAR, op, MPI_COMM_WORLD,&req));
88  }
89 };
90 
94 template<> class MPI_IallreduceW<unsigned char>
95 {
96 public:
97  static inline void reduce(unsigned char & buf,MPI_Op op, MPI_Request & req)
98  {
99  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_UNSIGNED_CHAR, op, MPI_COMM_WORLD,&req));
100  }
101 };
102 
106 template<> class MPI_IallreduceW<size_t>
107 {
108 public:
109  static inline void reduce(size_t & buf,MPI_Op op, MPI_Request & req)
110  {
111  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_UNSIGNED_LONG, op, MPI_COMM_WORLD,&req));
112  }
113 };
114 
118 template<> class MPI_IallreduceW<long int>
119 {
120 public:
121  static inline void reduce(long int & buf,MPI_Op op, MPI_Request & req)
122  {
123  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_LONG, op, MPI_COMM_WORLD,&req));
124  }
125 };
126 
130 template<> class MPI_IallreduceW<float>
131 {
132 public:
133  static inline void reduce(float & buf,MPI_Op op, MPI_Request & req)
134  {
135  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_FLOAT, op, MPI_COMM_WORLD,&req));
136  }
137 };
138 
142 template<> class MPI_IallreduceW<double>
143 {
144 public:
145  static inline void reduce(double & buf,MPI_Op op, MPI_Request & req)
146  {
147  MPI_SAFE_CALL(MPI_Iallreduce(MPI_IN_PLACE, &buf, 1,MPI_DOUBLE, op, MPI_COMM_WORLD,&req));
148  }
149 };
150 
152 
156 /*template<> class MPI_IallreduceW<openfpm::vector<int>>
157 {
158 public:
159  static inline void reduce(openfpm::vector<int> & buf,MPI_Op op, MPI_Request & req)
160  {
161  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_INT, op, MPI_COMM_WORLD,&req);
162  }
163 };*/
164 
168 /*template<> class MPI_IallreduceW<openfpm::vector<short>>
169 {
170 public:
171  static inline void reduce(openfpm::vector<short> & buf,MPI_Op op, MPI_Request & req)
172  {
173  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_SHORT, op, MPI_COMM_WORLD,&req);
174  }
175 };*/
176 
180 /*template<> class MPI_IallreduceW<openfpm::vector<char>>
181 {
182 public:
183  static inline void reduce(openfpm::vector<char> & buf,MPI_Op op, MPI_Request & req)
184  {
185  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_CHAR, op, MPI_COMM_WORLD,&req);
186  }
187 };*/
188 
192 /*template<> class MPI_IallreduceW<openfpm::vector<size_t>>
193 {
194 public:
195  static inline void reduce(openfpm::vector<size_t> & buf,MPI_Op op, MPI_Request & req)
196  {
197  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_UNSIGNED_LONG, op, MPI_COMM_WORLD,&req);
198  }
199 };*/
200 
204 /*template<> class MPI_IallreduceW<openfpm::vector<float>>
205 {
206 public:
207  static inline void reduce(openfpm::vector<float> & buf,MPI_Op op, MPI_Request & req)
208  {
209  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_FLOAT, op, MPI_COMM_WORLD,&req);
210  }
211 };*/
212 
217 /*template<> class MPI_IallreduceW<openfpm::vector<double>>
218 {
219 public:
220  static inline void reduce(openfpm::vector<double> & buf,MPI_Op op, MPI_Request & req)
221  {
222  MPI_Iallreduce(MPI_IN_PLACE, &buf.get(0), buf.size(),MPI_DOUBLE, op, MPI_COMM_WORLD,&req);
223  }
224 };*/
225 
226 #endif
Set of wrapping classing for MPI_Iallreduce.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data