1
1

Merge pull request #7579 from devreal/progress-returns-v4.0.x

Harmonize return values of progress callbacks (v4.0.x)
Этот коммит содержится в:
Geoff Paulsen 2020-04-03 13:37:56 -05:00 коммит произвёл GitHub
родитель 978f340189 0425a7a7d8
Коммит b1eb3d7530
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 39 добавлений и 28 удалений

Просмотреть файл

@ -100,6 +100,7 @@ static int ompi_comm_request_progress (void)
{ {
ompi_comm_request_t *request, *next; ompi_comm_request_t *request, *next;
static int32_t progressing = 0; static int32_t progressing = 0;
int completed = 0;
/* don't allow re-entry */ /* don't allow re-entry */
if (opal_atomic_swap_32 (&progressing, 1)) { if (opal_atomic_swap_32 (&progressing, 1)) {
@ -121,6 +122,7 @@ static int ompi_comm_request_progress (void)
if( REQUEST_COMPLETE(subreq) ) { if( REQUEST_COMPLETE(subreq) ) {
ompi_request_free (&subreq); ompi_request_free (&subreq);
request_item->subreq_count--; request_item->subreq_count--;
completed++;
} else { } else {
item_complete = false; item_complete = false;
break; break;
@ -156,7 +158,7 @@ static int ompi_comm_request_progress (void)
opal_mutex_unlock (&ompi_comm_request_mutex); opal_mutex_unlock (&ompi_comm_request_mutex);
progressing = 0; progressing = 0;
return 1; return completed;
} }
void ompi_comm_request_start (ompi_comm_request_t *request) void ompi_comm_request_start (ompi_comm_request_t *request)

Просмотреть файл

@ -307,6 +307,7 @@ ompi_coll_libnbc_progress(void)
{ {
ompi_coll_libnbc_request_t* request, *next; ompi_coll_libnbc_request_t* request, *next;
int res; int res;
int completed = 0;
if (0 == opal_list_get_size (&mca_coll_libnbc_component.active_requests)) { if (0 == opal_list_get_size (&mca_coll_libnbc_component.active_requests)) {
/* no requests -- nothing to do. do not grab a lock */ /* no requests -- nothing to do. do not grab a lock */
@ -344,6 +345,7 @@ ompi_coll_libnbc_progress(void)
if(!request->super.super.req_persistent || !REQUEST_COMPLETE(&request->super.super)) { if(!request->super.super.req_persistent || !REQUEST_COMPLETE(&request->super.super)) {
ompi_request_complete(&request->super.super, true); ompi_request_complete(&request->super.super, true);
} }
completed++;
} }
OPAL_THREAD_LOCK(&mca_coll_libnbc_component.lock); OPAL_THREAD_LOCK(&mca_coll_libnbc_component.lock);
} }
@ -351,7 +353,7 @@ ompi_coll_libnbc_progress(void)
} }
OPAL_THREAD_UNLOCK(&mca_coll_libnbc_component.lock); OPAL_THREAD_UNLOCK(&mca_coll_libnbc_component.lock);
return 0; return completed;
} }

Просмотреть файл

