Skip to content

Commit 7bd7c05

Browse files
authored
Merge pull request #1807 from hjelmn/request_perfm_regression
ompi/request: fix performance regression
2 parents 8b7d81d + 544adb9 commit 7bd7c05

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

ompi/request/request.h

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -375,27 +375,25 @@ static inline int ompi_request_free(ompi_request_t** request)
375375
* Wait a particular request for completion
376376
*/
377377

378-
#if OPAL_ENABLE_MULTI_THREADS
379378
static inline void ompi_request_wait_completion(ompi_request_t *req)
380379
{
381-
ompi_wait_sync_t sync;
382-
WAIT_SYNC_INIT(&sync, 1);
380+
if (opal_using_threads ()) {
381+
ompi_wait_sync_t sync;
382+
WAIT_SYNC_INIT(&sync, 1);
383383

384-
if(OPAL_ATOMIC_CMPSET_PTR(&req->req_complete, REQUEST_PENDING, &sync)) {
385-
SYNC_WAIT(&sync);
386-
}
384+
if(OPAL_ATOMIC_CMPSET_PTR(&req->req_complete, REQUEST_PENDING, &sync)) {
385+
SYNC_WAIT(&sync);
386+
}
387387

388-
assert(REQUEST_COMPLETE(req));
389-
WAIT_SYNC_RELEASE(&sync);
390-
}
391-
#else
392-
static inline void ompi_request_wait_completion(ompi_request_t *req)
393-
{
394-
while(!REQUEST_COMPLETE(req)) {
395-
opal_progress();
388+
assert(REQUEST_COMPLETE(req));
389+
WAIT_SYNC_RELEASE(&sync);
390+
} else {
391+
while(!REQUEST_COMPLETE(req)) {
392+
opal_progress();
393+
}
396394
}
397395
}
398-
#endif
396+
399397
/**
400398
* Signal or mark a request as complete. If with_signal is true this will
401399
* wake any thread pending on the request. If with_signal is false, the

0 commit comments

Comments
 (0)