This source file includes following definitions.
- ompi_osc_rdma_lock_add
- ompi_osc_rdma_lock_compare_exchange
- ompi_osc_rdma_lock_add
- ompi_osc_rdma_lock_compare_exchange
1
2
3
4
5
6
7
8
9
10
11
12 #ifndef OMPI_OSC_RDMA_TYPES_H
13 #define OMPI_OSC_RDMA_TYPES_H
14
15 #include "ompi_config.h"
16
17
18 struct ompi_osc_rdma_frag_t;
19 struct ompi_osc_rdma_sync_t;
20 struct ompi_osc_rdma_peer_t;
21
22 #if OPAL_HAVE_ATOMIC_MATH_64
23
24 typedef int64_t osc_rdma_base_t;
25 typedef int64_t osc_rdma_size_t;
26 typedef int64_t osc_rdma_counter_t;
27 typedef opal_atomic_int64_t osc_rdma_atomic_counter_t;
28
29 #define ompi_osc_rdma_counter_add opal_atomic_add_fetch_64
30
31 #else
32
33 typedef int32_t osc_rdma_base_t;
34 typedef int32_t osc_rdma_size_t;
35 typedef int32_t osc_rdma_counter_t;
36 typedef opal_atomic_int32_t osc_rdma_atomic_counter_t;
37
38 #define ompi_osc_rdma_counter_add opal_atomic_add_fetch_32
39
40 #endif
41
42 #if OPAL_HAVE_ATOMIC_MATH_64
43
44 #define OMPI_OSC_RDMA_LOCK_EXCLUSIVE 0x8000000000000000l
45
46 typedef int64_t ompi_osc_rdma_lock_t;
47 typedef opal_atomic_int64_t ompi_osc_rdma_atomic_lock_t;
48
49 static inline int64_t ompi_osc_rdma_lock_add (opal_atomic_int64_t *p, int64_t value)
50 {
51 int64_t new;
52
53 opal_atomic_mb ();
54 new = opal_atomic_add_fetch_64 (p, value) - value;
55 opal_atomic_mb ();
56
57 return new;
58 }
59
60 static inline int ompi_osc_rdma_lock_compare_exchange (opal_atomic_int64_t *p, int64_t *comp, int64_t value)
61 {
62 int ret;
63
64 opal_atomic_mb ();
65 ret = opal_atomic_compare_exchange_strong_64 (p, comp, value);
66 opal_atomic_mb ();
67
68 return ret;
69 }
70
71 #else
72
73 #define OMPI_OSC_RDMA_LOCK_EXCLUSIVE 0x80000000l
74
75 typedef int32_t ompi_osc_rdma_lock_t;
76 typedef opal_atomic_int32_t ompi_osc_rdma_atomic_lock_t;
77
78 static inline int32_t ompi_osc_rdma_lock_add (opal_atomic_int32_t *p, int32_t value)
79 {
80 int32_t new;
81
82 opal_atomic_mb ();
83
84 new = opal_atomic_add_fetch_32 (p, value) - value;
85 opal_atomic_mb ();
86
87 return new;
88 }
89
90 static inline int ompi_osc_rdma_lock_compare_exchange (opal_atomic_int32_t *p, int32_t *comp, int32_t value)
91 {
92 int ret;
93
94 opal_atomic_mb ();
95 ret = opal_atomic_compare_exchange_strong_32 (p, comp, value);
96 opal_atomic_mb ();
97
98 return ret;
99 }
100
101 #endif
102
103
104
105
106 struct ompi_osc_rdma_region_t {
107
108 osc_rdma_base_t base;
109
110 osc_rdma_size_t len;
111
112 unsigned char btl_handle_data[];
113 };
114 typedef struct ompi_osc_rdma_region_t ompi_osc_rdma_region_t;
115
116
117
118
119
120
121
122
123
124 struct ompi_osc_rdma_handle_t {
125
126 mca_btl_base_registration_handle_t *btl_handle;
127
128 int refcnt;
129 };
130 typedef struct ompi_osc_rdma_handle_t ompi_osc_rdma_handle_t;
131
132
133
134
135
136
137
138
139
140
141 #define OMPI_OSC_RDMA_POST_PEER_MAX 32
142
143
144
145
146
147
148
149
150 struct ompi_osc_rdma_state_t {
151
152 ompi_osc_rdma_lock_t global_lock;
153
154
155 ompi_osc_rdma_lock_t local_lock;
156
157 ompi_osc_rdma_lock_t accumulate_lock;
158
159
160 osc_rdma_counter_t post_index;
161
162 osc_rdma_counter_t post_peers[OMPI_OSC_RDMA_POST_PEER_MAX];
163
164 osc_rdma_atomic_counter_t num_post_msgs;
165
166 osc_rdma_counter_t num_complete_msgs;
167
168 ompi_osc_rdma_lock_t regions_lock;
169
170 int64_t disp_unit;
171
172 osc_rdma_counter_t region_count;
173
174 unsigned char regions[];
175 };
176 typedef struct ompi_osc_rdma_state_t ompi_osc_rdma_state_t;
177
178 typedef void (*ompi_osc_rdma_pending_op_cb_fn_t) (void *, void *, int);
179
180 struct ompi_osc_rdma_pending_op_t {
181 opal_list_item_t super;
182 struct ompi_osc_rdma_module_t *module;
183 struct ompi_osc_rdma_frag_t *op_frag;
184 void *op_buffer;
185 void *op_result;
186 size_t op_size;
187 volatile bool op_complete;
188 ompi_osc_rdma_pending_op_cb_fn_t cbfunc;
189 void *cbdata;
190 void *cbcontext;
191 };
192
193 typedef struct ompi_osc_rdma_pending_op_t ompi_osc_rdma_pending_op_t;
194
195 OBJ_CLASS_DECLARATION(ompi_osc_rdma_pending_op_t);
196
197
198 struct ompi_osc_rdma_frag_t {
199 opal_free_list_item_t super;
200
201
202 opal_atomic_int32_t pending;
203 #if OPAL_HAVE_ATOMIC_MATH_64
204 opal_atomic_int64_t curr_index;
205 #else
206 opal_atomic_int32_t curr_index;
207 #endif
208
209 struct ompi_osc_rdma_module_t *module;
210 mca_btl_base_registration_handle_t *handle;
211 };
212 typedef struct ompi_osc_rdma_frag_t ompi_osc_rdma_frag_t;
213 OBJ_CLASS_DECLARATION(ompi_osc_rdma_frag_t);
214
215 #define OSC_RDMA_VERBOSE(x, ...) OPAL_OUTPUT_VERBOSE((x, ompi_osc_base_framework.framework_output, __VA_ARGS__))
216
217 #endif