diff --git a/ompi/datatype/ompi_datatype_args.c b/ompi/datatype/ompi_datatype_args.c index f6c0851e59e..5f9e5d92daa 100644 --- a/ompi/datatype/ompi_datatype_args.c +++ b/ompi/datatype/ompi_datatype_args.c @@ -15,6 +15,7 @@ * reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -837,16 +838,19 @@ ompi_datatype_t* ompi_datatype_get_single_predefined_type_from_args( ompi_dataty return NULL; } } - if( NULL == predef ) { /* This is the first iteration */ - predef = current_predef; - } else { - /** - * What exactly should we consider as identical types? If they are - * the same MPI level type, or if they map to the same OPAL datatype? - * In other words, MPI_FLOAT and MPI_REAL4 are they identical? - */ - if( predef != current_predef ) { - return NULL; + if (current_predef != MPI_LB && current_predef != MPI_UB) { + if( NULL == predef ) { /* This is the first iteration */ + predef = current_predef; + } else { + /** + * What exactly should we consider as identical types? + * If they are the same MPI level type, or if they map + * to the same OPAL datatype? In other words, MPI_FLOAT + * and MPI_REAL4 are they identical? + */ + if( predef != current_predef ) { + return NULL; + } } } } diff --git a/ompi/mca/osc/base/osc_base_obj_convert.c b/ompi/mca/osc/base/osc_base_obj_convert.c index bb4641c659d..e396258ce2b 100644 --- a/ompi/mca/osc/base/osc_base_obj_convert.c +++ b/ompi/mca/osc/base/osc_base_obj_convert.c @@ -109,12 +109,16 @@ int ompi_osc_base_process_op (void *outbuf, void *inbuf, size_t inbuflen, bool done; primitive_datatype = ompi_datatype_get_single_predefined_type_from_args(datatype); + ompi_datatype_type_size (primitive_datatype, &primitive_size); + if (ompi_datatype_is_contiguous_memory_layout (datatype, count) && 1 == datatype->super.desc.used) { /* NTH: the datatype is made up of a contiguous block of the primitive * datatype. fast path. do not set up a convertor to deal with the * datatype. */ - count *= datatype->super.desc.desc[0].elem.count; + (void)ompi_datatype_type_size(datatype, &size); + count *= (size / primitive_size); + assert( 0 == (size % primitive_size) ); /* in case it is possible for the datatype to have a non-zero lb in this case. * remove me if this is not possible */ @@ -125,8 +129,6 @@ int ompi_osc_base_process_op (void *outbuf, void *inbuf, size_t inbuflen, return OMPI_SUCCESS; } - ompi_datatype_type_size (primitive_datatype, &primitive_size); - /* create convertor */ OBJ_CONSTRUCT(&convertor, opal_convertor_t); opal_convertor_copy_and_prepare_for_recv(ompi_mpi_local_convertor, &datatype->super,