1
1

single_predefined_type with MPI_LB/UB

The ompi_datatype_get_single_predefined_type_from_args() recurses down
into a constructed type to identify what base datatype it's built from
if it's built from a single type.  But if the type has MPI_LB/MPI_UB,
for example
    lens[0] = 1;
    lens[1] = 1;
    disps[0] = 0;
    disps[1] = 0;
    types[0] = MPI_LB;
    types[1] = MPI_INT;
    MPI_Type_create_struct(2, lens, disps, types, &mydt);
then this function will see the base type MPI_LB as differing from MPI_INT
and will identify mydt as not being constructed from a single base type, so
the type will be rejected for calls like MPI_Accumulate.

I think those "meta data" types shouldn't result in rejection like that, and
the above mydt should still be identified as having a single base type
of MPI_INT.

Addition: boslica wanted another change discussed here
    https://github.com/open-mpi/ompi/pull/3609
relating to the calculation for "count" after identifying the
predefined_type that was being used.

Signed-off-by: Mark Allen <markalle@us.ibm.com>
Этот коммит содержится в:
Mark Allen 2017-05-30 12:54:11 -04:00
родитель 22631832ce
Коммит e24d5ccb7e
2 изменённых файлов: 19 добавлений и 13 удалений

Просмотреть файл

@ -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;
}
}
}
}

Просмотреть файл

@ -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,