From b9e14cd7d0d2786e509fc03a417c3aea3aa6d01f Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Sat, 7 Jul 2018 20:59:39 +0700 Subject: [PATCH] coll/base/gather_intra_binomial: fix MPI_IN_PLACE processing The call of MPI_Gather with sendbuf and sendtype parameters equal to MPI_IN_PLACE and NULL correspondingly, produces the segmentation fault in the root process. The problem is that sendtype is used even when sendbuf value is MPI_IN_PLACE. But according to the standard (page 150, line 37), sendtype and sendcount parameters should be ignored in this case. Signed-off-by: Mikhail Kurnosov --- ompi/mca/coll/base/coll_base_gather.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ompi/mca/coll/base/coll_base_gather.c b/ompi/mca/coll/base/coll_base_gather.c index 83766bff2c..8d5ab70d70 100644 --- a/ompi/mca/coll/base/coll_base_gather.c +++ b/ompi/mca/coll/base/coll_base_gather.c @@ -65,9 +65,6 @@ ompi_coll_base_gather_intra_binomial(const void *sbuf, int scount, COLL_BASE_UPDATE_IN_ORDER_BMTREE( comm, base_module, root ); bmtree = data->cached_in_order_bmtree; - ompi_datatype_type_extent(sdtype, &sextent); - ssize = opal_datatype_span(&sdtype->super, (int64_t)scount * size, &sgap); - vrank = (rank - root + size) % size; if (rank == root) { @@ -107,6 +104,8 @@ ompi_coll_base_gather_intra_binomial(const void *sbuf, int scount, /* other non-leaf nodes, allocate temp buffer for data received from * children, the most we need is half of the total data elements due * to the property of binimoal tree */ + ompi_datatype_type_extent(sdtype, &sextent); + ssize = opal_datatype_span(&sdtype->super, (int64_t)scount * size, &sgap); tempbuf = (char *) malloc(ssize); if (NULL == tempbuf) { err= OMPI_ERR_OUT_OF_RESOURCE; line = __LINE__; goto err_hndl;