Skip to content

Commit 1926f33

Browse files
committed
MPI_Testall: trigger progress if encountering an incomplete request and short-circuit
While iterating over the list of requests, the first incomplete request should trigger the progress engine. Subsequent incomplete encounters of incomplete requests allow us to short-circuit the iteration and return early. Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
1 parent 1deace1 commit 1926f33

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

ompi/request/req_test.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ int ompi_request_default_test_all(
202202
ompi_request_t **rptr;
203203
size_t num_completed = 0;
204204
ompi_request_t *request;
205+
int do_it_once = 0;
205206

206207
opal_atomic_mb();
207-
rptr = requests;
208-
for (i = 0; i < count; i++, rptr++) {
209-
request = *rptr;
208+
for (i = 0; i < count; i++) {
209+
request = requests[i];
210210

211-
if( request->req_state == OMPI_REQUEST_INACTIVE ||
212-
REQUEST_COMPLETE(request) ) {
211+
if( request->req_state == OMPI_REQUEST_INACTIVE || REQUEST_COMPLETE(request) ) {
213212
num_completed++;
213+
continue;
214214
}
215215
#if OPAL_ENABLE_FT_MPI
216216
/* Check for dead requests due to process failure */
@@ -225,13 +225,22 @@ int ompi_request_default_test_all(
225225
return MPI_ERR_PROC_FAILED_PENDING;
226226
}
227227
#endif /* OPAL_ENABLE_FT_MPI */
228+
#if OPAL_ENABLE_PROGRESS_THREADS == 0
229+
if (0 == do_it_once) {
230+
++do_it_once;
231+
if (0 != opal_progress()) {
232+
/* continue walking the list, retest the current request */
233+
--i;
234+
continue;
235+
}
236+
}
237+
#endif /* OPAL_ENABLE_PROGRESS_THREADS */
238+
/* short-circuit */
239+
break;
228240
}
229241

230242
if (num_completed != count) {
231243
*completed = false;
232-
#if OPAL_ENABLE_PROGRESS_THREADS == 0
233-
opal_progress();
234-
#endif
235244
return OMPI_SUCCESS;
236245
}
237246

0 commit comments

Comments
 (0)