1
1
* For MPI_TEST, MPI_TESTANY, MPI_WAIT, and MPI_WAITANY (i.e., the
   TEST/WAIT functions that return up to exactly one completed
   request), return the actual error code.
 * For MPI_TESTALL, MPI_TESTSOME, MPI_WAITALL, MPI_WAITSOME, (i.e.,
   the TEST/WAIT functions that can return more than one completed
   request), return MPI_ERR_IN_STATUS.

This commit was SVN r12355.

The following Trac tickets were found above:
  Ticket 549 --> https://svn.open-mpi.org/trac/ompi/ticket/549
Этот коммит содержится в:
Jeff Squyres 2006-10-30 19:50:09 +00:00
родитель d66f7526fa
Коммит 0b2616173a
11 изменённых файлов: 40 добавлений и 24 удалений

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

@ -265,13 +265,28 @@ struct ompi_request_t;
/** /**
* Invoke an MPI exception on the first request found in the array * Invoke an MPI exception on the first request found in the array
* that has a non-MPI_SUCCESS value for MPI_ERROR in its status. * that has a non-MPI_SUCCESS value for MPI_ERROR in its status. It
* This function should not be invoked unless there is a request * is safe to invoke this function if none of the requests have an
* that is known to have a failure. * outstanding error; MPI_SUCCESS will be returned.
*
* If use_actual_err_code is true and at least one of the requests
* has a non-MPI_SUCCESS error code, the MPI exception will be
* invoked with that error code (to include MPI_ERRORS_RETURN,
* meaning that the actual error code will be returned out of the
* top-level MPI API function). If use_actual_err_code is false and
* at least one of the requests has a non-MPI_SUCCESS error code,
* the MPI exception will be invoked with MPI_ERR_IN_STATUS.
*
* It is expected that per MPI-1, MPI_TEST, MPI_TESTANY, MPI_WAIT,
* and MPI_WAITANY will invoke this function with
* (use_actual_err_code = true), and MPI_TESTALL, MPI_TESTSOME,
* MPI_WAITALL, and MPI_WAITSOME will invoke this function with
* (use_actual_err_code = false).
*/ */
int ompi_errhandler_request_invoke(int count, int ompi_errhandler_request_invoke(int count,
struct ompi_request_t **requests, struct ompi_request_t **requests,
const char *message); const char *message,
bool use_actual_err_code);
/** /**
* Create a ompi_errhandler_t * Create a ompi_errhandler_t

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

@ -79,9 +79,11 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
return err_code; return err_code;
} }
int ompi_errhandler_request_invoke(int count, int ompi_errhandler_request_invoke(int count,
struct ompi_request_t **requests, struct ompi_request_t **requests,
const char *message) const char *message,
bool use_actual_err_code)
{ {
int i, ec; int i, ec;
ompi_mpi_object_t mpi_object; ompi_mpi_object_t mpi_object;
@ -96,12 +98,16 @@ int ompi_errhandler_request_invoke(int count,
break; break;
} }
} }
/* This shouldn't happen */ /* If there were no errors, return SUCCESS */
if (i >= count) { if (i >= count) {
return MPI_SUCCESS; return MPI_SUCCESS;
} }
ec = ompi_errcode_get_mpi_code(requests[i]->req_status.MPI_ERROR); if (use_actual_err_code) {
ec = ompi_errcode_get_mpi_code(requests[i]->req_status.MPI_ERROR);
} else {
ec = MPI_ERR_IN_STATUS;
}
mpi_object = requests[i]->req_mpi_object; mpi_object = requests[i]->req_mpi_object;
switch (requests[i]->req_type) { switch (requests[i]->req_type) {
case OMPI_REQUEST_PML: case OMPI_REQUEST_PML:

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

@ -44,7 +44,8 @@ int MPI_Cancel(MPI_Request *request)
rc = MPI_SUCCESS; rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME); OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == request) { if (NULL == request) {
return ompi_errhandler_request_invoke(1, request, FUNC_NAME); OMPI_ERRHANDLER_RETURN(MPI_ERR_REQUEST, MPI_COMM_WORLD,
MPI_ERR_REQUEST, FUNC_NAME);
} }
} }
@ -52,6 +53,6 @@ int MPI_Cancel(MPI_Request *request)
return MPI_SUCCESS; return MPI_SUCCESS;
} }
rc = ompi_request_cancel(*request); rc = ompi_request_cancel(*request);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, "MPI_Cancel"); OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
} }

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

