Commit 7ddceb69 authored by Rob Latham's avatar Rob Latham
Browse files

adjust flattened processing for repeated resize



resize and struct are the two type constructors that can set the LB and
UB markers on a type.  Struct, due to MPI-1 ideas, is a strange beast
(they adjust only if they are lower/higher than the old ones (!) )
but for resized it's clear that the markers shift.

Closes #2088
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent 036d91a9
......@@ -58,6 +58,7 @@ void ADIOI_Flatten_datatype(MPI_Datatype datatype)
flat->next = NULL;
flat->blocklens = NULL;
flat->indices = NULL;
flat->lb_idx = flat->ub_idx = -1;
flat->count = ADIOI_Count_contiguous_blocks(datatype, &curr_index);
#ifdef FLATTEN_DEBUG
......@@ -108,6 +109,7 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
ADIO_Offset st_offset, MPI_Count *curr_index)
{
int i, k, m, n, basic_num, nonzeroth, is_hindexed_block=0;
int lb_updated=0;
int combiner, old_combiner, old_is_contig;
int nints, nadds, ntypes, old_nints, old_nadds, old_ntypes;
/* By using ADIO_Offset we preserve +/- sign and
......@@ -736,18 +738,31 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
/* handle the Lb */
j = *curr_index;
flat->indices[j] = st_offset + adds[0];
/* this zero-length blocklens[] element, unlike eleswhere in the
* flattening code, is correct and is used to indicate a lower bound
* marker */
flat->blocklens[j] = 0;
flat->lb_idx = *curr_index;
#ifdef FLATTEN_DEBUG
DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",0,adds[0],j, flat->indices[j], j, flat->blocklens[j]);
#endif
/* when we process resized types, we (recursively) process the lower
* bound, the type being resized, then the upper bound. In the
* resized-of-resized case, we might find ourselves updating the upper
* bound based on the inner type, but the lower bound based on the
* upper type. check both lb and ub to prevent mixing updates */
if (flat->lb_idx == -1 && flat->ub_idx == -1) {
flat->indices[j] = st_offset + adds[0];
/* this zero-length blocklens[] element, unlike eleswhere in the
* flattening code, is correct and is used to indicate a lower bound
* marker */
flat->blocklens[j] = 0;
flat->lb_idx = *curr_index;
lb_updated=1;
#ifdef FLATTEN_DEBUG
DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",0,adds[0],j, flat->indices[j], j, flat->blocklens[j]);
#endif
(*curr_index)++;
(*curr_index)++;
} else {
/* skipped over this chunk because something else higher-up in the
* type construction set this for us already */
flat->count--;
st_offset -= adds[0];
}
/* handle the datatype */
......@@ -773,12 +788,20 @@ void ADIOI_Flatten(MPI_Datatype datatype, ADIOI_Flatlist_node *flat,
}
/* take care of the extent as a UB */
j = *curr_index;
flat->indices[j] = st_offset + adds[0] + adds[1];
/* again, zero-element ok: an upper-bound marker explicitly set by the
* constructor of this resized type */
flat->blocklens[j] = 0;
flat->lb_idx = *curr_index;
/* see note above about mixing updates for why we check lb and ub */
if ((flat->lb_idx == -1 && flat->ub_idx == -1) || lb_updated) {
j = *curr_index;
flat->indices[j] = st_offset + adds[0] + adds[1];
/* again, zero-element ok: an upper-bound marker explicitly set by the
* constructor of this resized type */
flat->blocklens[j] = 0;
flat->ub_idx = *curr_index;
} else {
/* skipped over this chunk because something else higher-up in the
* type construction set this for us already */
flat->count--;
(*curr_index)--;
}
#ifdef FLATTEN_DEBUG
DBG_FPRINTF(stderr,"ADIOI_Flatten:: simple adds[%#X] "MPI_AINT_FMT_HEX_SPEC", flat->indices[%#llX] %#llX, flat->blocklens[%#llX] %#llX\n",1,adds[1],j, flat->indices[j], j, flat->blocklens[j]);
......
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