Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit c952464

Browse files
committed
ompi: MPI_IN_PLACE is not a valid argument of MPI_Neighbor_all* and MPI_Ineighbor_all*
(cherry picked from commit 3b0b929)
1 parent bbfa865 commit c952464

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
@@ -84,9 +84,9 @@ int MPI_Ineighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype sen
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);

ompi/mpi/c/ineighbor_allgatherv.c

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

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

10199
/* 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
@@ -72,14 +72,9 @@ int MPI_Ineighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype send
7272
OMPI_COMM_IS_DIST_GRAPH(comm))) {
7373
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
7474
FUNC_NAME);
75-
} else if (MPI_IN_PLACE == recvbuf) {
75+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
7676
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
7777
FUNC_NAME);
78-
} else if (MPI_IN_PLACE == sendbuf) {
79-
/* MPI_IN_PLACE is not fully implemented yet,
80-
return MPI_ERR_INTERN for now */
81-
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
82-
FUNC_NAME);
8378
} else {
8479
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
8580
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
@@ -99,13 +99,8 @@ int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const i
9999

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

111106
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
@@ -97,13 +97,8 @@ int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const M
9797

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

109104
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
@@ -83,9 +83,9 @@ int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype send
8383
err = MPI_ERR_TYPE;
8484
} else if (recvcount < 0) {
8585
err = MPI_ERR_COUNT;
86-
} else if (MPI_IN_PLACE == recvbuf) {
86+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
8787
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
88-
} else if (MPI_IN_PLACE != sendbuf) {
88+
} else {
8989
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
9090
}
9191
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
@@ -94,16 +94,13 @@ int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype send
9494
/* Do we need to do anything? Everyone had to give the same send
9595
signature, which means that everyone must have given a
9696
sendcount > 0 if there's anything to send for the intra-communicator
97-
case. If we're doing IN_PLACE, however, check recvcount,
98-
not sendcount. */
97+
case. */
9998
if ( OMPI_COMM_IS_INTRA(comm) ) {
100-
if ((MPI_IN_PLACE != sendbuf && 0 == sendcount) ||
101-
(0 == recvcount)) {
99+
if ((0 == sendcount) || (0 == recvcount)) {
102100
return MPI_SUCCESS;
103101
}
104-
}
105-
else if ( OMPI_COMM_IS_INTER(comm) ){
106-
/* for inter comunicators, the communication pattern
102+
} else if ( OMPI_COMM_IS_INTER(comm) ){
103+
/* for inter communicators, the communication pattern
107104
need not be symmetric. Specifically, one group is
108105
allows to have sendcount=0, while the other has
109106
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
@@ -87,15 +87,13 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen
8787
OMPI_COMM_IS_DIST_GRAPH(comm))) {
8888
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
8989
FUNC_NAME);
90-
} else if (MPI_IN_PLACE == recvbuf) {
90+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
9191
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
9292
} else if (MPI_DATATYPE_NULL == recvtype) {
9393
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TYPE, FUNC_NAME);
9494
}
9595

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

10199
/* 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
@@ -65,18 +65,13 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
6565
/* Unrooted operation -- same checks for all ranks on both
6666
intracommunicators and intercommunicators */
6767

68-
if (MPI_IN_PLACE == sendbuf) {
69-
sendcount = recvcount;
70-
sendtype = recvtype;
71-
}
72-
7368
err = MPI_SUCCESS;
7469
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
7570
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
7671
OMPI_COMM_IS_DIST_GRAPH(comm))) {
7772
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
7873
FUNC_NAME);
79-
} else if (MPI_IN_PLACE == recvbuf) {
74+
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
8075
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
8176
FUNC_NAME);
8277
} else {
@@ -86,7 +81,7 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
8681
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
8782
}
8883

89-
if (MPI_IN_PLACE != sendbuf && !OMPI_COMM_IS_INTER(comm)) {
84+
if (!OMPI_COMM_IS_INTER(comm)) {
9085
ompi_datatype_type_size(sendtype, &sendtype_size);
9186
ompi_datatype_type_size(recvtype, &recvtype_size);
9287
if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
@@ -99,8 +94,7 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
9994

10095
ompi_datatype_type_size(sendtype, &sendtype_size);
10196
ompi_datatype_type_size(recvtype, &recvtype_size);
102-
if (((MPI_IN_PLACE == sendbuf) ||
103-
(0 == sendcount) || (0 == sendtype_size)) &&
97+
if (((0 == sendcount) || (0 == sendtype_size)) &&
10498
((0 == recvcount) || 0 == (recvtype_size))) {
10599
return MPI_SUCCESS;
106100
}

ompi/mpi/c/neighbor_alltoallv.c

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

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

ompi/mpi/c/neighbor_alltoallw.c

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

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

0 commit comments

Comments
 (0)