@ -57,6 +57,5 @@ int MPI_Test(MPI_Request *request, int *completed, MPI_Status *status)
if (OMPI_SUCCESS == rc) { if (OMPI_SUCCESS == rc) {
return MPI_SUCCESS; return MPI_SUCCESS;
} }
return ompi_errhandler_request_invoke(1, request, FUNC_NAME); return ompi_errhandler_request_invoke(1, request, FUNC_NAME, true);
} }

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

@ -45,10 +45,10 @@ int MPI_Testall(int count, MPI_Request requests[], int *flag,
} }
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME); OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
} }
if (OMPI_SUCCESS == ompi_request_test_all(count, requests, flag, if (OMPI_SUCCESS == ompi_request_test_all(count, requests, flag,
statuses)) { statuses)) {
return MPI_SUCCESS; return MPI_SUCCESS;
} }
return ompi_errhandler_request_invoke(count, requests, FUNC_NAME); return ompi_errhandler_request_invoke(count, requests, FUNC_NAME, false);
} }

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

@ -53,6 +53,5 @@ int MPI_Testany(int count, MPI_Request requests[], int *index, int *completed, M
index, completed, status)) { index, completed, status)) {
return MPI_SUCCESS; return MPI_SUCCESS;
} }
return ompi_errhandler_request_invoke(count, requests, FUNC_NAME); return ompi_errhandler_request_invoke(count, requests, FUNC_NAME, true);
} }

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

@ -55,5 +55,5 @@ int MPI_Testsome(int incount, MPI_Request *requests,
indices, statuses)) { indices, statuses)) {
return MPI_SUCCESS; return MPI_SUCCESS;
} }
return ompi_errhandler_request_invoke(incount, requests, FUNC_NAME); return ompi_errhandler_request_invoke(incount, requests, FUNC_NAME, false);
} }

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

@ -59,5 +59,5 @@ int MPI_Wait(MPI_Request *request, MPI_Status *status)
if (OMPI_SUCCESS == ompi_request_wait(request, status)) { if (OMPI_SUCCESS == ompi_request_wait(request, status)) {
return MPI_SUCCESS; return MPI_SUCCESS;
} }
return ompi_errhandler_request_invoke(1, request, FUNC_NAME); return ompi_errhandler_request_invoke(1, request, FUNC_NAME, true);
} }

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

@ -53,6 +53,5 @@ int MPI_Waitall(int count, MPI_Request *requests, MPI_Status *statuses)
if (OMPI_SUCCESS == ompi_request_wait_all(count, requests, statuses)) { if (OMPI_SUCCESS == ompi_request_wait_all(count, requests, statuses)) {
return MPI_SUCCESS; return MPI_SUCCESS;
} }
return ompi_errhandler_request_invoke(count, requests, FUNC_NAME); return ompi_errhandler_request_invoke(count, requests, FUNC_NAME, false);
} }

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

@ -51,10 +51,8 @@ int MPI_Waitany(int count, MPI_Request *requests, int *index, MPI_Status *status
} }
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME); OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
} }
if (OMPI_SUCCESS == ompi_request_wait_any(count, requests, index, status)) { if (OMPI_SUCCESS == ompi_request_wait_any(count, requests, index, status)) {
return MPI_SUCCESS; return MPI_SUCCESS;
} }
return ompi_errhandler_request_invoke(count, requests, FUNC_NAME); return ompi_errhandler_request_invoke(count, requests, FUNC_NAME, true);
} }

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

@ -56,6 +56,5 @@ int MPI_Waitsome(int incount, MPI_Request *requests,
outcount, indices, statuses )) { outcount, indices, statuses )) {
return MPI_SUCCESS; return MPI_SUCCESS;
} }
return ompi_errhandler_request_invoke(incount, requests, FUNC_NAME); return ompi_errhandler_request_invoke(incount, requests, FUNC_NAME, false);
} }