This source file includes following definitions.
- module_bxor_constructor
- module_bxor_destructor
- bxor_int
- bxor_long
- bxor_integer
- ompi_op_example_setup_bxor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #include "ompi_config.h"
27
28 #include "opal/class/opal_object.h"
29 #include "opal/util/output.h"
30
31 #include "ompi/constants.h"
32 #include "ompi/op/op.h"
33 #include "ompi/mca/op/op.h"
34 #include "ompi/mca/op/base/base.h"
35 #include "ompi/mca/op/example/op_example.h"
36
37
38
39
40
41
42
43 typedef struct {
44 ompi_op_base_module_1_0_0_t super;
45
46
47
48
49
50
51
52
53
54
55
56 ompi_op_base_handler_fn_t fallback_int;
57 ompi_op_base_module_t *fallback_int_module;
58 ompi_op_base_handler_fn_t fallback_long;
59 ompi_op_base_module_t *fallback_long_module;
60 ompi_op_base_handler_fn_t fallback_integer;
61 ompi_op_base_module_t *fallback_integer_module;
62 } module_bxor_t;
63
64
65
66
67 static void module_bxor_constructor(module_bxor_t *m)
68 {
69
70
71
72 m->fallback_int = NULL;
73 m->fallback_int_module = NULL;
74 m->fallback_long = NULL;
75 m->fallback_long_module = NULL;
76 m->fallback_integer = NULL;
77 m->fallback_integer_module = NULL;
78 }
79
80
81
82
83 static void module_bxor_destructor(module_bxor_t *m)
84 {
85
86
87
88
89 m->fallback_int = (ompi_op_base_handler_fn_t) 0xdeadbeef;
90 m->fallback_int_module = (ompi_op_base_module_t*) 0xdeadbeef;
91 m->fallback_long = (ompi_op_base_handler_fn_t) 0xdeadbeef;
92 m->fallback_long_module = (ompi_op_base_module_t*) 0xdeadbeef;
93 m->fallback_integer = (ompi_op_base_handler_fn_t) 0xdeadbeef;
94 m->fallback_integer_module = (ompi_op_base_module_t*) 0xdeadbeef;
95 }
96
97
98
99
100
101
102
103
104 static OBJ_CLASS_INSTANCE(module_bxor_t,
105 ompi_op_base_module_t,
106 module_bxor_constructor,
107 module_bxor_destructor);
108
109
110
111
112 static void bxor_int(void *in, void *out, int *count,
113 ompi_datatype_t **type, ompi_op_base_module_t *module)
114 {
115 module_bxor_t *m = (module_bxor_t*) module;
116
117
118
119 opal_output(0, "In example bxor int function");
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140 m->fallback_int(in, out, count, type, m->fallback_int_module);
141 }
142
143
144
145
146 static void bxor_long(void *in, void *out, int *count,
147 ompi_datatype_t **type, ompi_op_base_module_t *module)
148 {
149 module_bxor_t *m = (module_bxor_t*) module;
150 opal_output(0, "In example bxor long function");
151
152
153
154 m->fallback_long(in, out, count, type, m->fallback_long_module);
155 }
156
157
158
159
160 static void bxor_integer(void *in, void *out, int *count,
161 ompi_datatype_t **type, ompi_op_base_module_t *module)
162 {
163 module_bxor_t *m = (module_bxor_t*) module;
164 opal_output(0, "In example bxor integer function");
165
166
167
168 m->fallback_integer(in, out, count, type, m->fallback_integer_module);
169 }
170
171
172
173
174
175
176
177
178
179
180
181
182
183 ompi_op_base_module_t *ompi_op_example_setup_bxor(ompi_op_t *op)
184 {
185 module_bxor_t *module = OBJ_NEW(module_bxor_t);
186
187
188
189
190
191
192
193
194 module->super.opm_fns[OMPI_OP_BASE_TYPE_INT] = bxor_int;
195 module->fallback_int = op->o_func.intrinsic.fns[OMPI_OP_BASE_TYPE_INT];
196 module->fallback_int_module =
197 op->o_func.intrinsic.modules[OMPI_OP_BASE_TYPE_INT];
198
199
200
201 OBJ_RETAIN(module->fallback_int_module);
202
203
204 module->super.opm_fns[OMPI_OP_BASE_TYPE_LONG] = bxor_long;
205 module->fallback_long = op->o_func.intrinsic.fns[OMPI_OP_BASE_TYPE_LONG];
206 module->fallback_long_module =
207 op->o_func.intrinsic.modules[OMPI_OP_BASE_TYPE_LONG];
208 OBJ_RETAIN(module->fallback_long_module);
209
210
211 module->super.opm_fns[OMPI_OP_BASE_TYPE_INTEGER] = bxor_integer;
212 module->fallback_integer =
213 op->o_func.intrinsic.fns[OMPI_OP_BASE_TYPE_INTEGER];
214 module->fallback_integer_module =
215 op->o_func.intrinsic.modules[OMPI_OP_BASE_TYPE_INTEGER];
216 OBJ_RETAIN(module->fallback_integer_module);
217
218
219
220
221 return (ompi_op_base_module_t*) module;
222 }