Skip to content

Commit efec44c

Browse files
committed
osc: Fix WIN_SHARED initialization
Fix WIN_SHARED initialization and error reporting by pushing the actual generation of MPI_ERR_RMA_SHARED errors until component selection (from component query). Components that don't do FLAVOR_SHARED should just return -1 for query. SM, since it should always work for FLAVOR_SHARED, will return a priority for component_query() for any FLAVOR_SHARED window, then will generate the MPI_ERR_RMA_SHARED error during component_select. Signed-off-by: Brian Barrett <[email protected]>
1 parent 4f42204 commit efec44c

File tree

4 files changed

+21
-31
lines changed

4 files changed

+21
-31
lines changed

ompi/mca/osc/base/osc_base_init.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ ompi_osc_base_select(ompi_win_t *win,
5757
priority = component->osc_query(win, base, size, disp_unit, comm,
5858
win->super.s_info, flavor);
5959
if (priority < 0) {
60-
if (MPI_WIN_FLAVOR_SHARED == flavor && OMPI_ERR_RMA_SHARED == priority) {
61-
/* NTH: quick fix to return OMPI_ERR_RMA_SHARED */
62-
return OMPI_ERR_RMA_SHARED;
63-
}
6460
continue;
6561
}
6662

ompi/mca/osc/monitoring/osc_monitoring_component.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ static int mca_osc_monitoring_component_select(struct ompi_win_t *win, void **ba
9090

9191
priority = component->osc_query(win, base, size, disp_unit, comm, info, flavor);
9292
if (priority < 0) {
93-
if (MPI_WIN_FLAVOR_SHARED == flavor && OMPI_ERR_RMA_SHARED == priority) {
94-
/* NTH: quick fix to return OMPI_ERR_RMA_SHARED */
95-
return OMPI_ERR_RMA_SHARED;
96-
}
9793
continue;
9894
}
9995

ompi/mca/osc/rdma/osc_rdma_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static int ompi_osc_rdma_component_query (struct ompi_win_t *win, void **base, s
383383
{
384384

385385
if (MPI_WIN_FLAVOR_SHARED == flavor) {
386-
return OMPI_ERR_RMA_SHARED;
386+
return -1;
387387
}
388388

389389
#if OPAL_CUDA_SUPPORT
@@ -403,7 +403,7 @@ static int ompi_osc_rdma_component_query (struct ompi_win_t *win, void **base, s
403403
return mca_osc_rdma_component.priority;
404404
}
405405

406-
return OMPI_ERROR;
406+
return -1;
407407
}
408408

409409
static int ompi_osc_rdma_initialize_region (ompi_osc_rdma_module_t *module, void **base, size_t size) {

ompi/mca/osc/sm/osc_sm_component.c

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -154,33 +154,29 @@ component_finalize(void)
154154
}
155155

156156

157-
static int
158-
check_win_ok(ompi_communicator_t *comm, int flavor)
159-
{
160-
if (! (MPI_WIN_FLAVOR_SHARED == flavor
161-
|| MPI_WIN_FLAVOR_ALLOCATE == flavor) ) {
162-
return OMPI_ERR_NOT_SUPPORTED;
163-
}
164-
165-
if (ompi_group_have_remote_peers (comm->c_local_group)) {
166-
return OMPI_ERR_RMA_SHARED;
167-
}
168-
169-
return OMPI_SUCCESS;
170-
}
171-
172-
173157
static int
174158
component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit,
175159
struct ompi_communicator_t *comm, struct opal_info_t *info,
176160
int flavor)
177161
{
178162
int ret;
179-
if (OMPI_SUCCESS != (ret = check_win_ok(comm, flavor))) {
180-
if (OMPI_ERR_NOT_SUPPORTED == ret) {
163+
164+
/* component only supports shared or allocate flavors */
165+
if (! (MPI_WIN_FLAVOR_SHARED == flavor ||
166+
MPI_WIN_FLAVOR_ALLOCATE == flavor)) {
167+
return -1;
168+
}
169+
170+
/* If flavor is win_allocate, we can't run if there are remote
171+
* peers in the group. The same check for flavor_shared happens
172+
* in select(), so that we can return an error to the user (since
173+
* we should be able to run for all flavor_shared use cases.
174+
* There's no way to return an error from component_query to the
175+
* user, hence the delayed check. */
176+
if (MPI_WIN_FLAVOR_ALLOCATE == flavor) {
177+
if (ompi_group_have_remote_peers(comm->c_local_group)) {
181178
return -1;
182179
}
183-
return ret;
184180
}
185181

186182
return 100;
@@ -198,8 +194,10 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
198194
int ret = OMPI_ERROR;
199195
size_t memory_alignment = OPAL_ALIGN_MIN;
200196

201-
if (OMPI_SUCCESS != (ret = check_win_ok(comm, flavor))) {
202-
return ret;
197+
assert(MPI_WIN_FLAVOR_SHARED == flavor || MPI_WIN_FLAVOR_ALLOCATE == flavor);
198+
199+
if (ompi_group_have_remote_peers(comm->c_local_group)) {
200+
return OMPI_ERR_RMA_SHARED;
203201
}
204202

205203
/* create module structure */

0 commit comments

Comments
 (0)