1
1
This commit was SVN r3359.
Этот коммит содержится в:
Tim Woodall 2004-10-26 22:09:26 +00:00
родитель c99a202fa3
Коммит 1fe472dff0
3 изменённых файлов: 31 добавлений и 15 удалений

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

@ -16,6 +16,7 @@ int ompi_request_test_any(
ompi_status_public_t * status)
{
size_t i;
size_t num_requests_null_inactive = 0;
ompi_request_t **rptr;
ompi_request_t *request;
@ -23,8 +24,11 @@ int ompi_request_test_any(
rptr = requests;
for (i = 0; i < count; i++) {
request = *rptr;
if (request == MPI_REQUEST_NULL)
if (request == MPI_REQUEST_NULL ||
request->req_state == OMPI_REQUEST_INACTIVE) {
num_requests_null_inactive++;
continue;
}
if (request->req_complete) {
*index = i;
*completed = true;
@ -37,9 +41,8 @@ int ompi_request_test_any(
}
/* Only fall through here if we found nothing */
*index = MPI_UNDEFINED;
*completed = false;
*completed = (num_requests_null_inactive == count) ? true : false;
if (MPI_STATUS_IGNORE != status) {
*status = ompi_status_empty;
}
@ -74,13 +77,18 @@ int ompi_request_test_all(
}
*completed = true;
if (MPI_STATUS_IGNORE != statuses) {
if (MPI_STATUSES_IGNORE != statuses) {
/* fill out completion status and free request if required */
rptr = requests;
for (i = 0; i < count; i++) {
int rc;
request = *rptr;
if(request == MPI_REQUEST_NULL ||
request->req_state == OMPI_REQUEST_INACTIVE) {
statuses[i] = ompi_status_empty;
} else {
statuses[i] = request->req_status;
}
rc = request->req_fini(rptr);
if(rc != OMPI_SUCCESS)
return rc;

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

@ -16,7 +16,7 @@ int ompi_request_wait_any(
#if OMPI_HAVE_THREADS
int c;
#endif
size_t i, null_requests;
size_t i, num_requests_null_inactive;
int rc = OMPI_SUCCESS;
int completed = -1;
ompi_request_t **rptr;
@ -27,13 +27,13 @@ int ompi_request_wait_any(
ompi_atomic_mb();
for (c = 0; completed < 0 && c < ompi_request_poll_iterations; c++) {
rptr = requests;
null_requests = 0;
num_requests_null_inactive = 0;
for (i = 0; i < count; i++, rptr++) {
request = *rptr;
/* check for null or completed persistent request */
if (MPI_REQUEST_NULL == request ||
request->req_state == OMPI_REQUEST_INACTIVE) {
if(++null_requests == count)
if(++num_requests_null_inactive == count)
goto finished;
continue;
}
@ -50,13 +50,13 @@ int ompi_request_wait_any(
do {
ompi_request_waiting++;
rptr = requests;
null_requests = 0;
num_requests_null_inactive = 0;
for (i = 0; i < count; i++, rptr++) {
request = *rptr;
/* check for null or completed persistent request */
if (MPI_REQUEST_NULL == request ||
request->req_state == OMPI_REQUEST_INACTIVE) {
null_requests++;
num_requests_null_inactive++;
continue;
}
if (request->req_complete == true) {
@ -64,7 +64,7 @@ int ompi_request_wait_any(
break;
}
}
if(null_requests == count)
if(num_requests_null_inactive == count)
break;
if (completed < 0) {
ompi_condition_wait(&ompi_request_cond, &ompi_request_lock);
@ -75,15 +75,17 @@ int ompi_request_wait_any(
finished:
if(null_requests == count) {
if(num_requests_null_inactive == count) {
*index = MPI_UNDEFINED;
if (MPI_STATUS_IGNORE != status) {
*status = ompi_status_empty;
}
} else {
/* return status */
if (MPI_STATUS_IGNORE != status) {
*status = request->req_status;
}
/* return request to pool */
rc = request->req_fini(rptr);
*index = completed;
@ -137,13 +139,18 @@ int ompi_request_wait_all(
OMPI_THREAD_UNLOCK(&ompi_request_lock);
}
if (MPI_STATUS_IGNORE != statuses) {
if (MPI_STATUSES_IGNORE != statuses) {
/* fill out status and free request if required */
rptr = requests;
for (i = 0; i < count; i++) {
int rc;
request = *rptr;
if(request == MPI_REQUEST_NULL ||
request->req_state == OMPI_REQUEST_INACTIVE) {
statuses[i] = ompi_status_empty;
} else {
statuses[i] = request->req_status;
}
rc = request->req_fini(rptr);
rptr++;
}

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

@ -61,6 +61,7 @@ int ompi_request_init(void)
ompi_request_null.req_status.MPI_ERROR = MPI_SUCCESS;
ompi_request_null.req_status._count = 0;
ompi_request_null.req_state = OMPI_REQUEST_INACTIVE;
ompi_request_null.req_complete = true;
ompi_request_null.req_type = OMPI_REQUEST_NULL;
ompi_request_null.req_fini = ompi_request_null_free;