Skip to content

osc/pt2pt multithread fixes #2615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ompi/mca/osc/pt2pt/osc_pt2pt.h
Original file line number Diff line number Diff line change
Expand Up @@ -912,11 +912,14 @@ static inline ompi_osc_pt2pt_sync_t *ompi_osc_pt2pt_module_sync_lookup (ompi_osc

return &module->all_sync;
case OMPI_OSC_PT2PT_SYNC_TYPE_PSCW:
OPAL_THREAD_LOCK(&module->all_sync.lock);
if (ompi_osc_pt2pt_sync_pscw_peer (module, target, peer)) {
OPAL_THREAD_UNLOCK(&module->all_sync.lock);
OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output,
"osc/pt2pt: found PSCW access epoch target for %d", target));
return &module->all_sync;
}
OPAL_THREAD_UNLOCK(&module->all_sync.lock);
}

return NULL;
Expand Down
7 changes: 5 additions & 2 deletions ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,11 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win)
ompi_osc_pt2pt_sync_t *sync = &module->all_sync;

OPAL_THREAD_LOCK(&module->lock);
OPAL_THREAD_LOCK(&sync->lock);

/* check if we are already in an access epoch */
if (ompi_osc_pt2pt_access_epoch_active (module)) {
OPAL_THREAD_UNLOCK(&sync->lock);
OPAL_THREAD_UNLOCK(&module->lock);
return OMPI_ERR_RMA_SYNC;
}
Expand Down Expand Up @@ -249,6 +251,7 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win)
if (0 == ompi_group_size (group)) {
/* nothing more to do. this is an empty start epoch */
sync->eager_send_active = true;
OPAL_THREAD_UNLOCK(&sync->lock);
OPAL_THREAD_UNLOCK(&module->lock);
return OMPI_SUCCESS;
}
Expand All @@ -258,12 +261,12 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win)
/* translate the group ranks into the communicator */
sync->peer_list.peers = ompi_osc_pt2pt_get_peers (module, group);
if (NULL == sync->peer_list.peers) {
OPAL_THREAD_UNLOCK(&sync->lock);
OPAL_THREAD_UNLOCK(&module->lock);
return OMPI_ERR_OUT_OF_RESOURCE;
}

if (!(assert & MPI_MODE_NOCHECK)) {
OPAL_THREAD_LOCK(&sync->lock);
for (int i = 0 ; i < sync->num_peers ; ++i) {
ompi_osc_pt2pt_peer_t *peer = sync->peer_list.peers[i];

Expand All @@ -276,7 +279,6 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win)
ompi_osc_pt2pt_peer_set_unex (peer, false);
}
}
OPAL_THREAD_UNLOCK(&sync->lock);
} else {
sync->sync_expected = 0;
}
Expand All @@ -295,6 +297,7 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win)
"ompi_osc_pt2pt_start complete. eager sends active: %d",
sync->eager_send_active));

OPAL_THREAD_UNLOCK(&sync->lock);
OPAL_THREAD_UNLOCK(&module->lock);
return OMPI_SUCCESS;
}
Expand Down
4 changes: 3 additions & 1 deletion ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,9 @@ static int ompi_osc_pt2pt_acc_op_queue (ompi_osc_pt2pt_module_t *module, ompi_os
}

/* add to the pending acc queue */
OPAL_THREAD_SCOPED_LOCK(&module->lock, opal_list_append (&module->pending_acc, &pending_acc->super));
ompi_osc_pt2pt_accumulate_lock(module);
opal_list_append (&module->pending_acc, &pending_acc->super);
ompi_osc_pt2pt_accumulate_unlock(module);

return OMPI_SUCCESS;
}
Expand Down