From 1ced7f213c55ec0e6e75214772d966ffd7a7d025 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Mon, 11 Apr 2016 18:34:11 +0900 Subject: [PATCH 1/3] 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. --- ompi/mpi/c/ialltoallv.c | 12 ++++++++---- ompi/mpi/c/ialltoallw.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ompi/mpi/c/ialltoallv.c b/ompi/mpi/c/ialltoallv.c index f10fd35f20b..2ba6ef3505c 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 615bf79e1e5..05473cab936 100644 --- a/ompi/mpi/c/ialltoallw.c +++ b/ompi/mpi/c/ialltoallw.c @@ -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); } From eb5c31521b1b9dc3736526c062559bd8a3d6999f Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Mon, 11 Apr 2016 18:47:30 +0900 Subject: [PATCH 2/3] mpi/c: Fix `MPI_IALLTOALLW` memchecker --- ompi/mpi/c/ialltoallw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mpi/c/ialltoallw.c b/ompi/mpi/c/ialltoallw.c index 05473cab936..076f82a3790 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]); } ); From d3d638657840718ee3237acc7e095199e6e3e7db Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Mon, 11 Apr 2016 20:37:38 +0900 Subject: [PATCH 3/3] mpi/forran: Support `MPI_IN_PLACE` on `(I)ALLTOALLW` and `(I)EXSCAN` `MPI_IN_PLACE` support for `MPI_ALLTOALLW` and `MPI_EXSCAN` was added in MPI-2.2 but it was missed in OMPI Fortran binding code. --- ompi/mpi/fortran/mpif-h/alltoallw_f.c | 2 +- ompi/mpi/fortran/mpif-h/exscan_f.c | 2 +- ompi/mpi/fortran/mpif-h/ialltoallw_f.c | 2 +- ompi/mpi/fortran/mpif-h/iexscan_f.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ompi/mpi/fortran/mpif-h/alltoallw_f.c b/ompi/mpi/fortran/mpif-h/alltoallw_f.c index effa20e7498..cb2328cf972 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 32a4612d20d..9880301e2b3 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 3ec36ada0e0..85cedd932f2 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 50041153180..cd41416244f 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);