Commit afb720d0 authored by Rob Latham's avatar Rob Latham Committed by Kenneth Raffenetti
Browse files

fix issue with small i/o and big datatypes



HDF5 folks reported a bug with ROMIO and one of their slightly-strange (but
100% legal) datatypes.  git-bisect points to the "promote size of length"
change.  Seems that MPICH does not like struct datatypes with zero-count
elements?  Further investigation requred.  This change (construct a simpler
datatype in more cases) is sufficient to help HDF5 move forward.

See #2221
Signed-off-by: Kenneth Raffenetti's avatarKen Raffenetti <raffenet@mcs.anl.gov>
parent 4513e539
......@@ -63,17 +63,40 @@ int ADIOI_Type_create_hindexed_x(int count,
int i, ret;
MPI_Datatype *types;
int *blocklens;
int is_big=0;
types = ADIOI_Malloc(count*sizeof(MPI_Datatype));
blocklens = ADIOI_Malloc(count*sizeof(int));
/* squashing two loops into one.
* - Look in the array_of_blocklengths for any large values
* - convert MPI_Count items (if they are not too big) into int-sized items
* after this loop we will know if we can use MPI_type_hindexed or if we
* need a more complicated BigMPI-style struct-of-chunks.
*
* Why not use the struct-of-chunks in all cases? HDF5 reported a bug,
* which I have not yet precicesly nailed down, but appears to have
* something to do with struct-of-chunks when the chunks are small */
for(i=0; i<count; i++) {
if (array_of_blocklengths[i] > INT_MAX) {
blocklens[i] = 1;
is_big=1;
type_create_contiguous_x(array_of_blocklengths[i], oldtype, &(types[i]));
} else {
/* OK to cast: checked for "bigness" above */
blocklens[i] = (int)array_of_blocklengths[i];
MPI_Type_contiguous(blocklens[i], oldtype, &(types[i]));
}
}
if (is_big) {
ret = MPI_Type_create_struct(count, blocklens, array_of_displacements,
types, newtype);
} else {
ret = MPI_Type_hindexed(count, blocklens,
array_of_displacements, oldtype, newtype);
}
for (i=0; i< count; i++)
MPI_Type_free(&(types[i]));
ADIOI_Free(types);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment