Skip to content

Commit be7b0af

Browse files
authored
Merge pull request #3609 from markalle/pr/single_type_with_LB_UB
single_predefined_type with MPI_LB/UB
2 parents 8adbe9f + e24d5cc commit be7b0af

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

ompi/datatype/ompi_datatype_args.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* reserved.
1616
* Copyright (c) 2015-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
18+
* Copyright (c) 2017 IBM Corporation. All rights reserved.
1819
* $COPYRIGHT$
1920
*
2021
* Additional copyrights may follow
@@ -837,16 +838,19 @@ ompi_datatype_t* ompi_datatype_get_single_predefined_type_from_args( ompi_dataty
837838
return NULL;
838839
}
839840
}
840-
if( NULL == predef ) { /* This is the first iteration */
841-
predef = current_predef;
842-
} else {
843-
/**
844-
* What exactly should we consider as identical types? If they are
845-
* the same MPI level type, or if they map to the same OPAL datatype?
846-
* In other words, MPI_FLOAT and MPI_REAL4 are they identical?
847-
*/
848-
if( predef != current_predef ) {
849-
return NULL;
841+
if (current_predef != MPI_LB && current_predef != MPI_UB) {
842+
if( NULL == predef ) { /* This is the first iteration */
843+
predef = current_predef;
844+
} else {
845+
/**
846+
* What exactly should we consider as identical types?
847+
* If they are the same MPI level type, or if they map
848+
* to the same OPAL datatype? In other words, MPI_FLOAT
849+
* and MPI_REAL4 are they identical?
850+
*/
851+
if( predef != current_predef ) {
852+
return NULL;
853+
}
850854
}
851855
}
852856
}

ompi/mca/osc/base/osc_base_obj_convert.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,16 @@ int ompi_osc_base_process_op (void *outbuf, void *inbuf, size_t inbuflen,
109109
bool done;
110110

111111
primitive_datatype = ompi_datatype_get_single_predefined_type_from_args(datatype);
112+
ompi_datatype_type_size (primitive_datatype, &primitive_size);
113+
112114
if (ompi_datatype_is_contiguous_memory_layout (datatype, count) &&
113115
1 == datatype->super.desc.used) {
114116
/* NTH: the datatype is made up of a contiguous block of the primitive
115117
* datatype. fast path. do not set up a convertor to deal with the
116118
* datatype. */
117-
count *= datatype->super.desc.desc[0].elem.count;
119+
(void)ompi_datatype_type_size(datatype, &size);
120+
count *= (size / primitive_size);
121+
assert( 0 == (size % primitive_size) );
118122

119123
/* in case it is possible for the datatype to have a non-zero lb in this case.
120124
* remove me if this is not possible */
@@ -125,8 +129,6 @@ int ompi_osc_base_process_op (void *outbuf, void *inbuf, size_t inbuflen,
125129
return OMPI_SUCCESS;
126130
}
127131

128-
ompi_datatype_type_size (primitive_datatype, &primitive_size);
129-
130132
/* create convertor */
131133
OBJ_CONSTRUCT(&convertor, opal_convertor_t);
132134
opal_convertor_copy_and_prepare_for_recv(ompi_mpi_local_convertor, &datatype->super,

0 commit comments

Comments
 (0)