This source file includes following definitions.
- FUNC_OP_CREATE
- oshmem_op_finalize
- oshmem_op_construct
- oshmem_op_destruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include "oshmem_config.h"
15 #include <complex.h>
16
17 #include "opal/datatype/opal_datatype.h"
18 #include "opal/datatype/opal_datatype_internal.h"
19 #include "opal/class/opal_pointer_array.h"
20
21 #include "oshmem/constants.h"
22 #include "oshmem/op/op.h"
23
24
25
26
27 opal_pointer_array_t oshmem_op_array = {{0}};
28
29
30
31
32 static void oshmem_op_construct(oshmem_op_t *object);
33 static void oshmem_op_destruct(oshmem_op_t *object);
34
35
36
37
38 OBJ_CLASS_INSTANCE(oshmem_op_t,
39 opal_object_t,
40 oshmem_op_construct,
41 oshmem_op_destruct);
42
43
44
45
46
47 oshmem_op_t* oshmem_op_and_short = NULL;
48 oshmem_op_t* oshmem_op_and_int = NULL;
49 oshmem_op_t* oshmem_op_and_long = NULL;
50 oshmem_op_t* oshmem_op_and_longlong = NULL;
51 oshmem_op_t* oshmem_op_and_fint2 = NULL;
52 oshmem_op_t* oshmem_op_and_fint4 = NULL;
53 oshmem_op_t* oshmem_op_and_fint8 = NULL;
54 oshmem_op_t* oshmem_op_and_int16 = NULL;
55 oshmem_op_t* oshmem_op_and_int32 = NULL;
56 oshmem_op_t* oshmem_op_and_int64 = NULL;
57
58
59 oshmem_op_t* oshmem_op_or_short = NULL;
60 oshmem_op_t* oshmem_op_or_int = NULL;
61 oshmem_op_t* oshmem_op_or_long = NULL;
62 oshmem_op_t* oshmem_op_or_longlong = NULL;
63 oshmem_op_t* oshmem_op_or_fint2 = NULL;
64 oshmem_op_t* oshmem_op_or_fint4 = NULL;
65 oshmem_op_t* oshmem_op_or_fint8 = NULL;
66 oshmem_op_t* oshmem_op_or_int16 = NULL;
67 oshmem_op_t* oshmem_op_or_int32 = NULL;
68 oshmem_op_t* oshmem_op_or_int64 = NULL;
69
70
71 oshmem_op_t* oshmem_op_xor_short = NULL;
72 oshmem_op_t* oshmem_op_xor_int = NULL;
73 oshmem_op_t* oshmem_op_xor_long = NULL;
74 oshmem_op_t* oshmem_op_xor_longlong = NULL;
75 oshmem_op_t* oshmem_op_xor_fint2 = NULL;
76 oshmem_op_t* oshmem_op_xor_fint4 = NULL;
77 oshmem_op_t* oshmem_op_xor_fint8 = NULL;
78 oshmem_op_t* oshmem_op_xor_int16 = NULL;
79 oshmem_op_t* oshmem_op_xor_int32 = NULL;
80 oshmem_op_t* oshmem_op_xor_int64 = NULL;
81
82
83 oshmem_op_t* oshmem_op_max_short = NULL;
84 oshmem_op_t* oshmem_op_max_int = NULL;
85 oshmem_op_t* oshmem_op_max_long = NULL;
86 oshmem_op_t* oshmem_op_max_longlong = NULL;
87 oshmem_op_t* oshmem_op_max_float = NULL;
88 oshmem_op_t* oshmem_op_max_double = NULL;
89 oshmem_op_t* oshmem_op_max_longdouble = NULL;
90 oshmem_op_t* oshmem_op_max_fint2 = NULL;
91 oshmem_op_t* oshmem_op_max_fint4 = NULL;
92 oshmem_op_t* oshmem_op_max_fint8 = NULL;
93 oshmem_op_t* oshmem_op_max_freal4 = NULL;
94 oshmem_op_t* oshmem_op_max_freal8 = NULL;
95 oshmem_op_t* oshmem_op_max_freal16 = NULL;
96 oshmem_op_t* oshmem_op_max_int16 = NULL;
97 oshmem_op_t* oshmem_op_max_int32 = NULL;
98 oshmem_op_t* oshmem_op_max_int64 = NULL;
99
100
101 oshmem_op_t* oshmem_op_min_short = NULL;
102 oshmem_op_t* oshmem_op_min_int = NULL;
103 oshmem_op_t* oshmem_op_min_long = NULL;
104 oshmem_op_t* oshmem_op_min_longlong = NULL;
105 oshmem_op_t* oshmem_op_min_float = NULL;
106 oshmem_op_t* oshmem_op_min_double = NULL;
107 oshmem_op_t* oshmem_op_min_longdouble = NULL;
108 oshmem_op_t* oshmem_op_min_fint2 = NULL;
109 oshmem_op_t* oshmem_op_min_fint4 = NULL;
110 oshmem_op_t* oshmem_op_min_fint8 = NULL;
111 oshmem_op_t* oshmem_op_min_freal4 = NULL;
112 oshmem_op_t* oshmem_op_min_freal8 = NULL;
113 oshmem_op_t* oshmem_op_min_freal16 = NULL;
114 oshmem_op_t* oshmem_op_min_int16 = NULL;
115 oshmem_op_t* oshmem_op_min_int32 = NULL;
116 oshmem_op_t* oshmem_op_min_int64 = NULL;
117
118
119 oshmem_op_t* oshmem_op_sum_short = NULL;
120 oshmem_op_t* oshmem_op_sum_int = NULL;
121 oshmem_op_t* oshmem_op_sum_long = NULL;
122 oshmem_op_t* oshmem_op_sum_longlong = NULL;
123 oshmem_op_t* oshmem_op_sum_float = NULL;
124 oshmem_op_t* oshmem_op_sum_double = NULL;
125 oshmem_op_t* oshmem_op_sum_longdouble = NULL;
126 oshmem_op_t* oshmem_op_sum_complexf = NULL;
127 oshmem_op_t* oshmem_op_sum_complexd = NULL;
128 oshmem_op_t* oshmem_op_sum_fint2 = NULL;
129 oshmem_op_t* oshmem_op_sum_fint4 = NULL;
130 oshmem_op_t* oshmem_op_sum_fint8 = NULL;
131 oshmem_op_t* oshmem_op_sum_freal4 = NULL;
132 oshmem_op_t* oshmem_op_sum_freal8 = NULL;
133 oshmem_op_t* oshmem_op_sum_freal16 = NULL;
134 oshmem_op_t* oshmem_op_sum_int16 = NULL;
135 oshmem_op_t* oshmem_op_sum_int32 = NULL;
136 oshmem_op_t* oshmem_op_sum_int64 = NULL;
137
138
139 oshmem_op_t* oshmem_op_prod_short = NULL;
140 oshmem_op_t* oshmem_op_prod_int = NULL;
141 oshmem_op_t* oshmem_op_prod_long = NULL;
142 oshmem_op_t* oshmem_op_prod_longlong = NULL;
143 oshmem_op_t* oshmem_op_prod_float = NULL;
144 oshmem_op_t* oshmem_op_prod_double = NULL;
145 oshmem_op_t* oshmem_op_prod_longdouble = NULL;
146 oshmem_op_t* oshmem_op_prod_complexf = NULL;
147 oshmem_op_t* oshmem_op_prod_complexd = NULL;
148 oshmem_op_t* oshmem_op_prod_fint2 = NULL;
149 oshmem_op_t* oshmem_op_prod_fint4 = NULL;
150 oshmem_op_t* oshmem_op_prod_fint8 = NULL;
151 oshmem_op_t* oshmem_op_prod_freal4 = NULL;
152 oshmem_op_t* oshmem_op_prod_freal8 = NULL;
153 oshmem_op_t* oshmem_op_prod_freal16 = NULL;
154 oshmem_op_t* oshmem_op_prod_int16 = NULL;
155 oshmem_op_t* oshmem_op_prod_int32 = NULL;
156 oshmem_op_t* oshmem_op_prod_int64 = NULL;
157
158
159 oshmem_op_t* oshmem_op_swap_int = NULL;
160 oshmem_op_t* oshmem_op_swap_long = NULL;
161 oshmem_op_t* oshmem_op_swap_longlong = NULL;
162 oshmem_op_t* oshmem_op_swap_int32 = NULL;
163 oshmem_op_t* oshmem_op_swap_int64 = NULL;
164
165 #define FUNC_OP_CREATE(name, type_name, type, calc) \
166 void oshmem_op_##name##_##type_name##_func(void *in, void *out, int count); \
167 void oshmem_op_##name##_##type_name##_func(void *in, void *out, int count) \
168 { \
169 int i; \
170 type *a = (type *) in; \
171 type *b = (type *) out; \
172 for (i = 0; i < count; ++i) { \
173 *(b) = calc(*(b), *(a)); \
174 ++b; \
175 ++a; \
176 } \
177 }
178
179 #define OBJ_OP_CREATE(name, type_name, type, op_id, dt_id) \
180 oshmem_op_##name##_##type_name = OBJ_NEW(oshmem_op_t); \
181 if (oshmem_op_##name##_##type_name) \
182 { \
183 oshmem_op_##name##_##type_name->op = op_id; \
184 oshmem_op_##name##_##type_name->dt = dt_id; \
185 oshmem_op_##name##_##type_name->dt_size = sizeof(type); \
186 oshmem_op_##name##_##type_name->o_func.c_fn = oshmem_op_##name##_##type_name##_func; \
187 } \
188
189
190 #define __and_op(a, b) ((a) & (b))
191 FUNC_OP_CREATE(and, short, short, __and_op)
192 FUNC_OP_CREATE(and, int, int, __and_op)
193 FUNC_OP_CREATE(and, long, long, __and_op)
194 FUNC_OP_CREATE(and, longlong, long long, __and_op)
195 FUNC_OP_CREATE(and, fint2, ompi_fortran_integer4_t, __and_op)
196 FUNC_OP_CREATE(and, fint4, ompi_fortran_integer4_t, __and_op)
197 FUNC_OP_CREATE(and, fint8, ompi_fortran_integer8_t, __and_op)
198 FUNC_OP_CREATE(and, int16, int16_t, __and_op)
199 FUNC_OP_CREATE(and, int32, int32_t, __and_op)
200 FUNC_OP_CREATE(and, int64, int64_t, __and_op)
201
202
203 #define __or_op(a, b) ((a) | (b))
204 FUNC_OP_CREATE(or, short, short, __or_op)
205 FUNC_OP_CREATE(or, int, int, __or_op)
206 FUNC_OP_CREATE(or, long, long, __or_op)
207 FUNC_OP_CREATE(or, longlong, long long, __or_op)
208 FUNC_OP_CREATE(or, fint2, ompi_fortran_integer2_t, __or_op)
209 FUNC_OP_CREATE(or, fint4, ompi_fortran_integer4_t, __or_op)
210 FUNC_OP_CREATE(or, fint8, ompi_fortran_integer8_t, __or_op)
211 FUNC_OP_CREATE(or, int16, int16_t, __or_op)
212 FUNC_OP_CREATE(or, int32, int32_t, __or_op)
213 FUNC_OP_CREATE(or, int64, int64_t, __or_op)
214
215
216 #define __xor_op(a, b) ((a) ^ (b))
217 FUNC_OP_CREATE(xor, short, short, __xor_op)
218 FUNC_OP_CREATE(xor, int, int, __xor_op)
219 FUNC_OP_CREATE(xor, long, long, __xor_op)
220 FUNC_OP_CREATE(xor, longlong, long long, __xor_op)
221 FUNC_OP_CREATE(xor, fint2, ompi_fortran_integer4_t, __xor_op)
222 FUNC_OP_CREATE(xor, fint4, ompi_fortran_integer4_t, __xor_op)
223 FUNC_OP_CREATE(xor, fint8, ompi_fortran_integer8_t, __xor_op)
224 FUNC_OP_CREATE(xor, int16, int16_t, __xor_op)
225 FUNC_OP_CREATE(xor, int32, int32_t, __xor_op)
226 FUNC_OP_CREATE(xor, int64, int64_t, __xor_op)
227
228
229 #define __max_op(a, b) ((a) > (b) ? (a) : (b))
230 FUNC_OP_CREATE(max, short, short, __max_op)
231 FUNC_OP_CREATE(max, int, int, __max_op)
232 FUNC_OP_CREATE(max, long, long, __max_op)
233 FUNC_OP_CREATE(max, longlong, long long, __max_op)
234 FUNC_OP_CREATE(max, float, float, __max_op)
235 FUNC_OP_CREATE(max, double, double, __max_op)
236 FUNC_OP_CREATE(max, longdouble, long double, __max_op)
237 FUNC_OP_CREATE(max, fint2, ompi_fortran_integer4_t, __max_op)
238 FUNC_OP_CREATE(max, fint4, ompi_fortran_integer4_t, __max_op)
239 FUNC_OP_CREATE(max, fint8, ompi_fortran_integer8_t, __max_op)
240 FUNC_OP_CREATE(max, freal4, ompi_fortran_real4_t, __max_op)
241 FUNC_OP_CREATE(max, freal8, ompi_fortran_real8_t, __max_op)
242 #if OMPI_HAVE_FORTRAN_REAL16
243 FUNC_OP_CREATE(max, freal16, ompi_fortran_real16_t, __max_op)
244 #endif
245 FUNC_OP_CREATE(max, int16, int16_t, __max_op)
246 FUNC_OP_CREATE(max, int32, int32_t, __max_op)
247 FUNC_OP_CREATE(max, int64, int64_t, __max_op)
248
249
250 #define __min_op(a, b) ((a) < (b) ? (a) : (b))
251 FUNC_OP_CREATE(min, short, short, __min_op)
252 FUNC_OP_CREATE(min, int, int, __min_op)
253 FUNC_OP_CREATE(min, long, long, __min_op)
254 FUNC_OP_CREATE(min, longlong, long long, __min_op)
255 FUNC_OP_CREATE(min, float, float, __min_op)
256 FUNC_OP_CREATE(min, double, double, __min_op)
257 FUNC_OP_CREATE(min, longdouble, long double, __min_op)
258 FUNC_OP_CREATE(min, fint2, ompi_fortran_integer4_t, __min_op)
259 FUNC_OP_CREATE(min, fint4, ompi_fortran_integer4_t, __min_op)
260 FUNC_OP_CREATE(min, fint8, ompi_fortran_integer8_t, __min_op)
261 FUNC_OP_CREATE(min, freal4, ompi_fortran_real4_t, __min_op)
262 FUNC_OP_CREATE(min, freal8, ompi_fortran_real8_t, __min_op)
263 #if OMPI_HAVE_FORTRAN_REAL16
264 FUNC_OP_CREATE(min, freal16, ompi_fortran_real16_t, __min_op)
265 #endif
266 FUNC_OP_CREATE(min, int16, int16_t, __min_op)
267 FUNC_OP_CREATE(min, int32, int32_t, __min_op)
268 FUNC_OP_CREATE(min, int64, int64_t, __min_op)
269
270
271 #define __sum_op(a, b) ((a) + (b))
272 FUNC_OP_CREATE(sum, short, short, __sum_op)
273 FUNC_OP_CREATE(sum, int, int, __sum_op)
274 FUNC_OP_CREATE(sum, long, long, __sum_op)
275 FUNC_OP_CREATE(sum, longlong, long long, __sum_op)
276 FUNC_OP_CREATE(sum, float, float, __sum_op)
277 FUNC_OP_CREATE(sum, double, double, __sum_op)
278 FUNC_OP_CREATE(sum, longdouble, long double, __sum_op)
279 FUNC_OP_CREATE(sum, complexf, float complex, __sum_op)
280 FUNC_OP_CREATE(sum, complexd, double complex, __sum_op)
281 FUNC_OP_CREATE(sum, fint2, ompi_fortran_integer4_t, __sum_op)
282 FUNC_OP_CREATE(sum, fint4, ompi_fortran_integer4_t, __sum_op)
283 FUNC_OP_CREATE(sum, fint8, ompi_fortran_integer8_t, __sum_op)
284 FUNC_OP_CREATE(sum, freal4, ompi_fortran_real4_t, __sum_op)
285 FUNC_OP_CREATE(sum, freal8, ompi_fortran_real8_t, __sum_op)
286 #if OMPI_HAVE_FORTRAN_REAL16
287 FUNC_OP_CREATE(sum, freal16, ompi_fortran_real16_t, __sum_op)
288 #endif
289 FUNC_OP_CREATE(sum, int16, int16_t, __sum_op)
290 FUNC_OP_CREATE(sum, int32, int32_t, __sum_op)
291 FUNC_OP_CREATE(sum, int64, int64_t, __sum_op)
292
293
294 #define __prod_op(a, b) ((a) * (b))
295 FUNC_OP_CREATE(prod, short, short, __prod_op)
296 FUNC_OP_CREATE(prod, int, int, __prod_op)
297 FUNC_OP_CREATE(prod, long, long, __prod_op)
298 FUNC_OP_CREATE(prod, longlong, long long, __prod_op)
299 FUNC_OP_CREATE(prod, float, float, __prod_op)
300 FUNC_OP_CREATE(prod, double, double, __prod_op)
301 FUNC_OP_CREATE(prod, longdouble, long double, __prod_op)
302 FUNC_OP_CREATE(prod, complexf, float complex, __prod_op)
303 FUNC_OP_CREATE(prod, complexd, double complex, __prod_op)
304 FUNC_OP_CREATE(prod, fint2, ompi_fortran_integer2_t, __prod_op)
305 FUNC_OP_CREATE(prod, fint4, ompi_fortran_integer4_t, __prod_op)
306 FUNC_OP_CREATE(prod, fint8, ompi_fortran_integer8_t, __prod_op)
307 FUNC_OP_CREATE(prod, freal4, ompi_fortran_real4_t, __prod_op)
308 FUNC_OP_CREATE(prod, freal8, ompi_fortran_real8_t, __prod_op)
309 #if OMPI_HAVE_FORTRAN_REAL16
310 FUNC_OP_CREATE(prod, freal16, ompi_fortran_real16_t, __prod_op)
311 #endif
312 FUNC_OP_CREATE(prod, int16, int16_t, __prod_op)
313 FUNC_OP_CREATE(prod, int32, int32_t, __prod_op)
314 FUNC_OP_CREATE(prod, int64, int64_t, __prod_op)
315
316
317 #define __swap_op(a, b) (a)
318 FUNC_OP_CREATE(swap, int, int, __swap_op)
319 FUNC_OP_CREATE(swap, long, long, __swap_op)
320 FUNC_OP_CREATE(swap, longlong, long long, __swap_op)
321 FUNC_OP_CREATE(swap, int32, int32_t, __swap_op)
322 FUNC_OP_CREATE(swap, int64, int64_t, __swap_op)
323
324 int oshmem_op_init(void)
325 {
326
327
328 OBJ_CONSTRUCT(&oshmem_op_array, opal_pointer_array_t);
329 if (OPAL_SUCCESS
330 != opal_pointer_array_init(&oshmem_op_array,
331 0,
332 INT_MAX,
333 1)) {
334 return OSHMEM_ERROR;
335 }
336
337
338 OBJ_OP_CREATE(and, short, short, OSHMEM_OP_AND, OSHMEM_OP_TYPE_SHORT);
339 OBJ_OP_CREATE(and, int, int, OSHMEM_OP_AND, OSHMEM_OP_TYPE_INT);
340 OBJ_OP_CREATE(and, long, long, OSHMEM_OP_AND, OSHMEM_OP_TYPE_LONG);
341 OBJ_OP_CREATE(and, longlong, long long, OSHMEM_OP_AND, OSHMEM_OP_TYPE_LLONG);
342 OBJ_OP_CREATE(and, fint2, ompi_fortran_integer2_t, OSHMEM_OP_AND, OSHMEM_OP_TYPE_FINT2);
343 OBJ_OP_CREATE(and, fint4, ompi_fortran_integer4_t, OSHMEM_OP_AND, OSHMEM_OP_TYPE_FINT4);
344 OBJ_OP_CREATE(and, fint8, ompi_fortran_integer8_t, OSHMEM_OP_AND, OSHMEM_OP_TYPE_FINT8);
345 OBJ_OP_CREATE(and, int16, int16_t, OSHMEM_OP_AND, OSHMEM_OP_TYPE_INT16_T);
346 OBJ_OP_CREATE(and, int32, int32_t, OSHMEM_OP_AND, OSHMEM_OP_TYPE_INT32_T);
347 OBJ_OP_CREATE(and, int64, int64_t, OSHMEM_OP_AND, OSHMEM_OP_TYPE_INT64_T);
348
349
350 OBJ_OP_CREATE(or, short, short, OSHMEM_OP_OR, OSHMEM_OP_TYPE_SHORT);
351 OBJ_OP_CREATE(or, int, int, OSHMEM_OP_OR, OSHMEM_OP_TYPE_INT);
352 OBJ_OP_CREATE(or, long, long, OSHMEM_OP_OR, OSHMEM_OP_TYPE_LONG);
353 OBJ_OP_CREATE(or, longlong, long long, OSHMEM_OP_OR, OSHMEM_OP_TYPE_LLONG);
354 OBJ_OP_CREATE(or, fint2, ompi_fortran_integer2_t, OSHMEM_OP_OR, OSHMEM_OP_TYPE_FINT2);
355 OBJ_OP_CREATE(or, fint4, ompi_fortran_integer4_t, OSHMEM_OP_OR, OSHMEM_OP_TYPE_FINT4);
356 OBJ_OP_CREATE(or, fint8, ompi_fortran_integer8_t, OSHMEM_OP_OR, OSHMEM_OP_TYPE_FINT8);
357 OBJ_OP_CREATE(or, int16, int16_t, OSHMEM_OP_OR, OSHMEM_OP_TYPE_INT16_T);
358 OBJ_OP_CREATE(or, int32, int32_t, OSHMEM_OP_OR, OSHMEM_OP_TYPE_INT32_T);
359 OBJ_OP_CREATE(or, int64, int64_t, OSHMEM_OP_OR, OSHMEM_OP_TYPE_INT64_T);
360
361
362 OBJ_OP_CREATE(xor, short, short, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_SHORT);
363 OBJ_OP_CREATE(xor, int, int, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_INT);
364 OBJ_OP_CREATE(xor, long, long, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_LONG);
365 OBJ_OP_CREATE(xor, longlong, long long, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_LLONG);
366 OBJ_OP_CREATE(xor, fint2, ompi_fortran_integer2_t, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_FINT2);
367 OBJ_OP_CREATE(xor, fint4, ompi_fortran_integer4_t, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_FINT4);
368 OBJ_OP_CREATE(xor, fint8, ompi_fortran_integer8_t, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_FINT8);
369 OBJ_OP_CREATE(xor, int16, int16_t, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_INT16_T);
370 OBJ_OP_CREATE(xor, int32, int32_t, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_INT32_T);
371 OBJ_OP_CREATE(xor, int64, int64_t, OSHMEM_OP_XOR, OSHMEM_OP_TYPE_INT64_T);
372
373
374 OBJ_OP_CREATE(max, short, short, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_SHORT);
375 OBJ_OP_CREATE(max, int, int, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_INT);
376 OBJ_OP_CREATE(max, long, long, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_LONG);
377 OBJ_OP_CREATE(max, longlong, long long, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_LLONG);
378 OBJ_OP_CREATE(max, float, float, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_FLOAT);
379 OBJ_OP_CREATE(max, double, double, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_DOUBLE);
380 OBJ_OP_CREATE(max, longdouble, long double, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_LDOUBLE);
381 OBJ_OP_CREATE(max, fint2, ompi_fortran_integer2_t, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_FINT2);
382 OBJ_OP_CREATE(max, fint4, ompi_fortran_integer4_t, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_FINT4);
383 OBJ_OP_CREATE(max, fint8, ompi_fortran_integer8_t, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_FINT8);
384 OBJ_OP_CREATE(max, freal4, ompi_fortran_real4_t, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_FREAL4);
385 OBJ_OP_CREATE(max, freal8, ompi_fortran_real8_t, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_FREAL8);
386 #if OMPI_HAVE_FORTRAN_REAL16
387 OBJ_OP_CREATE(max, freal16, ompi_fortran_real16_t, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_FREAL16);
388 #endif
389 OBJ_OP_CREATE(max, int16, int16_t, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_INT16_T);
390 OBJ_OP_CREATE(max, int32, int32_t, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_INT32_T);
391 OBJ_OP_CREATE(max, int64, int64_t, OSHMEM_OP_MAX, OSHMEM_OP_TYPE_INT64_T);
392
393
394 OBJ_OP_CREATE(min, short, short, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_SHORT);
395 OBJ_OP_CREATE(min, int, int, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_INT);
396 OBJ_OP_CREATE(min, long, long, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_LONG);
397 OBJ_OP_CREATE(min, longlong, long long, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_LLONG);
398 OBJ_OP_CREATE(min, float, float, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_FLOAT);
399 OBJ_OP_CREATE(min, double, double, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_DOUBLE);
400 OBJ_OP_CREATE(min, longdouble, long double, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_LDOUBLE);
401 OBJ_OP_CREATE(min, fint2, ompi_fortran_integer2_t, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_FINT2);
402 OBJ_OP_CREATE(min, fint4, ompi_fortran_integer4_t, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_FINT4);
403 OBJ_OP_CREATE(min, fint8, ompi_fortran_integer8_t, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_FINT8);
404 OBJ_OP_CREATE(min, freal4, ompi_fortran_real4_t, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_FREAL4);
405 OBJ_OP_CREATE(min, freal8, ompi_fortran_real8_t, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_FREAL8);
406 #if OMPI_HAVE_FORTRAN_REAL16
407 OBJ_OP_CREATE(min, freal16, ompi_fortran_real16_t, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_FREAL16);
408 #endif
409 OBJ_OP_CREATE(min, int16, int16_t, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_INT16_T);
410 OBJ_OP_CREATE(min, int32, int32_t, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_INT32_T);
411 OBJ_OP_CREATE(min, int64, int64_t, OSHMEM_OP_MIN, OSHMEM_OP_TYPE_INT64_T);
412
413
414 OBJ_OP_CREATE(sum, short, short, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_SHORT);
415 OBJ_OP_CREATE(sum, int, int, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_INT);
416 OBJ_OP_CREATE(sum, long, long, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_LONG);
417 OBJ_OP_CREATE(sum, longlong, long long, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_LLONG);
418 OBJ_OP_CREATE(sum, float, float, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_FLOAT);
419 OBJ_OP_CREATE(sum, double, double, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_DOUBLE);
420 OBJ_OP_CREATE(sum, longdouble, long double, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_LDOUBLE);
421 OBJ_OP_CREATE(sum, complexf, float complex, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_FCOMPLEX);
422 OBJ_OP_CREATE(sum, complexd, double complex, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_DCOMPLEX);
423 OBJ_OP_CREATE(sum, fint2, ompi_fortran_integer2_t, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_FINT2);
424 OBJ_OP_CREATE(sum, fint4, ompi_fortran_integer4_t, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_FINT4);
425 OBJ_OP_CREATE(sum, fint8, ompi_fortran_integer8_t, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_FINT8);
426 OBJ_OP_CREATE(sum, freal4, ompi_fortran_real4_t, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_FREAL4);
427 OBJ_OP_CREATE(sum, freal8, ompi_fortran_real8_t, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_FREAL8);
428 #if OMPI_HAVE_FORTRAN_REAL16
429 OBJ_OP_CREATE(sum, freal16, ompi_fortran_real16_t, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_FREAL16);
430 #endif
431 OBJ_OP_CREATE(sum, int16, int16_t, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_INT16_T);
432 OBJ_OP_CREATE(sum, int32, int32_t, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_INT32_T);
433 OBJ_OP_CREATE(sum, int64, int64_t, OSHMEM_OP_SUM, OSHMEM_OP_TYPE_INT64_T);
434
435
436 OBJ_OP_CREATE(prod, short, short, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_SHORT);
437 OBJ_OP_CREATE(prod, int, int, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_INT);
438 OBJ_OP_CREATE(prod, long, long, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_LONG);
439 OBJ_OP_CREATE(prod, longlong, long long, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_LLONG);
440 OBJ_OP_CREATE(prod, float, float, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_FLOAT);
441 OBJ_OP_CREATE(prod, double, double, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_DOUBLE);
442 OBJ_OP_CREATE(prod, longdouble, long double, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_LDOUBLE);
443 OBJ_OP_CREATE(prod, complexf, float complex, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_FCOMPLEX);
444 OBJ_OP_CREATE(prod, complexd, double complex, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_DCOMPLEX);
445 OBJ_OP_CREATE(prod, fint2, ompi_fortran_integer2_t, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_FINT2);
446 OBJ_OP_CREATE(prod, fint4, ompi_fortran_integer4_t, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_FINT4);
447 OBJ_OP_CREATE(prod, fint8, ompi_fortran_integer8_t, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_FINT8);
448 OBJ_OP_CREATE(prod, freal4, ompi_fortran_real4_t, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_FREAL4);
449 OBJ_OP_CREATE(prod, freal8, ompi_fortran_real8_t, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_FREAL8);
450 #if OMPI_HAVE_FORTRAN_REAL16
451 OBJ_OP_CREATE(prod, freal16, ompi_fortran_real16_t, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_FREAL16);
452 #endif
453 OBJ_OP_CREATE(prod, int16, int16_t, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_INT16_T);
454 OBJ_OP_CREATE(prod, int32, int32_t, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_INT32_T);
455 OBJ_OP_CREATE(prod, int64, int64_t, OSHMEM_OP_PROD, OSHMEM_OP_TYPE_INT64_T);
456
457
458
459
460 OBJ_OP_CREATE(swap, int, int, OSHMEM_OP_NUMBER, OSHMEM_OP_TYPE_INT);
461 OBJ_OP_CREATE(swap, long, long, OSHMEM_OP_NUMBER, OSHMEM_OP_TYPE_LONG);
462 OBJ_OP_CREATE(swap, longlong, long long, OSHMEM_OP_NUMBER, OSHMEM_OP_TYPE_LLONG);
463 OBJ_OP_CREATE(swap, int32, int32_t, OSHMEM_OP_NUMBER, OSHMEM_OP_TYPE_INT32_T);
464 OBJ_OP_CREATE(swap, int64, int64_t, OSHMEM_OP_NUMBER, OSHMEM_OP_TYPE_INT64_T);
465
466 return OSHMEM_SUCCESS;
467 }
468
469 int oshmem_op_finalize(void)
470 {
471 int max, i;
472 oshmem_op_t *op;
473
474
475 max = opal_pointer_array_get_size(&oshmem_op_array);
476 for (i = 0; i < max; i++) {
477 op = (oshmem_op_t *) opal_pointer_array_get_item(&oshmem_op_array, i);
478 if (NULL != op) {
479 OBJ_RELEASE(op);
480 }
481 }
482
483 OBJ_DESTRUCT(&oshmem_op_array);
484
485 return OSHMEM_SUCCESS;
486 }
487
488
489
490
491
492
493
494
495
496
497 static void oshmem_op_construct(oshmem_op_t *object)
498 {
499 object->id = opal_pointer_array_add(&oshmem_op_array, object);
500 }
501
502
503
504
505 static void oshmem_op_destruct(oshmem_op_t *object)
506 {
507 if (NULL != opal_pointer_array_get_item(&oshmem_op_array, object->id)) {
508 opal_pointer_array_set_item(&oshmem_op_array, object->id, NULL );
509 }
510 }