@ -403,7 +403,7 @@ int ompi_mtl_psm2_progress( void ) {
mca_mtl_psm2_request_t* mtl_psm2_request; mca_mtl_psm2_request_t* mtl_psm2_request;
psm2_mq_status2_t psm2_status; psm2_mq_status2_t psm2_status;
psm2_mq_req_t req; psm2_mq_req_t req;
int completed = 1; int completed = 0;
do { do {
OPAL_THREAD_LOCK(&mtl_psm2_mq_mutex); OPAL_THREAD_LOCK(&mtl_psm2_mq_mutex);
@ -469,5 +469,5 @@ int ompi_mtl_psm2_progress( void ) {
opal_show_help("help-mtl-psm2.txt", opal_show_help("help-mtl-psm2.txt",
"error polling network", true, "error polling network", true,
psm2_error_get_string(err)); psm2_error_get_string(err));
return 1; return OMPI_ERROR;
} }

Просмотреть файл

@ -153,6 +153,7 @@ static int component_register (void)
static int component_progress (void) static int component_progress (void)
{ {
int completed = 0;
int pending_count = opal_list_get_size (&mca_osc_pt2pt_component.pending_operations); int pending_count = opal_list_get_size (&mca_osc_pt2pt_component.pending_operations);
int recv_count = opal_list_get_size (&mca_osc_pt2pt_component.pending_receives); int recv_count = opal_list_get_size (&mca_osc_pt2pt_component.pending_receives);
ompi_osc_pt2pt_pending_t *pending, *next; ompi_osc_pt2pt_pending_t *pending, *next;
@ -167,6 +168,7 @@ static int component_progress (void)
} }
(void) ompi_osc_pt2pt_process_receive (recv); (void) ompi_osc_pt2pt_process_receive (recv);
completed++;
} }
} }
@ -194,12 +196,13 @@ static int component_progress (void)
if (OMPI_SUCCESS == ret) { if (OMPI_SUCCESS == ret) {
opal_list_remove_item (&mca_osc_pt2pt_component.pending_operations, &pending->super); opal_list_remove_item (&mca_osc_pt2pt_component.pending_operations, &pending->super);
OBJ_RELEASE(pending); OBJ_RELEASE(pending);
completed++;
} }
} }
OPAL_THREAD_UNLOCK(&mca_osc_pt2pt_component.pending_operations_lock); OPAL_THREAD_UNLOCK(&mca_osc_pt2pt_component.pending_operations_lock);
} }
return 1; return completed;
} }
static int static int

Просмотреть файл

@ -512,8 +512,7 @@ int mca_pml_ucx_enable(bool enable)
int mca_pml_ucx_progress(void) int mca_pml_ucx_progress(void)
{ {
ucp_worker_progress(ompi_pml_ucx.ucp_worker); return ucp_worker_progress(ompi_pml_ucx.ucp_worker);
return OMPI_SUCCESS;
} }
int mca_pml_ucx_add_comm(struct ompi_communicator_t* comm) int mca_pml_ucx_add_comm(struct ompi_communicator_t* comm)

Просмотреть файл

@ -202,14 +202,13 @@ int ompi_grequest_invoke_query(ompi_request_t *request,
int rc = OMPI_SUCCESS; int rc = OMPI_SUCCESS;
ompi_grequest_t *g = (ompi_grequest_t*) request; ompi_grequest_t *g = (ompi_grequest_t*) request;
/* MPI-2:8.2 does not say what to do with the return value from /* MPI-3 mandates that the return value from the query function
the query function (i.e., the int return value from the C * (i.e., the int return value from the C function or the ierr
function or the ierr argument from the Fortran function). * argument from the Fortran function) must be returned to the
Making the command decision here to ignore it. If the handler * user. Thus, if the return of the query function is not MPI_SUCCESS
wants to pass an error back, it should set it in the MPI_ERROR * we will update the MPI_ERROR field. Otherwise, the MPI_ERROR
field in the status (which is always kept, regardless if the * field is untouched (or left to the discretion of the query function).
top-level function was invoked with MPI_STATUS[ES]_IGNORE or */
not). */
if (NULL != g->greq_query.c_query) { if (NULL != g->greq_query.c_query) {
if (g->greq_funcs_are_c) { if (g->greq_funcs_are_c) {
rc = g->greq_query.c_query(g->greq_state, status); rc = g->greq_query.c_query(g->greq_state, status);
@ -221,7 +220,9 @@ int ompi_grequest_invoke_query(ompi_request_t *request,
rc = OMPI_FINT_2_INT(ierr); rc = OMPI_FINT_2_INT(ierr);
} }
} }
if( MPI_SUCCESS != rc ) {
status->MPI_ERROR = rc;
}
return rc; return rc;
} }

