ompi_request_complete with signal
Rewrite the ompi_request_complete function to take in account the
with_signal argument. Change the comment to explain the expected
behavior.
Alter all the ompi_request_complete uses to make sure the status of the
request is set before calling ompi_request_complete.
bot🏷️enhancement
Этот коммит содержится в:
родитель
223d75595d
Коммит
50cec456fb
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2016 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
@ -233,9 +233,9 @@ int ompio_io_ompio_file_iread (mca_io_ompio_file_t *fh,
|
||||
ompio_req->req_ompi.req_state = OMPI_REQUEST_ACTIVE;
|
||||
|
||||
if ( 0 == count ) {
|
||||
ompi_request_complete (&ompio_req->req_ompi, 0);
|
||||
ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS;
|
||||
ompio_req->req_ompi.req_status._ucount = 0;
|
||||
ompi_request_complete (&ompio_req->req_ompi, false);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -299,9 +299,9 @@ int ompio_io_ompio_file_iread (mca_io_ompio_file_t *fh,
|
||||
ompi_status_public_t status;
|
||||
ret = ompio_io_ompio_file_read (fh, buf, count, datatype, &status);
|
||||
|
||||
ompi_request_complete (&ompio_req->req_ompi, 0);
|
||||
ompio_req->req_ompi.req_status.MPI_ERROR = ret;
|
||||
ompio_req->req_ompi.req_status._ucount = status._ucount;
|
||||
ompi_request_complete (&ompio_req->req_ompi, false);
|
||||
}
|
||||
|
||||
*request = (ompi_request_t *) ompio_req;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2016 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
@ -225,9 +225,9 @@ int ompio_io_ompio_file_iwrite (mca_io_ompio_file_t *fh,
|
||||
ompio_req->req_ompi.req_state = OMPI_REQUEST_ACTIVE;
|
||||
|
||||
if ( 0 == count ) {
|
||||
ompi_request_complete (&ompio_req->req_ompi, 0);
|
||||
ompio_req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS;
|
||||
ompio_req->req_ompi.req_status._ucount = 0;
|
||||
ompi_request_complete (&ompio_req->req_ompi, false);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -288,9 +288,9 @@ int ompio_io_ompio_file_iwrite (mca_io_ompio_file_t *fh,
|
||||
ompi_status_public_t status;
|
||||
ret = ompio_io_ompio_file_write(fh,buf,count,datatype, &status);
|
||||
|
||||
ompi_request_complete (&ompio_req->req_ompi, 0);
|
||||
ompio_req->req_ompi.req_status.MPI_ERROR = ret;
|
||||
ompio_req->req_ompi.req_status._ucount = status._ucount;
|
||||
ompi_request_complete (&ompio_req->req_ompi, false);
|
||||
}
|
||||
|
||||
*request = (ompi_request_t *) ompio_req;
|
||||
|
@ -85,7 +85,7 @@ int mca_io_ompio_component_progress ( void )
|
||||
if ( NULL != req->req_progress_fn ) {
|
||||
if ( req->req_progress_fn(req) ) {
|
||||
completed++;
|
||||
ompi_request_complete (&req->req_ompi, 1);
|
||||
ompi_request_complete (&req->req_ompi, true);
|
||||
/* The fbtl progress function is expected to set the
|
||||
* status elements
|
||||
*/
|
||||
|
@ -398,12 +398,16 @@ static inline void ompi_request_wait_completion(ompi_request_t *req)
|
||||
#endif
|
||||
/**
|
||||
* Signal or mark a request as complete. If with_signal is true this will
|
||||
* wake any thread pending on the request and ompi_request_lock should be
|
||||
* held while calling this function. If with_signal is false, there will
|
||||
* signal generated, and no lock required. This is a special case when
|
||||
* the function is called from the critical path for small messages, where
|
||||
* we know the current execution flow created the request, and is still
|
||||
* in the _START macro.
|
||||
* wake any thread pending on the request. If with_signal is false, the
|
||||
* opposite will be true, the request will simply be marked as completed
|
||||
* and no effort will be made to correctly (atomically) handle the associated
|
||||
* synchronization primitive. This is a special case when the function
|
||||
* is called from the critical path for small messages, where we know
|
||||
* the current execution flow created the request, and no synchronized wait
|
||||
* has been set.
|
||||
* BEWARE: The error code should be set on the request prior to calling
|
||||
* this function, or the synchronization primitive might not be correctly
|
||||
* triggered.
|
||||
*/
|
||||
static inline int ompi_request_complete(ompi_request_t* request, bool with_signal)
|
||||
{
|
||||
@ -412,6 +416,7 @@ static inline int ompi_request_complete(ompi_request_t* request, bool with_signa
|
||||
request->req_complete_cb = NULL;
|
||||
}
|
||||
|
||||
if( OPAL_LIKELY(with_signal) ) {
|
||||
if(!OPAL_ATOMIC_CMPSET_PTR(&request->req_complete, REQUEST_PENDING, REQUEST_COMPLETED)) {
|
||||
ompi_wait_sync_t *tmp_sync = (ompi_wait_sync_t *) OPAL_ATOMIC_SWP_PTR(&request->req_complete,
|
||||
REQUEST_COMPLETED);
|
||||
@ -419,6 +424,8 @@ static inline int ompi_request_complete(ompi_request_t* request, bool with_signa
|
||||
if( REQUEST_PENDING != tmp_sync )
|
||||
wait_sync_update(tmp_sync, 1, request->req_status.MPI_ERROR);
|
||||
}
|
||||
} else
|
||||
request->req_complete = REQUEST_COMPLETED;
|
||||
|
||||
if( OPAL_UNLIKELY(MPI_SUCCESS != request->req_status.MPI_ERROR) ) {
|
||||
ompi_request_failed++;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user