Skip to content

Commit 5126da5

Browse files
committed
win: add support for accumulate_ordering info key
This commit adds support for the MPI-3.1 accumulate_ordering info key. The default value is rar,war,raw,waw and is supported using an MCA variable flag enumerator. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent b7928c2 commit 5126da5

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

ompi/win/win.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,24 @@ opal_pointer_array_t ompi_mpi_windows = {{0}};
4646
ompi_predefined_win_t ompi_mpi_win_null = {{{0}}};
4747
ompi_predefined_win_t *ompi_mpi_win_null_addr = &ompi_mpi_win_null;
4848
mca_base_var_enum_t *ompi_win_accumulate_ops = NULL;
49+
mca_base_var_enum_t *ompi_win_accumulate_order = NULL;
4950

5051
static mca_base_var_enum_value_t accumulate_ops_values[] = {
5152
{.value = OMPI_WIN_ACCUMULATE_OPS_SAME_OP_NO_OP, .string = "same_op_no_op",},
5253
{.value = OMPI_WIN_ACCUMULATE_OPS_SAME_OP, .string = "same_op",},
5354
{.value = -1, .string = NULL},
5455
};
5556

57+
static mca_base_var_enum_value_flag_t accumulate_order_flags[] = {
58+
{.flag = OMPI_WIN_ACC_ORDER_NONE, .string = "none", .conflicting_flag = OMPI_WIN_ACC_ORDER_RAR |
59+
OMPI_WIN_ACC_ORDER_WAR | OMPI_WIN_ACC_ORDER_RAW | OMPI_WIN_ACC_ORDER_WAW},
60+
{.flag = OMPI_WIN_ACC_ORDER_RAR, .string = "rar", .conflicting_flag = OMPI_WIN_ACC_ORDER_NONE},
61+
{.flag = OMPI_WIN_ACC_ORDER_WAR, .string = "war", .conflicting_flag = OMPI_WIN_ACC_ORDER_NONE},
62+
{.flag = OMPI_WIN_ACC_ORDER_RAW, .string = "raw", .conflicting_flag = OMPI_WIN_ACC_ORDER_NONE},
63+
{.flag = OMPI_WIN_ACC_ORDER_WAW, .string = "waw", .conflicting_flag = OMPI_WIN_ACC_ORDER_NONE},
64+
{},
65+
};
66+
5667
static void ompi_win_construct(ompi_win_t *win);
5768
static void ompi_win_destruct(ompi_win_t *win);
5869

@@ -86,6 +97,11 @@ ompi_win_init(void)
8697
return ret;
8798
}
8899

100+
ret = mca_base_var_enum_create_flag ("accumulate_order", accumulate_order_flags, &ompi_win_accumulate_order);
101+
if (OPAL_SUCCESS != ret) {
102+
return ret;
103+
}
104+
89105
return OMPI_SUCCESS;
90106
}
91107

@@ -115,6 +131,7 @@ int ompi_win_finalize(void)
115131
OBJ_DESTRUCT(&ompi_mpi_win_null.win);
116132
OBJ_DESTRUCT(&ompi_mpi_windows);
117133
OBJ_RELEASE(ompi_win_accumulate_ops);
134+
OBJ_RELEASE(ompi_win_accumulate_order);
118135

119136
return OMPI_SUCCESS;
120137
}
@@ -123,7 +140,7 @@ static int alloc_window(struct ompi_communicator_t *comm, ompi_info_t *info, int
123140
{
124141
ompi_win_t *win;
125142
ompi_group_t *group;
126-
int acc_ops, flag, ret;
143+
int acc_ops, acc_order, flag, ret;
127144

128145
/* create the object */
129146
win = OBJ_NEW(ompi_win_t);
@@ -140,6 +157,18 @@ static int alloc_window(struct ompi_communicator_t *comm, ompi_info_t *info, int
140157
}
141158

142159
win->w_acc_ops = (ompi_win_accumulate_ops_t)acc_ops;
160+
161+
ret = ompi_info_get_value_enum (info, "accumulate_order", &acc_order,
162+
OMPI_WIN_ACC_ORDER_RAR | OMPI_WIN_ACC_ORDER_WAR |
163+
OMPI_WIN_ACC_ORDER_RAW | OMPI_WIN_ACC_ORDER_WAW,
164+
ompi_win_accumulate_order, &flag);
165+
if (OMPI_SUCCESS != ret) {
166+
OBJ_RELEASE(win);
167+
return ret;
168+
}
169+
170+
win->w_acc_order = acc_order;
171+
143172
win->w_flavor = flavor;
144173

145174
/* setup data that is independent of osc component */

ompi/win/win.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,25 @@ enum ompi_win_accumulate_ops_t {
5050
};
5151
typedef enum ompi_win_accumulate_ops_t ompi_win_accumulate_ops_t;
5252

53+
/**
54+
* Accumulate ordering flags. The default accumulate ordering in
55+
* MPI-3.1 is rar,war,raw,waw.
56+
*/
57+
enum ompi_win_accumulate_order_flags_t {
58+
/** no accumulate ordering (may valid with any other flag) */
59+
OMPI_WIN_ACC_ORDER_NONE = 0x01,
60+
/** read-after-read ordering */
61+
OMPI_WIN_ACC_ORDER_RAR = 0x02,
62+
/** write-after-read ordering */
63+
OMPI_WIN_ACC_ORDER_WAR = 0x04,
64+
/** read-after-write ordering */
65+
OMPI_WIN_ACC_ORDER_RAW = 0x08,
66+
/** write-after-write ordering */
67+
OMPI_WIN_ACC_ORDER_WAW = 0x10,
68+
};
69+
5370
OMPI_DECLSPEC extern mca_base_var_enum_t *ompi_win_accumulate_ops;
71+
OMPI_DECLSPEC extern mca_base_var_enum_t *ompi_win_accumulate_order;
5472

5573
OMPI_DECLSPEC extern opal_pointer_array_t ompi_mpi_windows;
5674

@@ -87,6 +105,9 @@ struct ompi_win_t {
87105

88106
/* one sided interface */
89107
ompi_osc_base_module_t *w_osc_module;
108+
109+
/** Accumulate ordering (see ompi_win_accumulate_order_flags_t above) */
110+
int32_t w_acc_order;
90111
};
91112
typedef struct ompi_win_t ompi_win_t;
92113
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_win_t);

0 commit comments

Comments
 (0)