Skip to content

Commit 1ced7f2

Browse files
committed
mpi/c: Fix IALLTOALL{V|W} + MPI_IN_PLACE param check
`sendcounts`, `sdispls`, and `sendtype(s)` must be ignored if `MPI_IN_PLACE` is specified for `sendbuf`. This commit makes the param check code same as the blocking `ALLTOALL{V|W}` function.
1 parent c72688e commit 1ced7f2

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

ompi/mpi/c/ialltoallv.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl
8989
FUNC_NAME);
9090
}
9191

92+
if (MPI_IN_PLACE == sendbuf) {
93+
sendcounts = recvcounts;
94+
sdispls = rdispls;
95+
sendtype = recvtype;
96+
}
97+
9298
if ((NULL == sendcounts) || (NULL == sdispls) ||
9399
(NULL == recvcounts) || (NULL == rdispls) ||
94100
(MPI_IN_PLACE == sendbuf && OMPI_COMM_IS_INTER(comm)) ||
@@ -103,10 +109,8 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl
103109

104110
size = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm);
105111
for (i = 0; i < size; ++i) {
106-
if (MPI_IN_PLACE != sendbuf) {
107-
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcounts[i]);
108-
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
109-
}
112+
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcounts[i]);
113+
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
110114
OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtype, recvcounts[i]);
111115
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
112116
}

ompi/mpi/c/ialltoallw.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
8585
FUNC_NAME);
8686
}
8787

88+
if (MPI_IN_PLACE == sendbuf) {
89+
sendcounts = recvcounts;
90+
sdispls = rdispls;
91+
sendtypes = recvtypes;
92+
}
93+
8894
if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) ||
8995
(NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes) ||
9096
(MPI_IN_PLACE == sendbuf && OMPI_COMM_IS_INTER(comm)) ||
@@ -99,10 +105,8 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
99105

100106
size = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm);
101107
for (i = 0; i < size; ++i) {
102-
if (MPI_IN_PLACE != sendbuf) {
103-
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtypes[i], sendcounts[i]);
104-
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
105-
}
108+
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtypes[i], sendcounts[i]);
109+
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
106110
OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtypes[i], recvcounts[i]);
107111
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
108112
}

0 commit comments

Comments
 (0)