From 67a63785c62e462c36ced83cdd2dc0e2377d45fb 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 (back-ported from commit open-mpi/ompi@6714f6aee7a30ee0add6ded69c7a223ddaf3c053) Signed-off-by: Gilles Gouaillardet --- ompi/mca/coll/libnbc/nbc_ialltoallv.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ompi/mca/coll/libnbc/nbc_ialltoallv.c b/ompi/mca/coll/libnbc/nbc_ialltoallv.c index 0db774dbe96..785171855f5 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoallv.c @@ -56,8 +56,6 @@ int ompi_coll_libnbc_ialltoallv(void* sendbuf, int *sendcounts, int *sdispls, if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } res= MPI_Comm_size(comm, &p); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_size() (%i)\n", res); return res; } - res = MPI_Type_extent(sendtype, &sndext); - if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", res); return res; } res = MPI_Type_extent(recvtype, &rcvext); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", res); return res; } @@ -82,11 +80,15 @@ int ompi_coll_libnbc_ialltoallv(void* sendbuf, int *sendcounts, int *sdispls, if (OPAL_UNLIKELY(NULL == handle->tmpbuf)) { printf("Error in malloc()\n"); return NBC_OOR; } 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 (NBC_OK != res) { printf("Error in NBC_Copy() (%i)\n", res); return res; } + } else { + res = MPI_Type_extent(sendtype, &sndext); + if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Type_extent() (%i)\n", 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 (NBC_OK != res) { printf("Error in NBC_Copy() (%i)\n", res); return res; } + } } if (inplace) {