@@ -44,6 +44,13 @@ opal_pointer_array_t ompi_mpi_windows = {{0}};
4444
4545ompi_predefined_win_t ompi_mpi_win_null = {{{0 }}};
4646ompi_predefined_win_t * ompi_mpi_win_null_addr = & ompi_mpi_win_null ;
47+ mca_base_var_enum_t * ompi_win_accumulate_ops = NULL ;
48+
49+ static mca_base_var_enum_value_t accumulate_ops_values [] = {
50+ {.value = OMPI_WIN_ACCUMULATE_OPS_SAME_OP_NO_OP , .string = "same_op_no_op" ,},
51+ {.value = OMPI_WIN_ACCUMULATE_OPS_SAME_OP , .string = "same_op" ,},
52+ {.value = -1 , .string = NULL },
53+ };
4754
4855static void ompi_win_construct (ompi_win_t * win );
4956static void ompi_win_destruct (ompi_win_t * win );
@@ -54,6 +61,10 @@ OBJ_CLASS_INSTANCE(ompi_win_t, opal_object_t,
5461int
5562ompi_win_init (void )
5663{
64+ int ret ;
65+
66+ assert (sizeof (ompi_predefined_win_t ) >= sizeof (ompi_win_t ));
67+
5768 /* setup window Fortran array */
5869 OBJ_CONSTRUCT (& ompi_mpi_windows , opal_pointer_array_t );
5970 if ( OPAL_SUCCESS != opal_pointer_array_init (& ompi_mpi_windows , 0 ,
@@ -69,6 +80,11 @@ ompi_win_init(void)
6980 ompi_win_set_name (& ompi_mpi_win_null .win , "MPI_WIN_NULL" );
7081 opal_pointer_array_set_item (& ompi_mpi_windows , 0 , & ompi_mpi_win_null .win );
7182
83+ ret = mca_base_var_enum_create ("accumulate_ops" , accumulate_ops_values , & ompi_win_accumulate_ops );
84+ if (OPAL_SUCCESS != ret ) {
85+ return ret ;
86+ }
87+
7288 return OMPI_SUCCESS ;
7389}
7490
@@ -78,27 +94,42 @@ ompi_win_finalize(void)
7894{
7995 OBJ_DESTRUCT (& ompi_mpi_win_null .win );
8096 OBJ_DESTRUCT (& ompi_mpi_windows );
97+ OBJ_RELEASE (ompi_win_accumulate_ops );
8198
8299 return OMPI_SUCCESS ;
83100}
84101
85- static ompi_win_t *
86- alloc_window (struct ompi_communicator_t * comm )
102+ static int alloc_window (struct ompi_communicator_t * comm , ompi_info_t * info , ompi_win_t * * win_out )
87103{
88104 ompi_win_t * win ;
89105 ompi_group_t * group ;
106+ int acc_ops , flag , ret ;
90107
91108 /* create the object */
92109 win = OBJ_NEW (ompi_win_t );
93- if (NULL == win ) return NULL ;
110+ if (NULL == win ) {
111+ return OMPI_ERR_OUT_OF_RESOURCE ;
112+ }
113+
114+ ret = ompi_info_get_value_enum (info , "accumulate_ops" , & acc_ops ,
115+ OMPI_WIN_ACCUMULATE_OPS_SAME_OP_NO_OP ,
116+ ompi_win_accumulate_ops , & flag );
117+ if (OMPI_SUCCESS != ret ) {
118+ OBJ_RELEASE (win );
119+ return ret ;
120+ }
121+
122+ win -> w_acc_ops = acc_ops ;
94123
95124 /* setup data that is independent of osc component */
96125 group = comm -> c_local_group ;
97126 OBJ_RETAIN (group );
98127 ompi_group_increment_proc_count (group );
99128 win -> w_group = group ;
100129
101- return win ;
130+ * win_out = win ;
131+
132+ return OMPI_SUCCESS ;
102133}
103134
104135static int
@@ -148,8 +179,10 @@ ompi_win_create(void *base, size_t size,
148179 int model ;
149180 int ret ;
150181
151- win = alloc_window (comm );
152- if (NULL == win ) return OMPI_ERR_OUT_OF_RESOURCE ;
182+ ret = alloc_window (comm , info , & win );
183+ if (OMPI_SUCCESS != ret ) {
184+ return ret ;
185+ }
153186
154187 ret = ompi_osc_base_select (win , & base , size , disp_unit , comm , info , MPI_WIN_FLAVOR_CREATE , & model );
155188 if (OMPI_SUCCESS != ret ) {
@@ -178,8 +211,10 @@ ompi_win_allocate(size_t size, int disp_unit, ompi_info_t *info,
178211 int ret ;
179212 void * base ;
180213
181- win = alloc_window (comm );
182- if (NULL == win ) return OMPI_ERR_OUT_OF_RESOURCE ;
214+ ret = alloc_window (comm , info , & win );
215+ if (OMPI_SUCCESS != ret ) {
216+ return ret ;
217+ }
183218
184219 ret = ompi_osc_base_select (win , & base , size , disp_unit , comm , info , MPI_WIN_FLAVOR_ALLOCATE , & model );
185220 if (OMPI_SUCCESS != ret ) {
@@ -209,8 +244,10 @@ ompi_win_allocate_shared(size_t size, int disp_unit, ompi_info_t *info,
209244 int ret ;
210245 void * base ;
211246
212- win = alloc_window (comm );
213- if (NULL == win ) return OMPI_ERR_OUT_OF_RESOURCE ;
247+ ret = alloc_window (comm , info , & win );
248+ if (OMPI_SUCCESS != ret ) {
249+ return ret ;
250+ }
214251
215252 ret = ompi_osc_base_select (win , & base , size , disp_unit , comm , info , MPI_WIN_FLAVOR_SHARED , & model );
216253 if (OMPI_SUCCESS != ret ) {
@@ -238,8 +275,10 @@ ompi_win_create_dynamic(ompi_info_t *info, ompi_communicator_t *comm, ompi_win_t
238275 int model ;
239276 int ret ;
240277
241- win = alloc_window (comm );
242- if (NULL == win ) return OMPI_ERR_OUT_OF_RESOURCE ;
278+ ret = alloc_window (comm , info , & win );
279+ if (OMPI_SUCCESS != ret ) {
280+ return ret ;
281+ }
243282
244283 ret = ompi_osc_base_select (win , MPI_BOTTOM , 0 , 1 , comm , info , MPI_WIN_FLAVOR_DYNAMIC , & model );
245284 if (OMPI_SUCCESS != ret ) {
0 commit comments