Skip to content

Commit cd41c37

Browse files
devrealawlauria
authored andcommitted
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> (cherry picked from commit 1926f33)
1 parent 09ec041 commit cd41c37

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
@@ -184,15 +184,15 @@ int ompi_request_default_test_all(
184184
ompi_request_t **rptr;
185185
size_t num_completed = 0;
186186
ompi_request_t *request;
187+
int do_it_once = 0;
187188

188189
opal_atomic_mb();
189-
rptr = requests;
190-
for (i = 0; i < count; i++, rptr++) {
191-
request = *rptr;
190+
for (i = 0; i < count; i++) {
191+
request = requests[i];
192192

193-
if( request->req_state == OMPI_REQUEST_INACTIVE ||
194-
REQUEST_COMPLETE(request) ) {
193+
if( request->req_state == OMPI_REQUEST_INACTIVE || REQUEST_COMPLETE(request) ) {
195194
num_completed++;
195+
continue;
196196
}
197197
#if OPAL_ENABLE_FT_MPI
198198
/* Check for dead requests due to process failure */
@@ -207,13 +207,22 @@ int ompi_request_default_test_all(
207207
return MPI_ERR_PROC_FAILED_PENDING;
208208
}
209209
#endif /* OPAL_ENABLE_FT_MPI */
210+
#if OPAL_ENABLE_PROGRESS_THREADS == 0
211+
if (0 == do_it_once) {
212+
++do_it_once;
213+
if (0 != opal_progress()) {
214+
/* continue walking the list, retest the current request */
215+
--i;
216+
continue;
217+
}
218+
}
219+
#endif /* OPAL_ENABLE_PROGRESS_THREADS */
220+
/* short-circuit */
221+
break;
210222
}
211223

212224
if (num_completed != count) {
213225
*completed = false;
214-
#if OPAL_ENABLE_PROGRESS_THREADS == 0
215-
opal_progress();
216-
#endif
217226
return OMPI_SUCCESS;
218227
}
219228

0 commit comments

Comments
 (0)