From 34f78ab0f4d6a52100320af476f678626bd9dacb Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 24 Oct 2016 09:29:06 +0900 Subject: [PATCH] coll/libnbc: fix MPI_Ialltoallv with MPI_IN_PLACE and without MPI param check (cherry picked from commit open-mpi/ompi@6714f6aee7a30ee0add6ded69c7a223ddaf3c053) Signed-off-by: Gilles Gouaillardet --- ompi/mca/coll/libnbc/nbc_ialltoallv.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ompi/mca/coll/libnbc/nbc_ialltoallv.c b/ompi/mca/coll/libnbc/nbc_ialltoallv.c index 77761623fdd..d39838124d8 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoallv.c @@ -54,12 +54,6 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons rank = ompi_comm_rank (comm); p = ompi_comm_size (comm); - res = ompi_datatype_type_extent (sendtype, &sndext); - if (MPI_SUCCESS != res) { - NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res); - return res; - } - res = ompi_datatype_type_extent (recvtype, &rcvext); if (MPI_SUCCESS != res) { NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res); @@ -87,13 +81,20 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons } sendcounts = recvcounts; sdispls = rdispls; - } else if (sendcounts[rank] != 0) { - rbuf = (char *) recvbuf + rdispls[rank] * rcvext; - sbuf = (char *) sendbuf + sdispls[rank] * sndext; - res = NBC_Copy (sbuf, sendcounts[rank], sendtype, rbuf, recvcounts[rank], recvtype, comm); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { + } else { + res = ompi_datatype_type_extent (sendtype, &sndext); + if (MPI_SUCCESS != res) { + NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res); return res; } + if (sendcounts[rank] != 0) { + rbuf = (char *) recvbuf + rdispls[rank] * rcvext; + sbuf = (char *) sendbuf + sdispls[rank] * sndext; + res = NBC_Copy (sbuf, sendcounts[rank], sendtype, rbuf, recvcounts[rank], recvtype, comm); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { + return res; + } + } } schedule = OBJ_NEW(NBC_Schedule);