Skip to content

Commit 3b0b929

Browse files
committed
ompi: MPI_IN_PLACE is not a valid argument of MPI_Neighbor_all* and MPI_Ineighbor_all*
1 parent 256976a commit 3b0b929

10 files changed

+20
-60
lines changed

ompi/mpi/c/ineighbor_allgather.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ int MPI_Ineighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype sen
8585
err = MPI_ERR_TYPE;
8686
} else if (recvcount < 0) {
8787
err = MPI_ERR_COUNT;
88-
} else if (MPI_IN_PLACE == recvbuf) {
88+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
8989
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
90-
} else if (MPI_IN_PLACE != sendbuf) {
90+
} else {
9191
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
9292
}
9393
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);

ompi/mpi/c/ineighbor_allgatherv.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,13 @@ int MPI_Ineighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype se
8888
OMPI_COMM_IS_DIST_GRAPH(comm))) {
8989
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
9090
FUNC_NAME);
91-
} else if (MPI_IN_PLACE == recvbuf) {
91+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
9292
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
9393
} else if (MPI_DATATYPE_NULL == recvtype) {
9494
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME);
9595
}
9696

97-
if (MPI_IN_PLACE != sendbuf) {
98-
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
99-
}
97+
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
10098
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
10199

102100
/* We always define the remote group to be the same as the local

ompi/mpi/c/ineighbor_alltoall.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,9 @@ int MPI_Ineighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype send
7171
OMPI_COMM_IS_DIST_GRAPH(comm))) {
7272
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
7373
FUNC_NAME);
74-
} else if (MPI_IN_PLACE == recvbuf) {
74+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
7575
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
7676
FUNC_NAME);
77-
} else if (MPI_IN_PLACE == sendbuf) {
78-
/* MPI_IN_PLACE is not fully implemented yet,
79-
return MPI_ERR_INTERN for now */
80-
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
81-
FUNC_NAME);
8277
} else {
8378
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
8479
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);

ompi/mpi/c/ineighbor_alltoallv.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,8 @@ int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const i
9898

9999
if ((NULL == sendcounts) || (NULL == sdispls) ||
100100
(NULL == recvcounts) || (NULL == rdispls) ||
101-
MPI_IN_PLACE == recvbuf) {
101+
MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
102102
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
103-
} else if (MPI_IN_PLACE == sendbuf) {
104-
/* MPI_IN_PLACE is not fully implemented yet,
105-
return MPI_ERR_INTERN for now */
106-
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
107-
FUNC_NAME);
108103
}
109104

110105
err = ompi_comm_neighbors_count(comm, &indegree, &outdegree, &weighted);

ompi/mpi/c/ineighbor_alltoallw.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,8 @@ int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const M
9696

9797
if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) ||
9898
(NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes) ||
99-
MPI_IN_PLACE == recvbuf) {
99+
MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
100100
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
101-
} else if (MPI_IN_PLACE == sendbuf) {
102-
/* MPI_IN_PLACE is not fully implemented yet,
103-
return MPI_ERR_INTERN for now */
104-
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
105-
FUNC_NAME);
106101
}
107102

108103
err = ompi_comm_neighbors_count(comm, &indegree, &outdegree, &weighted);

