Skip to content

Commit e1192f5

Browse files
tomhershppritcha
authored andcommitted
add instance check to functions with arrays of requests
Signed-off-by: tomhers <[email protected]>
1 parent 77366c4 commit e1192f5

File tree

6 files changed

+66
-0
lines changed

6 files changed

+66
-0
lines changed

ompi/mpi/c/testall.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ int MPI_Testall(int count, MPI_Request requests[], int *flag,
5656

5757
if ( MPI_PARAM_CHECK ) {
5858
int i, rc = MPI_SUCCESS;
59+
MPI_Request check_req = NULL;
5960
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
6061
if( (NULL == requests) && (0 != count) ) {
6162
rc = MPI_ERR_REQUEST;
@@ -65,6 +66,16 @@ int MPI_Testall(int count, MPI_Request requests[], int *flag,
6566
rc = MPI_ERR_REQUEST;
6667
break;
6768
}
69+
if (requests[i] == &ompi_request_empty) continue;
70+
else if (check_req == NULL) {
71+
check_req = requests[i];
72+
}
73+
else {
74+
if (requests[i]->req_mpi_object.comm->instance != check_req->req_mpi_object.comm->instance) {
75+
rc = MPI_ERR_REQUEST;
76+
break;
77+
}
78+
}
6879
}
6980
}
7081
if ((NULL == flag) || (count < 0)) {

ompi/mpi/c/testany.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ int MPI_Testany(int count, MPI_Request requests[], int *indx, int *completed, MP
5555

5656
if ( MPI_PARAM_CHECK ) {
5757
int i, rc = MPI_SUCCESS;
58+
MPI_Request check_req = NULL;
5859
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
5960
if ((NULL == requests) && (0 != count)) {
6061
rc = MPI_ERR_REQUEST;
@@ -64,6 +65,16 @@ int MPI_Testany(int count, MPI_Request requests[], int *indx, int *completed, MP
6465
rc = MPI_ERR_REQUEST;
6566
break;
6667
}
68+
if (requests[i] == &ompi_request_empty) continue;
69+
else if (check_req == NULL) {
70+
check_req = requests[i];
71+
}
72+
else {
73+
if (requests[i]->req_mpi_object.comm->instance != check_req->req_mpi_object.comm->instance) {
74+
rc = MPI_ERR_REQUEST;
75+
break;
76+
}
77+
}
6778
}
6879
}
6980
if (((NULL == indx || NULL == completed) && count > 0) ||

ompi/mpi/c/testsome.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ int MPI_Testsome(int incount, MPI_Request requests[],
5757

5858
if ( MPI_PARAM_CHECK ) {
5959
int indx, rc = MPI_SUCCESS;
60+
MPI_Request check_req = NULL;
6061
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
6162
if ((NULL == requests) && (0 != incount)) {
6263
rc = MPI_ERR_REQUEST;
@@ -66,6 +67,16 @@ int MPI_Testsome(int incount, MPI_Request requests[],
6667
rc = MPI_ERR_REQUEST;
6768
break;
6869
}
70+
if (requests[indx] == &ompi_request_empty) continue;
71+
else if (check_req == NULL) {
72+
check_req = requests[indx];
73+
}
74+
else {
75+
if (requests[indx]->req_mpi_object.comm->instance != check_req->req_mpi_object.comm->instance) {
76+
rc = MPI_ERR_REQUEST;
77+
break;
78+
}
79+
}
6980
}
7081
}
7182
if (((NULL == outcount || NULL == indices) && incount > 0) ||

ompi/mpi/c/waitall.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ int MPI_Waitall(int count, MPI_Request requests[], MPI_Status statuses[])
5454

5555
if ( MPI_PARAM_CHECK ) {
5656
int i, rc = MPI_SUCCESS;
57+
MPI_Request check_req = NULL;
5758
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
5859
if( (NULL == requests) && (0 != count) ) {
5960
rc = MPI_ERR_REQUEST;
@@ -63,6 +64,16 @@ int MPI_Waitall(int count, MPI_Request requests[], MPI_Status statuses[])
6364
rc = MPI_ERR_REQUEST;
6465
break;
6566
}
67+
if (requests[i] == &ompi_request_empty) continue;
68+
else if (check_req == NULL) {
69+
check_req = requests[i];
70+
}
71+
else {
72+
if (requests[i]->req_mpi_object.comm->instance != check_req->req_mpi_object.comm->instance) {
73+
rc = MPI_ERR_REQUEST;
74+
break;
75+
}
76+
}
6677
}
6778
}
6879
if (count < 0) {

ompi/mpi/c/waitany.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ int MPI_Waitany(int count, MPI_Request requests[], int *indx, MPI_Status *status
5555

5656
if ( MPI_PARAM_CHECK ) {
5757
int i, rc = MPI_SUCCESS;
58+
MPI_Request check_req = NULL;
5859
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
5960
if ((NULL == requests) && (0 != count)) {
6061
rc = MPI_ERR_REQUEST;
@@ -64,6 +65,16 @@ int MPI_Waitany(int count, MPI_Request requests[], int *indx, MPI_Status *status
6465
rc = MPI_ERR_REQUEST;
6566
break;
6667
}
68+
if (requests[i] == &ompi_request_empty) continue;
69+
else if (check_req == NULL) {
70+
check_req = requests[i];
71+
}
72+
else {
73+
if (requests[i]->req_mpi_object.comm->instance != check_req->req_mpi_object.comm->instance) {
74+
rc = MPI_ERR_REQUEST;
75+
break;
76+
}
77+
}
6778
}
6879
}
6980
if ((NULL == indx && count > 0) ||

ompi/mpi/c/waitsome.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ int MPI_Waitsome(int incount, MPI_Request requests[],
5757

5858
if ( MPI_PARAM_CHECK ) {
5959
int indx, rc = MPI_SUCCESS;
60+
MPI_Request check_req = NULL;
6061
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
6162
if ((NULL == requests) && (0 != incount)) {
6263
rc = MPI_ERR_REQUEST;
@@ -66,6 +67,16 @@ int MPI_Waitsome(int incount, MPI_Request requests[],
6667
rc = MPI_ERR_REQUEST;
6768
break;
6869
}
70+
if (requests[indx] == &ompi_request_empty) continue;
71+
else if (check_req == NULL) {
72+
check_req = requests[indx];
73+
}
74+
else {
75+
if (requests[indx]->req_mpi_object.comm->instance != check_req->req_mpi_object.comm->instance) {
76+
rc = MPI_ERR_REQUEST;
77+
break;
78+
}
79+
}
6980
}
7081
}
7182
if (((NULL == outcount || NULL == indices) && incount > 0) ||

0 commit comments

Comments
 (0)