From d14daf40d041f7a0a8e9d85b3bfd5eb570495fd2 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 19 Jan 2015 14:07:23 +0900 Subject: [PATCH] ob1: correctly handle types in which size > extent do not send inline if extent*count *OR* size*count are greater than 256 --- ompi/mca/pml/ob1/pml_ob1_isend.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ompi/mca/pml/ob1/pml_ob1_isend.c b/ompi/mca/pml/ob1/pml_ob1_isend.c index 7bedb261bc..6ba32969c5 100644 --- a/ompi/mca/pml/ob1/pml_ob1_isend.c +++ b/ompi/mca/pml/ob1/pml_ob1_isend.c @@ -12,7 +12,9 @@ * All rights reserved. * Copyright (c) 2007-2014 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -71,14 +73,15 @@ static inline int mca_pml_ob1_send_inline (void *buf, size_t count, mca_bml_base_btl_t *bml_btl; OPAL_PTRDIFF_TYPE lb, extent; opal_convertor_t convertor; - size_t size = 0; + size_t size; int rc; bml_btl = mca_bml_base_btl_array_get_next(&endpoint->btl_eager); ompi_datatype_get_extent (datatype, &lb, &extent); + ompi_datatype_type_size (datatype, &size); - if (OPAL_UNLIKELY((extent * count) > 256 || !bml_btl->btl->btl_sendi)) { + if (OPAL_UNLIKELY((extent * count) > 256 || (size * count) > 256 || !bml_btl->btl->btl_sendi)) { return OMPI_ERR_NOT_AVAILABLE; } @@ -92,6 +95,8 @@ static inline int mca_pml_ob1_send_inline (void *buf, size_t count, (const struct opal_datatype_t *) datatype, count, buf, 0, &convertor); opal_convertor_get_packed_size (&convertor, &size); + } else { + size = 0; } match.hdr_common.hdr_flags = 0;