ompi/mpi/c/neighbor_allgather.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype send
8484
err = MPI_ERR_TYPE;
8585
} else if (recvcount < 0) {
8686
err = MPI_ERR_COUNT;
87-
} else if (MPI_IN_PLACE == recvbuf) {
87+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
8888
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
89-
} else if (MPI_IN_PLACE != sendbuf) {
89+
} else {
9090
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
9191
}
9292
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
@@ -95,16 +95,13 @@ int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype send
9595
/* Do we need to do anything? Everyone had to give the same send
9696
signature, which means that everyone must have given a
9797
sendcount > 0 if there's anything to send for the intra-communicator
98-
case. If we're doing IN_PLACE, however, check recvcount,
99-
not sendcount. */
98+
case. */
10099
if ( OMPI_COMM_IS_INTRA(comm) ) {
101-
if ((MPI_IN_PLACE != sendbuf && 0 == sendcount) ||
102-
(0 == recvcount)) {
100+
if ((0 == sendcount) || (0 == recvcount)) {
103101
return MPI_SUCCESS;
104102
}
105-
}
106-
else if ( OMPI_COMM_IS_INTER(comm) ){
107-
/* for inter comunicators, the communication pattern
103+
} else if ( OMPI_COMM_IS_INTER(comm) ){
104+
/* for inter communicators, the communication pattern
108105
need not be symmetric. Specifically, one group is
109106
allows to have sendcount=0, while the other has
110107
a valid sendcount. Thus, the only way not to do

ompi/mpi/c/neighbor_allgatherv.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,13 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen
8888
OMPI_COMM_IS_DIST_GRAPH(comm))) {
8989
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
9090
FUNC_NAME);
91-
} else if (MPI_IN_PLACE == recvbuf) {
91+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
9292
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
9393
} else if (MPI_DATATYPE_NULL == recvtype) {
9494
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME);
9595
}
9696

97-
if (MPI_IN_PLACE != sendbuf) {
98-
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
99-
}
97+
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
10098
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
10199

102100
/* We always define the remote group to be the same as the local

ompi/mpi/c/neighbor_alltoall.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,13 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
6464
/* Unrooted operation -- same checks for all ranks on both
6565
intracommunicators and intercommunicators */
6666

67-
if (MPI_IN_PLACE == sendbuf) {
68-
sendcount = recvcount;
69-
sendtype = recvtype;
70-
}
71-
7267
err = MPI_SUCCESS;
7368
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
7469
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
7570
OMPI_COMM_IS_DIST_GRAPH(comm))) {
7671
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
7772
FUNC_NAME);
78-
} else if (MPI_IN_PLACE == recvbuf) {
73+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
7974
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
8075
FUNC_NAME);
8176
} else {
@@ -85,7 +80,7 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
8580
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
8681
}
8782

88-
if (MPI_IN_PLACE != sendbuf && !OMPI_COMM_IS_INTER(comm)) {
83+
if (!OMPI_COMM_IS_INTER(comm)) {
8984
ompi_datatype_type_size(sendtype, &sendtype_size);
9085
ompi_datatype_type_size(recvtype, &recvtype_size);
9186
if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
@@ -98,8 +93,7 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
9893

9994
ompi_datatype_type_size(sendtype, &sendtype_size);
10095
ompi_datatype_type_size(recvtype, &recvtype_size);
101-
if (((MPI_IN_PLACE == sendbuf) ||
102-
(0 == sendcount) || (0 == sendtype_size)) &&
96+
if (((0 == sendcount) || (0 == sendtype_size)) &&
10397
((0 == recvcount) || 0 == (recvtype_size))) {
10498
return MPI_SUCCESS;
10599
}

ompi/mpi/c/neighbor_alltoallv.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,9 @@ int MPI_Neighbor_alltoallv(const void *sendbuf, const int sendcounts[], const in
9696
FUNC_NAME);
9797
}
9898

99-
if (MPI_IN_PLACE == sendbuf) {
100-
sendcounts = recvcounts;
101-
sdispls = rdispls;
102-
sendtype = recvtype;
103-
}
104-
10599
if ((NULL == sendcounts) || (NULL == sdispls) ||
106100
(NULL == recvcounts) || (NULL == rdispls) ||
107-
MPI_IN_PLACE == recvbuf) {
101+
MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
108102
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
109103
}
110104

ompi/mpi/c/neighbor_alltoallw.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,9 @@ int MPI_Neighbor_alltoallw(const void *sendbuf, const int sendcounts[], const MP
9292
FUNC_NAME);
9393
}
9494

95-
if (MPI_IN_PLACE == sendbuf) {
96-
sendcounts = recvcounts;
97-
sdispls = rdispls;
98-
sendtypes = recvtypes;
99-
}
100-
10195
if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) ||
10296
(NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes) ||
103-
MPI_IN_PLACE == recvbuf) {
97+
MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
10498
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
10599
}
106100

0 commit comments

Comments
 (0)