Просмотреть файл

@ -34,6 +34,7 @@ static opal_mutex_t lock;
static int grequestx_progress(void) { static int grequestx_progress(void) {
ompi_grequest_t *request, *next; ompi_grequest_t *request, *next;
int completed = 0;
OPAL_THREAD_LOCK(&lock); OPAL_THREAD_LOCK(&lock);
if (!in_progress) { if (!in_progress) {
@ -43,18 +44,17 @@ static int grequestx_progress(void) {
MPI_Status status; MPI_Status status;
OPAL_THREAD_UNLOCK(&lock); OPAL_THREAD_UNLOCK(&lock);
request->greq_poll.c_poll(request->greq_state, &status); request->greq_poll.c_poll(request->greq_state, &status);
if (REQUEST_COMPLETE(&request->greq_base)) {
OPAL_THREAD_LOCK(&lock);
opal_list_remove_item(&requests, &request->greq_base.super.super);
OPAL_THREAD_UNLOCK(&lock);
}
OPAL_THREAD_LOCK(&lock); OPAL_THREAD_LOCK(&lock);
if (REQUEST_COMPLETE(&request->greq_base)) {
opal_list_remove_item(&requests, &request->greq_base.super.super);
completed++;
}
} }
in_progress = false; in_progress = false;
} }
OPAL_THREAD_UNLOCK(&lock); OPAL_THREAD_UNLOCK(&lock);
return OMPI_SUCCESS; return completed;
} }
int ompi_grequestx_start( int ompi_grequestx_start(

Просмотреть файл

@ -561,6 +561,7 @@ static int mca_btl_uct_tl_progress (mca_btl_uct_tl_t *tl, int starting_index)
static int mca_btl_uct_component_progress_pending (mca_btl_uct_module_t *uct_btl) static int mca_btl_uct_component_progress_pending (mca_btl_uct_module_t *uct_btl)
{ {
mca_btl_uct_base_frag_t *frag, *next; mca_btl_uct_base_frag_t *frag, *next;
int completed = 0;
size_t count; size_t count;
if (0 == (count = opal_list_get_size (&uct_btl->pending_frags))) { if (0 == (count = opal_list_get_size (&uct_btl->pending_frags))) {
@ -577,11 +578,13 @@ static int mca_btl_uct_component_progress_pending (mca_btl_uct_module_t *uct_btl
if (OPAL_SUCCESS > mca_btl_uct_send_frag (uct_btl, frag, false)) { if (OPAL_SUCCESS > mca_btl_uct_send_frag (uct_btl, frag, false)) {
opal_list_prepend (&uct_btl->pending_frags, (opal_list_item_t *) frag); opal_list_prepend (&uct_btl->pending_frags, (opal_list_item_t *) frag);
} else {
completed++;
} }
} }
OPAL_THREAD_UNLOCK(&uct_btl->lock); OPAL_THREAD_UNLOCK(&uct_btl->lock);
return OPAL_SUCCESS; return completed;
} }
/** /**

Просмотреть файл

@ -187,20 +187,21 @@ static int mca_spml_ucx_component_register(void)
int spml_ucx_ctx_progress(void) int spml_ucx_ctx_progress(void)
{ {
int i; int i, completed = 0;
for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) {
ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker[0]); completed += ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker[0]);
} }
return 1; return completed;
} }
int spml_ucx_default_progress(void) int spml_ucx_default_progress(void)
{ {
unsigned int i=0; unsigned int i=0;
int completed = 0;
for (i = 0; i < mca_spml_ucx.ucp_workers; i++) { for (i = 0; i < mca_spml_ucx.ucp_workers; i++) {
ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker[i]); completed += ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker[i]);
} }
return 1; return completed;
} }
int spml_ucx_progress_aux_ctx(void) int spml_ucx_progress_aux_ctx(void)