Skip to content

Commit 4be483e

Browse files
authored
Merge pull request #8 from joe-explr/notified-rma-sm
OMPI: Notified-OSC-SM Operations
2 parents 67d84b4 + 50f1ba0 commit 4be483e

4 files changed

Lines changed: 217 additions & 5 deletions

File tree

ompi/mca/osc/osc.h

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,15 @@ typedef int (*ompi_osc_base_module_put_fn_t)(const void *origin_addr,
216216
struct ompi_datatype_t *target_dt,
217217
struct ompi_win_t *win);
218218

219+
typedef int (*ompi_osc_base_module_put_with_notify_fn_t)(const void *origin_addr,
220+
size_t origin_count,
221+
struct ompi_datatype_t *origin_dt,
222+
int target,
223+
ptrdiff_t target_disp,
224+
size_t target_count,
225+
struct ompi_datatype_t *target_dt,
226+
int notify,
227+
struct ompi_win_t *win);
219228

220229
typedef int (*ompi_osc_base_module_get_fn_t)(void *origin_addr,
221230
size_t origin_count,
@@ -226,6 +235,15 @@ typedef int (*ompi_osc_base_module_get_fn_t)(void *origin_addr,
226235
struct ompi_datatype_t *target_dt,
227236
struct ompi_win_t *win);
228237

238+
typedef int (*ompi_osc_base_module_get_with_notify_fn_t)(void *origin_addr,
239+
size_t origin_count,
240+
struct ompi_datatype_t *origin_dt,
241+
int target,
242+
ptrdiff_t target_disp,
243+
size_t target_count,
244+
struct ompi_datatype_t *target_dt,
245+
int notify,
246+
struct ompi_win_t *win);
229247

230248
typedef int (*ompi_osc_base_module_accumulate_fn_t)(const void *origin_addr,
231249
size_t origin_count,
@@ -276,6 +294,17 @@ typedef int (*ompi_osc_base_module_rput_fn_t)(const void *origin_addr,
276294
struct ompi_win_t *win,
277295
struct ompi_request_t **request);
278296

297+
typedef int (*ompi_osc_base_module_rput_with_notify_fn_t)(const void *origin_addr,
298+
size_t origin_count,
299+
struct ompi_datatype_t *origin_dt,
300+
int target,
301+
ptrdiff_t target_disp,
302+
size_t target_count,
303+
struct ompi_datatype_t *target_dt,
304+
int notify,
305+
struct ompi_win_t *win,
306+
struct ompi_request_t **request);
307+
279308
typedef int (*ompi_osc_base_module_rget_fn_t)(void *origin_addr,
280309
size_t origin_count,
281310
struct ompi_datatype_t *origin_dt,
@@ -286,6 +315,16 @@ typedef int (*ompi_osc_base_module_rget_fn_t)(void *origin_addr,
286315
struct ompi_win_t *win,
287316
struct ompi_request_t **request);
288317

318+
typedef int (*ompi_osc_base_module_rget_with_notify_fn_t)(void *origin_addr,
319+
size_t origin_count,
320+
struct ompi_datatype_t *origin_dt,
321+
int target,
322+
ptrdiff_t target_disp,
323+
size_t target_count,
324+
struct ompi_datatype_t *target_dt,
325+
int notify,
326+
struct ompi_win_t *win,
327+
struct ompi_request_t **request);
289328

290329
typedef int (*ompi_osc_base_module_raccumulate_fn_t)(const void *origin_addr,
291330
size_t origin_count,
@@ -371,7 +410,6 @@ typedef int (*ompi_osc_base_module_flush_local_all_fn_t)(struct ompi_win_t *win)
371410
* module structure.
372411
*/
373412

374-
// TODO: extend the struct and add pointers to put/get_with_notify functions
375413
struct ompi_osc_base_module_4_0_0_t {
376414
ompi_osc_base_module_win_shared_query_fn_t osc_win_shared_query;
377415

@@ -380,14 +418,18 @@ struct ompi_osc_base_module_4_0_0_t {
380418
ompi_osc_base_module_free_fn_t osc_free;
381419

382420
ompi_osc_base_module_put_fn_t osc_put;
421+
ompi_osc_base_module_put_with_notify_fn_t osc_put_with_notify;
383422
ompi_osc_base_module_get_fn_t osc_get;
423+
ompi_osc_base_module_get_with_notify_fn_t osc_get_with_notify;
384424
ompi_osc_base_module_accumulate_fn_t osc_accumulate;
385425
ompi_osc_base_module_compare_and_swap_fn_t osc_compare_and_swap;
386426
ompi_osc_base_module_fetch_and_op_fn_t osc_fetch_and_op;
387427
ompi_osc_base_module_get_accumulate_fn_t osc_get_accumulate;
388428

389429
ompi_osc_base_module_rput_fn_t osc_rput;
430+
ompi_osc_base_module_rput_with_notify_fn_t osc_rput_with_notify;
390431
ompi_osc_base_module_rget_fn_t osc_rget;
432+
ompi_osc_base_module_rget_with_notify_fn_t osc_rget_with_notify;
391433
ompi_osc_base_module_raccumulate_fn_t osc_raccumulate;
392434
ompi_osc_base_module_rget_accumulate_fn_t osc_rget_accumulate;
393435

ompi/mca/osc/sm/osc_sm.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@ int ompi_osc_sm_put(const void *origin_addr,
118118
struct ompi_datatype_t *target_dt,
119119
struct ompi_win_t *win);
120120

121+
int ompi_osc_sm_put_with_notify(const void *origin_addr,
122+
size_t origin_count,
123+
struct ompi_datatype_t *origin_dt,
124+
int target,
125+
ptrdiff_t target_disp,
126+
size_t target_count,
127+
struct ompi_datatype_t *target_dt,
128+
int notify,
129+
struct ompi_win_t *win);
130+
121131
int ompi_osc_sm_get(void *origin_addr,
122132
size_t origin_count,
123133
struct ompi_datatype_t *origin_dt,
@@ -127,6 +137,16 @@ int ompi_osc_sm_get(void *origin_addr,
127137
struct ompi_datatype_t *target_dt,
128138
struct ompi_win_t *win);
129139

140+
int ompi_osc_sm_get_with_notify(void *origin_addr,
141+
size_t origin_count,
142+
struct ompi_datatype_t *origin_dt,
143+
int target,
144+
ptrdiff_t target_disp,
145+
size_t target_count,
146+
struct ompi_datatype_t *target_dt,
147+
int notify,
148+
struct ompi_win_t *win);
149+
130150
int ompi_osc_sm_accumulate(const void *origin_addr,
131151
size_t origin_count,
132152
struct ompi_datatype_t *origin_dt,
@@ -176,6 +196,17 @@ int ompi_osc_sm_rput(const void *origin_addr,
176196
struct ompi_win_t *win,
177197
struct ompi_request_t **request);
178198

199+
int ompi_osc_sm_rput_with_notify(const void *origin_addr,
200+
size_t origin_count,
201+
struct ompi_datatype_t *origin_dt,
202+
int target,
203+
ptrdiff_t target_disp,
204+
size_t target_count,
205+
struct ompi_datatype_t *target_dt,
206+
int notify,
207+
struct ompi_win_t *win,
208+
struct ompi_request_t **request);
209+
179210
int ompi_osc_sm_rget(void *origin_addr,
180211
size_t origin_count,
181212
struct ompi_datatype_t *origin_dt,
@@ -186,6 +217,17 @@ int ompi_osc_sm_rget(void *origin_addr,
186217
struct ompi_win_t *win,
187218
struct ompi_request_t **request);
188219

220+
int ompi_osc_sm_rget_with_notify(void *origin_addr,
221+
size_t origin_count,
222+
struct ompi_datatype_t *origin_dt,
223+
int target,
224+
ptrdiff_t target_disp,
225+
size_t target_count,
226+
struct ompi_datatype_t *target_dt,
227+
int notify,
228+
struct ompi_win_t *win,
229+
struct ompi_request_t **request);
230+
189231
int ompi_osc_sm_raccumulate(const void *origin_addr,
190232
size_t origin_count,
191233
struct ompi_datatype_t *origin_dt,

ompi/mca/osc/sm/osc_sm_comm.c

Lines changed: 128 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,49 @@ ompi_osc_sm_rput(const void *origin_addr,
5959
return OMPI_SUCCESS;
6060
}
6161

62+
int
63+
ompi_osc_sm_rput_with_notify(const void *origin_addr,
64+
size_t origin_count,
65+
struct ompi_datatype_t *origin_dt,
66+
int target,
67+
ptrdiff_t target_disp,
68+
size_t target_count,
69+
struct ompi_datatype_t *target_dt,
70+
int notify,
71+
struct ompi_win_t *win,
72+
struct ompi_request_t **ompi_req)
73+
{
74+
int ret;
75+
ompi_osc_sm_module_t *module =
76+
(ompi_osc_sm_module_t*) win->w_osc_module;
77+
void *remote_address;
78+
79+
OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output,
80+
"rput_notify: 0x%lx, %zu, %s, %d, %d, %zu, %s, %d, 0x%lx",
81+
(unsigned long) origin_addr, origin_count,
82+
origin_dt->name, target, (int) target_disp,
83+
target_count, target_dt->name,
84+
notify,
85+
(unsigned long) win));
86+
87+
remote_address = ((char*) (module->bases[target])) + module->disp_units[target] * target_disp;
88+
89+
ret = ompi_datatype_sndrcv((void *)origin_addr, origin_count, origin_dt,
90+
remote_address, target_count, target_dt);
91+
if (OMPI_SUCCESS != ret) {
92+
return ret;
93+
}
94+
95+
/* the only valid field of RMA request status is the MPI_ERROR field.
96+
* ompi_request_empty has status MPI_SUCCESS and indicates the request is
97+
* complete. */
98+
*ompi_req = &ompi_request_empty;
99+
100+
opal_atomic_wmb();
101+
opal_atomic_add(&module->notify_counters[target][notify], 1);
102+
103+
return OMPI_SUCCESS;
104+
}
62105

63106
int
64107
ompi_osc_sm_rget(void *origin_addr,
@@ -99,6 +142,49 @@ ompi_osc_sm_rget(void *origin_addr,
99142
return OMPI_SUCCESS;
100143
}
101144

145+
int
146+
ompi_osc_sm_rget_with_notify(void *origin_addr,
147+
size_t origin_count,
148+
struct ompi_datatype_t *origin_dt,
149+
int target,
150+
ptrdiff_t target_disp,
151+
size_t target_count,
152+
struct ompi_datatype_t *target_dt,
153+
int notify,
154+
struct ompi_win_t *win,
155+
struct ompi_request_t **ompi_req)
156+
{
157+
int ret;
158+
ompi_osc_sm_module_t *module =
159+
(ompi_osc_sm_module_t*) win->w_osc_module;
160+
void *remote_address;
161+
162+
OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output,
163+
"rget_notify: 0x%lx, %zu, %s, %d, %d, %zu, %s, %d, 0x%lx",
164+
(unsigned long) origin_addr, origin_count,
165+
origin_dt->name, target, (int) target_disp,
166+
target_count, target_dt->name,
167+
notify,
168+
(unsigned long) win));
169+
170+
remote_address = ((char*) (module->bases[target])) + module->disp_units[target] * target_disp;
171+
172+
ret = ompi_datatype_sndrcv(remote_address, target_count, target_dt,
173+
origin_addr, origin_count, origin_dt);
174+
if (OMPI_SUCCESS != ret) {
175+
return ret;
176+
}
177+
178+
/* the only valid field of RMA request status is the MPI_ERROR field.
179+
* ompi_request_empty has status MPI_SUCCESS and indicates the request is
180+
* complete. */
181+
*ompi_req = &ompi_request_empty;
182+
183+
opal_atomic_rmb();
184+
opal_atomic_add(&module->notify_counters[target][notify], 1);
185+
186+
return OMPI_SUCCESS;
187+
}
102188

103189
int
104190
ompi_osc_sm_raccumulate(const void *origin_addr,
@@ -236,6 +322,44 @@ ompi_osc_sm_put(const void *origin_addr,
236322
}
237323

238324

325+
int
326+
ompi_osc_sm_put_with_notify(const void *origin_addr,
327+
size_t origin_count,
328+
struct ompi_datatype_t *origin_dt,
329+
int target,
330+
ptrdiff_t target_disp,
331+
size_t target_count,
332+
struct ompi_datatype_t *target_dt,
333+
int notify,
334+
struct ompi_win_t *win)
335+
{
336+
int ret;
337+
ompi_osc_sm_module_t *module =
338+
(ompi_osc_sm_module_t*) win->w_osc_module;
339+
void *remote_address;
340+
341+
OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output,
342+
"put_notify: 0x%lx, %zu, %s, %d, %d, %zu, %s, %d, 0x%lx",
343+
(unsigned long) origin_addr, origin_count,
344+
origin_dt->name, target, (int) target_disp,
345+
target_count, target_dt->name,
346+
notify,
347+
(unsigned long) win));
348+
349+
remote_address = ((char*) (module->bases[target])) + module->disp_units[target] * target_disp;
350+
351+
ret = ompi_datatype_sndrcv((void *)origin_addr, origin_count, origin_dt,
352+
remote_address, target_count, target_dt);
353+
if (OMPI_SUCCESS != ret) {
354+
return ret;
355+
}
356+
357+
opal_atomic_wmb();
358+
opal_atomic_add(&module->notify_counters[target][notify], 1);
359+
360+
return ret;
361+
}
362+
239363
int
240364
ompi_osc_sm_get(void *origin_addr,
241365
size_t origin_count,
@@ -294,7 +418,9 @@ ompi_osc_sm_get_with_notify(void *origin_addr,
294418

295419
ret = ompi_datatype_sndrcv(remote_address, target_count, target_dt,
296420
origin_addr, origin_count, origin_dt);
297-
// TODO: do the same for put_with_notify
421+
if (OMPI_SUCCESS != ret) {
422+
return ret;
423+
}
298424
opal_atomic_rmb();
299425
opal_atomic_add(&module->notify_counters[target][notify], 1);
300426

@@ -472,5 +598,5 @@ ompi_osc_sm_fetch_and_op(const void *origin_addr,
472598
done:
473599
opal_atomic_unlock(&module->node_states[target].accumulate_lock);
474600

475-
return OMPI_SUCCESS;;
601+
return OMPI_SUCCESS;
476602
}

ompi/mca/osc/sm/osc_sm_component.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ ompi_osc_sm_component_t mca_osc_sm_component = {
7070
MCA_BASE_COMPONENT_INIT(ompi, osc, sm)
7171

7272

73-
// TODO: extend the struct and add pointers to put/get_with_notify functions
74-
// TODO: extend it to rput/rget_with_notify as well
7573
ompi_osc_sm_module_t ompi_osc_sm_module_template = {
7674
{
7775
.osc_win_shared_query = ompi_osc_sm_shared_query,
@@ -81,14 +79,18 @@ ompi_osc_sm_module_t ompi_osc_sm_module_template = {
8179
.osc_free = ompi_osc_sm_free,
8280

8381
.osc_put = ompi_osc_sm_put,
82+
.osc_put_with_notify = ompi_osc_sm_put_with_notify,
8483
.osc_get = ompi_osc_sm_get,
84+
.osc_get_with_notify = ompi_osc_sm_get_with_notify,
8585
.osc_accumulate = ompi_osc_sm_accumulate,
8686
.osc_compare_and_swap = ompi_osc_sm_compare_and_swap,
8787
.osc_fetch_and_op = ompi_osc_sm_fetch_and_op,
8888
.osc_get_accumulate = ompi_osc_sm_get_accumulate,
8989

9090
.osc_rput = ompi_osc_sm_rput,
91+
.osc_rput_with_notify = ompi_osc_sm_rput_with_notify,
9192
.osc_rget = ompi_osc_sm_rget,
93+
.osc_rget_with_notify = ompi_osc_sm_rget_with_notify,
9294
.osc_raccumulate = ompi_osc_sm_raccumulate,
9395
.osc_rget_accumulate = ompi_osc_sm_rget_accumulate,
9496

0 commit comments

Comments
 (0)