diff --git a/ompi/mpi/c/ialltoallv.c b/ompi/mpi/c/ialltoallv.c index f10fd35f20..2ba6ef3505 100644 --- a/ompi/mpi/c/ialltoallv.c +++ b/ompi/mpi/c/ialltoallv.c @@ -89,6 +89,12 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl FUNC_NAME); } + if (MPI_IN_PLACE == sendbuf) { + sendcounts = recvcounts; + sdispls = rdispls; + sendtype = recvtype; + } + if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == recvcounts) || (NULL == rdispls) || (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 size = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm); for (i = 0; i < size; ++i) { - if (MPI_IN_PLACE != sendbuf) { - OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcounts[i]); - OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); - } + OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcounts[i]); + OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtype, recvcounts[i]); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ialltoallw.c b/ompi/mpi/c/ialltoallw.c index 615bf79e1e..076f82a379 100644 --- a/ompi/mpi/c/ialltoallw.c +++ b/ompi/mpi/c/ialltoallw.c @@ -69,7 +69,7 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl memchecker_datatype(recvtypes[i]); ompi_datatype_type_extent(recvtypes[i], &recv_ext); memchecker_call(&opal_memchecker_base_isaddressable, - (char *)(recvbuf)+sdispls[i]*recv_ext, + (char *)(recvbuf)+rdispls[i]*recv_ext, recvcounts[i], recvtypes[i]); } ); @@ -85,6 +85,12 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl FUNC_NAME); } + if (MPI_IN_PLACE == sendbuf) { + sendcounts = recvcounts; + sdispls = rdispls; + sendtypes = recvtypes; + } + if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) || (NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes) || (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 size = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm); for (i = 0; i < size; ++i) { - if (MPI_IN_PLACE != sendbuf) { - OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtypes[i], sendcounts[i]); - OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); - } + OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtypes[i], sendcounts[i]); + OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtypes[i], recvcounts[i]); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/fortran/mpif-h/alltoallw_f.c b/ompi/mpi/fortran/mpif-h/alltoallw_f.c index effa20e749..cb2328cf97 100644 --- a/ompi/mpi/fortran/mpif-h/alltoallw_f.c +++ b/ompi/mpi/fortran/mpif-h/alltoallw_f.c @@ -98,7 +98,7 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts, --size; } - /* Alltoallw does not support MPI_IN_PLACE */ + sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf); sendbuf = (char *) OMPI_F2C_BOTTOM(sendbuf); recvbuf = (char *) OMPI_F2C_BOTTOM(recvbuf); diff --git a/ompi/mpi/fortran/mpif-h/exscan_f.c b/ompi/mpi/fortran/mpif-h/exscan_f.c index 32a4612d20..9880301e2b 100644 --- a/ompi/mpi/fortran/mpif-h/exscan_f.c +++ b/ompi/mpi/fortran/mpif-h/exscan_f.c @@ -80,7 +80,7 @@ void ompi_exscan_f(char *sendbuf, char *recvbuf, MPI_Fint *count, c_type = PMPI_Type_f2c(*datatype); c_op = PMPI_Op_f2c(*op); - /* MPI_IN_PLACE is not supported */ + sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf); sendbuf = (char *) OMPI_F2C_BOTTOM (sendbuf); recvbuf = (char *) OMPI_F2C_BOTTOM (recvbuf); diff --git a/ompi/mpi/fortran/mpif-h/ialltoallw_f.c b/ompi/mpi/fortran/mpif-h/ialltoallw_f.c index 3ec36ada0e..85cedd932f 100644 --- a/ompi/mpi/fortran/mpif-h/ialltoallw_f.c +++ b/ompi/mpi/fortran/mpif-h/ialltoallw_f.c @@ -99,7 +99,7 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts, --size; } - /* Ialltoallw does not support MPI_IN_PLACE */ + sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf); sendbuf = (char *) OMPI_F2C_BOTTOM(sendbuf); recvbuf = (char *) OMPI_F2C_BOTTOM(recvbuf); diff --git a/ompi/mpi/fortran/mpif-h/iexscan_f.c b/ompi/mpi/fortran/mpif-h/iexscan_f.c index 5004115318..cd41416244 100644 --- a/ompi/mpi/fortran/mpif-h/iexscan_f.c +++ b/ompi/mpi/fortran/mpif-h/iexscan_f.c @@ -81,7 +81,7 @@ void ompi_iexscan_f(char *sendbuf, char *recvbuf, MPI_Fint *count, c_type = PMPI_Type_f2c(*datatype); c_op = PMPI_Op_f2c(*op); - /* MPI_IN_PLACE is not supported */ + sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf); sendbuf = (char *) OMPI_F2C_BOTTOM (sendbuf); recvbuf = (char *) OMPI_F2C_BOTTOM (recvbuf);