Skip to content

Commit

Permalink
added mpi_request_null checks for test_/wait_xxx
Browse files Browse the repository at this point in the history
Signed-off-by: HawkmoonEternal <domi.huber@tum.de>
  • Loading branch information
HawkmoonEternal committed May 6, 2024
1 parent 4890203 commit 1994c3b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
2 changes: 2 additions & 0 deletions ompi/mpi/c/testall.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ int MPI_Testall(int count, MPI_Request requests[], int *flag,
}
if (&ompi_request_empty == requests[i]) {
continue;
} else if (&ompi_request_null == requests[i]) {
continue;
} else if (NULL == requests[i]->req_mpi_object.comm) {
continue;
} else if (NULL == check_req) {
Expand Down
2 changes: 2 additions & 0 deletions ompi/mpi/c/testany.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ int MPI_Testany(int count, MPI_Request requests[], int *indx, int *completed, MP
}
if (&ompi_request_empty == requests[i]) {
continue;
} else if (&ompi_request_null == requests[i]) {
continue;
} else if (NULL == requests[i]->req_mpi_object.comm) {
continue;
} else if (NULL == check_req) {
Expand Down
16 changes: 9 additions & 7 deletions ompi/mpi/c/testsome.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,28 @@ int MPI_Testsome(int incount, MPI_Request requests[],
);

if ( MPI_PARAM_CHECK ) {
int indx, rc = MPI_SUCCESS;
int i, rc = MPI_SUCCESS;
MPI_Request check_req = NULL;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ((NULL == requests) && (0 != incount)) {
rc = MPI_ERR_REQUEST;
} else {
for (indx = 0; indx < incount; ++indx) {
if (NULL == requests[indx]) {
for (i = 0; i < incount; ++i) {
if (NULL == requests[i]) {
rc = MPI_ERR_REQUEST;
break;
}
if (&ompi_request_empty == requests[indx]) {
if (&ompi_request_empty == requests[i]) {
continue;
} else if (NULL == requests[indx]->req_mpi_object.comm) {
} else if (&ompi_request_null == requests[i]) {
continue;
} else if (NULL == requests[i]->req_mpi_object.comm) {
continue;
} else if (NULL == check_req) {
check_req = requests[indx];
check_req = requests[i];
}
else {
if (!ompi_comm_instances_same(requests[indx]->req_mpi_object.comm,
if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm,
check_req->req_mpi_object.comm)) {
rc = MPI_ERR_REQUEST;
break;
Expand Down
2 changes: 2 additions & 0 deletions ompi/mpi/c/waitall.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ int MPI_Waitall(int count, MPI_Request requests[], MPI_Status statuses[])
}
if (&ompi_request_empty == requests[i]) {
continue;
} else if (&ompi_request_null == requests[i]) {
continue;
} else if (NULL == requests[i]->req_mpi_object.comm) {
continue;
} else if (NULL == check_req) {
Expand Down
4 changes: 3 additions & 1 deletion ompi/mpi/c/waitany.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ int MPI_Waitany(int count, MPI_Request requests[], int *indx, MPI_Status *status
rc = MPI_ERR_REQUEST;
break;
}
if (requests[i] == &ompi_request_empty) {
if (&ompi_request_empty == requests[i]) {
continue;
} else if (&ompi_request_null == requests[i]) {
continue;
} else if (NULL == requests[i]->req_mpi_object.comm) {
continue;
Expand Down
16 changes: 9 additions & 7 deletions ompi/mpi/c/waitsome.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,28 @@ int MPI_Waitsome(int incount, MPI_Request requests[],
);

if ( MPI_PARAM_CHECK ) {
int indx, rc = MPI_SUCCESS;
int i, rc = MPI_SUCCESS;
MPI_Request check_req = NULL;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ((NULL == requests) && (0 != incount)) {
rc = MPI_ERR_REQUEST;
} else {
for (indx = 0; indx < incount; ++indx) {
if (NULL == requests[indx]) {
for (i = 0; i < incount; ++i) {
if (NULL == requests[i]) {
rc = MPI_ERR_REQUEST;
break;
}
if (&ompi_request_empty == requests[indx]) {
if (&ompi_request_empty == requests[i]) {
continue;
} else if (NULL == requests[indx]->req_mpi_object.comm) {
} else if (&ompi_request_null == requests[i]) {
continue;
} else if (NULL == requests[i]->req_mpi_object.comm) {
continue;
} else if (NULL == check_req) {
check_req = requests[indx];
check_req = requests[i];
}
else {
if (!ompi_comm_instances_same(requests[indx]->req_mpi_object.comm,
if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm,
check_req->req_mpi_object.comm)) {
rc = MPI_ERR_REQUEST;
break;
Expand Down

0 comments on commit 1994c3b

Please sign in to comment.