Delta reduction against hyperslab_updates branch.

This commit is contained in:
Quincey Koziol 2019-01-10 23:08:51 -06:00
parent b9c8ddbfcc
commit 4729d04d91
7 changed files with 126 additions and 211 deletions

View File

@ -1998,13 +1998,13 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
*/
/* Get the chunk node from the skip list */
if(NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_index)))
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list")
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, H5_ITER_ERROR, "can't locate chunk in skip list")
/* Check if the chunk already has a memory space */
if(NULL == chunk_info->mspace) {
/* Copy the template memory chunk dataspace */
if(NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space")
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy file space")
} /* end else */
/* Update the "last chunk seen" information */
@ -2014,21 +2014,21 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
/* Get coordinates of selection iterator for memory */
if(H5S_SELECT_ITER_COORDS(&fm->mem_iter, coords_in_mem) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates")
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, H5_ITER_ERROR, "unable to get iterator coordinates")
/* Add point to memory selection for chunk */
if(fm->msel_type == H5S_SEL_POINTS) {
if(H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, coords_in_mem) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element")
} /* end if */
else {
if(H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element")
} /* end else */
/* Move memory selection iterator to next element in selection */
if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location")
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, H5_ITER_ERROR, "unable to move to next iterator location")
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -237,26 +237,25 @@ H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space)
HDassert(space);
if (space_id < 0)
/* Check for invalid ID */
if(space_id < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)")
if (H5S_ALL == space_id) {
/* No special dataspace struct for H5S_ALL */
/* No special dataspace struct for H5S_ALL */
if(H5S_ALL == space_id)
*space = NULL;
}
else {
/* Get the dataspace pointer */
if (NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
if(NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "space_id is not a dataspace ID")
/* Check for valid selection */
if (H5S_SELECT_VALID(*space) != TRUE)
if(H5S_SELECT_VALID(*space) != TRUE)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent")
}
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_get_validated_dataspace() */

View File

@ -278,11 +278,8 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space)
static herr_t
H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
{
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */
unsigned rank; /* Dataspace's dimension rank */
unsigned u; /* Index variable */
int i; /* Index variable */
FUNC_ENTER_STATIC_NOERR
@ -298,16 +295,16 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Get the rank of the dataspace */
rank = space->extent.rank;
/* Set the temporary pointer to the dimension information */
tdiminfo = space->select.sel_info.hslab->opt_diminfo;
/* Check for the special case of just one H5Sselect_hyperslab call made */
if(space->select.sel_info.hslab->diminfo_valid) {
/* Initialize the information needed for regular hyperslab I/O */
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
const hsize_t *mem_size; /* Temporary pointer to dataspace extent's dimension sizes */
hsize_t acc; /* Accumulator for "flattened" dimension's sizes */
unsigned cont_dim = 0; /* # of contiguous dimensions */
/* Set the temporary pointer to the dimension information */
tdiminfo = space->select.sel_info.hslab->opt_diminfo;
/* Set the temporary pointer to the dataspace extent's dimension sizes */
mem_size = space->extent.size;
@ -336,9 +333,11 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Check if the regular selection can be "flattened" */
if(cont_dim > 0) {
hsize_t acc; /* Accumulator for "flattened" dimension's sizes */
unsigned last_dim_flattened = 1; /* Flag to indicate that the last dimension was flattened */
unsigned flat_rank = rank-cont_dim; /* Number of dimensions after flattening */
unsigned curr_dim; /* Current dimension */
int i; /* Index variable */
/* Set the iterator's rank to the contiguous dimensions */
iter->u.hyp.iter_rank = flat_rank;
@ -416,6 +415,8 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->u.hyp.spans = NULL;
} /* end if */
else {
H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */
/* Initialize the information needed for non-regular hyperslab I/O */
HDassert(space->select.sel_info.hslab->span_lst);
/* Make a copy of the span tree to iterate over */
@ -1443,70 +1444,65 @@ H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_sp
FUNC_ENTER_STATIC_NOERR
/* Check for redundant comparison */
/* Check for redundant comparison (or both spans being NULL) */
if(span_info1 == span_info2)
ret_value = TRUE;
else {
const H5S_hyper_span_t *span1;
const H5S_hyper_span_t *span2;
/* Check for both spans being NULL */
if(span_info1 == NULL && span_info2 == NULL)
ret_value = TRUE;
/* Check for one span being NULL */
if(span_info1 == NULL || span_info2 == NULL)
ret_value = FALSE;
else {
/* Check for one span being NULL */
if(span_info1 == NULL || span_info2 == NULL)
ret_value = FALSE;
else {
/* Get the pointers to the actual lists of spans */
span1 = span_info1->head;
span2 = span_info2->head;
const H5S_hyper_span_t *span1;
const H5S_hyper_span_t *span2;
/* Sanity checking */
HDassert(span1);
HDassert(span2);
/* Get the pointers to the actual lists of spans */
span1 = span_info1->head;
span2 = span_info2->head;
/* infinite loop which must be broken out of */
while(1) {
/* Check for both spans being NULL */
if(span1 == NULL && span2 == NULL) {
ret_value = TRUE;
/* Sanity checking */
HDassert(span1);
HDassert(span2);
/* infinite loop which must be broken out of */
while(1) {
/* Check for both spans being NULL */
if(span1 == NULL && span2 == NULL) {
ret_value = TRUE;
break;
} /* end if */
else {
/* Check for one span being NULL */
if(span1 == NULL || span2 == NULL) {
ret_value = FALSE;
break;
} /* end if */
else {
/* Check for one span being NULL */
if(span1 == NULL || span2 == NULL) {
/* Check if the actual low & high span information is the same */
if(span1->low != span2->low || span1->high != span2->high) {
ret_value = FALSE;
break;
} /* end if */
else {
/* Check if the actual low & high span information is the same */
if(span1->low != span2->low || span1->high != span2->high) {
ret_value = FALSE;
break;
} /* end if */
else {
if(span1->down != NULL || span2 != NULL) {
if(!H5S__hyper_cmp_spans(span1->down, span2->down)) {
ret_value = FALSE;
break;
} /* end if */
else {
/* Keep going... */
} /* end else */
if(span1->down != NULL || span2 != NULL) {
if(!H5S__hyper_cmp_spans(span1->down, span2->down)) {
ret_value = FALSE;
break;
} /* end if */
else {
/* Keep going... */
} /* end else */
} /* end if */
else {
/* Keep going... */
} /* end else */
} /* end else */
} /* end else */
} /* end else */
/* Advance to the next nodes in the span list */
span1 = span1->next;
span2 = span2->next;
} /* end while */
} /* end else */
/* Advance to the next nodes in the span list */
span1 = span1->next;
span2 = span2->next;
} /* end while */
} /* end else */
} /* end else */
@ -2368,17 +2364,17 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl
hsize_t *tstart; /* Temporary hyperslab pointers */
hsize_t *tend; /* Temporary hyperslab pointers */
hsize_t *tblock; /* Temporary hyperslab pointers */
size_t num_elem; /* Number of elements in selection */
size_t block_count; /* Number of blocks in selection */
unsigned v; /* Local counting variable */
/* Decode the number of points */
UINT32DECODE(pp, num_elem);
/* Decode the number of blocks */
UINT32DECODE(pp, block_count);
/* Set the count & stride for all blocks */
stride = count = H5S_hyper_ones_g;
/* Retrieve the coordinates from the buffer */
for(u = 0; u < num_elem; u++) {
for(u = 0; u < block_count; u++) {
/* Decode the starting points */
for(tstart = start, v = 0; v < rank; v++, tstart++)
UINT32DECODE(pp, *tstart);
@ -3283,10 +3279,9 @@ H5S__hyper_is_single(const H5S_t *space)
*/
/* Check for a single block */
for(u = 0; u < space->extent.rank; u++) {
for(u = 0; u < space->extent.rank; u++)
if(space->select.sel_info.hslab->opt_diminfo[u].count > 1)
HGOTO_DONE(FALSE)
} /* end for */
} /* end if */
else {
H5S_hyper_span_info_t *spans; /* Hyperslab span info node */
@ -4019,13 +4014,12 @@ done:
PURPOSE
Helper routine to detect intersections in span trees
USAGE
htri_t H5S_hyper_intersect_block_helper(spans, start, end)
hbool_t H5S__hyper_intersect_block_helper(spans, start, end)
H5S_hyper_span_info_t *spans; IN: First span tree to operate with
hssize_t *offset; IN: Selection offset coordinate
hsize_t *start; IN: Starting coordinate for block
hsize_t *end; IN: Ending coordinate for block
RETURN
Non-negative on success, negative on failure
Non-negative (TRUE/FALSE) on success, can't fail
DESCRIPTION
Quickly detect intersections between span tree and block
GLOBAL VARIABLES
@ -4369,6 +4363,7 @@ static herr_t
H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
{
H5S_hyper_span_t *prev_span = NULL; /* Pointer to previous list of spans */
unsigned delta_rank; /* Difference in dataspace ranks */
unsigned curr_dim; /* Current dimension being operated on */
herr_t ret_value = SUCCEED; /* Return value */
@ -4382,7 +4377,8 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
/* Create nodes until reaching the correct # of dimensions */
new_space->select.sel_info.hslab->span_lst = NULL;
curr_dim = 0;
while(curr_dim < (new_space->extent.rank - base_space->extent.rank)) {
delta_rank = (new_space->extent.rank - base_space->extent.rank);
while(curr_dim < delta_rank) {
H5S_hyper_span_info_t *new_span_info; /* Pointer to list of spans */
H5S_hyper_span_t *new_span; /* Temporary hyperslab span */
@ -4723,11 +4719,11 @@ done:
"Normalize" a hyperslab selection by adjusting it's coordinates by the
amount of the selection offset.
USAGE
hbool_t H5S_hyper_normalize_offset(space, old_offset)
htri_t H5S_hyper_normalize_offset(space, old_offset)
H5S_t *space; IN/OUT: Pointer to dataspace to move
hssize_t *old_offset; OUT: Pointer to space to store old offset
RETURNS
TRUE if space has been normalized, FALSE if not
TRUE/FALSE for hyperslab selection, FAIL on error
DESCRIPTION
Copies the current selection offset into the array provided, then
inverts the selection offset, subtracts the offset from the hyperslab
@ -4740,7 +4736,7 @@ done:
htri_t
H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset)
{
htri_t ret_value = FALSE; /* Return value */
htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@ -5101,10 +5097,10 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Split off upper part of span 'b' at upper span of span 'a' */
/* Check if there is actually an upper part of span 'b' to split off */
if(span_a->high<span_b->high) {
if(span_a->high < span_b->high) {
/* Allocate new span node for upper part of span 'b' */
if(NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance span 'a' */
H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
@ -5269,12 +5265,12 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
} /* end else */
/* Check if there is actually an upper part of span 'b' to split off */
if(span_a->high<span_b->high) {
if(span_a->high < span_b->high) {
/* Split off upper part of span 'b' at upper span of span 'a' */
/* Allocate new span node for upper part of spans 'a' */
if(NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
/* And advance span 'a' */
H5S__hyper_recover_span(&recover_a,&span_a,span_a->next);
@ -5294,9 +5290,9 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* AAAAAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
else if((span_a->low>=span_b->low && span_a->low<=span_b->high) && span_a->high>span_b->high) {
else if((span_a->low >= span_b->low && span_a->low <= span_b->high) && span_a->high > span_b->high) {
/* Check if there is actually a lower part of span 'b' to split off */
if(span_a->low>span_b->low) {
if(span_a->low > span_b->low) {
/* Split off lower part of span 'b' at lower span of span 'a' */
/* Merge/add lower part of span 'b' with/to b_not_a list */
@ -5364,7 +5360,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Allocate new span node for upper part of span 'a' */
if(NULL == (tmp_span = H5S__hyper_new_span(span_b->high + 1, span_a->high, span_a->down, span_a->next)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span")
/* Make upper part of span 'a' into new span 'a' */
H5S__hyper_recover_span(&recover_a,&span_a,tmp_span);
@ -5448,12 +5444,6 @@ static H5S_hyper_span_info_t *
H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans)
{
H5S_hyper_span_info_t *merged_spans = NULL; /* Pointer to the merged span tree */
H5S_hyper_span_info_t *tmp_spans; /* Pointer to temporary new span tree */
H5S_hyper_span_t *tmp_span; /* Pointer to temporary new span */
H5S_hyper_span_t *span_a; /* Pointer to current span 'a' working on */
H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */
H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */
hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
H5S_hyper_span_info_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@ -5472,6 +5462,11 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
} /* end else */
} /* end if */
else {
H5S_hyper_span_t *span_a; /* Pointer to current span 'a' working on */
H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */
H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */
hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
/* Get the pointers to the 'a' and 'b' span lists */
span_a = a_spans->head;
span_b = b_spans->head;
@ -5484,6 +5479,9 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Work through the list of spans in the new list */
while(span_a != NULL && span_b != NULL) {
H5S_hyper_span_info_t *tmp_spans; /* Pointer to temporary new span tree */
H5S_hyper_span_t *tmp_span; /* Pointer to temporary new span */
/* Check if the 'a' span is completely before 'b' span */
/* AAAAAAA */
/* <-----------------------------------> */
@ -5766,7 +5764,7 @@ done:
static herr_t
H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t can_own)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
@ -9317,21 +9315,17 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Assert that src_space and src_intersect_space have same extent and there
* are no point selections */
HDassert(H5S_GET_EXTENT_NDIMS(src_space)
== H5S_GET_EXTENT_NDIMS(src_intersect_space));
HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space));
HDassert(!HDmemcmp(src_space->extent.size, src_intersect_space->extent.size,
(size_t)H5S_GET_EXTENT_NDIMS(src_space)
* sizeof(src_space->extent.size[0])));
(size_t)H5S_GET_EXTENT_NDIMS(src_space) * sizeof(src_space->extent.size[0])));
HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_POINTS);
HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_POINTS);
HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) != H5S_SEL_POINTS);
/* Initialize prev_space, curr_span_tree, and curr_span_up_dim */
for(i = 0; i < H5S_MAX_RANK; i++) {
curr_span_tree[i] = NULL;
prev_span[i] = NULL;
curr_span_up_dim[i] = (hsize_t)0;
} /* end for */
HDmemset(curr_span_tree, 0, sizeof(curr_span_tree));
HDmemset(prev_span, 0, sizeof(prev_span));
HDmemset(curr_span_up_dim, 0, sizeof(curr_span_up_dim));
/* Save rank of projected space */
proj_rank = proj_space->extent.rank;
@ -9343,8 +9337,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
sis_nelem = (size_t)H5S_GET_SELECT_NPOINTS(src_intersect_space);
HDassert(ss_nelem == ds_nelem);
/* Calculate proj_down_dims (note loop relies on unsigned i wrapping around)
*/
/* Calculate proj_down_dims */
if(H5VM_array_down(proj_rank, proj_space->extent.size, proj_down_dims) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
@ -9358,7 +9351,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Allocate space for the hyperslab selection information (note this sets
* diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */
if((proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)) == NULL)
if(NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info")
/* Set selection type */
@ -9367,9 +9360,9 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Set unlim_dim */
proj_space->select.sel_info.hslab->unlim_dim = -1;
/* Allocate the source space iterator */
/* Allocate the source selection iterator */
if(NULL == (ss_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source space iterator")
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source selection iterator")
/* Initialize source space iterator */
if(H5S_select_iter_init(ss_iter, src_space, (size_t)1) < 0)
@ -9382,9 +9375,9 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
ss_nelem -= nelem;
HDassert(ss_nseq > 0);
/* Allocate the destination space iterator */
/* Allocate the destination selection iterator */
if(NULL == (ds_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination space iterator")
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination selection iterator")
/* Initialize destination space iterator */
if(H5S_select_iter_init(ds_iter, dst_space, (size_t)1) < 0)
@ -9443,9 +9436,8 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Reset advance_ss */
advance_ss = FALSE;
} /* end if */
if(advance_sis
|| (sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i])) {
} /* end while */
if(advance_sis || (sis_off[sis_i] + sis_len[sis_i] <= ss_off[ss_i])) {
do {
/* Either we finished the current source intersect sequence or
* the sequences do not intersect. Advance source intersect
@ -9524,8 +9516,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(ds_sel_off <= int_sel_off);
proj_off = ds_off[ds_i] + int_sel_off - ds_sel_off;
proj_len = proj_len_rem = (size_t)MIN(int_len,
(size_t)(ds_sel_off + (hsize_t)ds_len[ds_i]
- int_sel_off));
(size_t)(ds_sel_off + (hsize_t)ds_len[ds_i] - int_sel_off));
/* Add to span tree */
while(proj_len_rem > (size_t)0) {
@ -9565,7 +9556,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
(size_t)(proj_space->extent.size[proj_rank - 1]
- low));
HDassert(proj_len_rem >= span_len);
high = low + (hsize_t)span_len - (hsize_t)1;
high = (low + (hsize_t)span_len) - (hsize_t)1;
/* Append span in lowest dimension */
if(H5S__hyper_append_span(&prev_span[proj_rank - 1], &curr_span_tree[proj_rank - 1], low, high, NULL, NULL) < 0)
@ -9791,11 +9782,11 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
void
static void
H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
hsize_t *block, hsize_t clip_size)
{
FUNC_ENTER_PACKAGE_NOERR
FUNC_ENTER_STATIC_NOERR
/* Check for selection outside clip size */
if(start >= clip_size) {
@ -9819,7 +9810,7 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
} /* end else */
FUNC_LEAVE_NOAPI_VOID
} /* end H5S_hyper_get_clip_diminfo() */
} /* end H5S__hyper_get_clip_diminfo() */
/*--------------------------------------------------------------------------
@ -9836,8 +9827,7 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
Non-negative on success/Negative on failure.
DESCRIPTION
This function changes the unlimited selection into a limited selection
with the extent of the formerly unlimited dimension specified by
* clip_size.
with the extent of the formerly unlimited dimension specified by clip_size.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Note this function does not take the offset into account.
@ -9892,8 +9882,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
} /* end if */
else {
/* Calculate number of elements */
space->select.num_elem = diminfo->count * diminfo->block
* hslab->num_elem_non_unlim;
space->select.num_elem = diminfo->count * diminfo->block * hslab->num_elem_non_unlim;
/* Check if last block is partial. If superset is set, just keep the
* last block complete to speed computation. */
@ -9924,8 +9913,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
/* Indicate that the regular dimensions are no longer valid */
hslab->diminfo_valid = FALSE;
/* "And" selection with calculated block to perform clip operation
*/
/* "And" selection with calculated block to perform clip operation */
if(H5S__generate_hyperslab(space, H5S_SELECT_AND, start, H5S_hyper_ones_g, H5S_hyper_ones_g, block) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
} /* end if */
@ -10369,7 +10357,7 @@ done:
/*--------------------------------------------------------------------------
NAME
H5Sgetregular_hyperslab
H5Sget_regular_hyperslab
PURPOSE
Retrieve a regular hyperslab selection
USAGE

View File

@ -124,7 +124,7 @@ typedef struct {
* information. */
int unlim_dim; /* Dimension where selection is unlimited, or -1 if none */
hsize_t num_elem_non_unlim; /* # of elements in a "slice" excluding the unlimited dimension */
H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information */
H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information of all dimensions */
} H5S_hyper_sel_t;
/* Selection information methods */
@ -275,8 +275,7 @@ H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
/* Operations on selections */
H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space,
const H5S_t *dst_space, const H5S_t *src_intersect_space,
H5S_t *proj_space);
const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space);
H5_DLL herr_t H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space);
/* Testing functions */

View File

@ -775,7 +775,6 @@ done:
static hssize_t
H5S_point_serial_size (const H5S_t *space)
{
H5S_pnt_node_t *curr; /* Point information nodes */
hssize_t ret_value = -1; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@ -789,12 +788,8 @@ H5S_point_serial_size (const H5S_t *space)
ret_value = 24;
/* Count points in selection */
curr=space->select.sel_info.pnt_lst->head;
while(curr!=NULL) {
/* Add 4 bytes times the rank for each element selected */
ret_value+=4*space->extent.rank;
curr=curr->next;
} /* end while */
/* (Add 4 bytes times the rank for each element selected) */
ret_value += (4 * space->extent.rank) * (hssize_t)H5S_GET_SELECT_NPOINTS(space);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_point_serial_size() */

View File

@ -1515,14 +1515,20 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
/* Make the application callback */
user_ret = (op->u.app_op.op)(loc, op->u.app_op.type_id, ndims, coords, op_data);
break;
case H5S_SEL_ITER_OP_LIB:
/* Call the library's callback */
user_ret = (op->u.lib_op)(loc, type, ndims, coords, op_data);
break;
default:
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported op type")
} /* end switch */
/* Check for error return from iterator */
if(user_ret < 0)
HERROR(H5E_DATASPACE, H5E_CANTNEXT, "iteration operator failed");
/* Increment offset in dataspace */
curr_off += elmt_size;
@ -1709,10 +1715,6 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
HDassert(space_a_rank >= space_b_rank);
HDassert(space_b_rank > 0);
/* Check for different number of elements selected */
if(H5S_GET_SELECT_NPOINTS(space_a) != H5S_GET_SELECT_NPOINTS(space_b))
HGOTO_DONE(FALSE)
/* Check for "easy" cases before getting into generalized block iteration code */
if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_ALL) && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_ALL)) {
hsize_t dims1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */

View File

@ -1308,14 +1308,8 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) {
if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12))
TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__);
#ifdef QAK
for(i=0, tbuf=wbuf; i<12; i++)
for(j=0; j<30; j++)
printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j));
#endif /* QAK */
} /* end if */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@ -1432,14 +1426,8 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) {
if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1))
TestErrPrintf("Error: hyperslab values don't match!\n");
#ifdef QAK
for(i=0, tbuf=wbuf; i<12; i++)
for(j=0; j<30; j++)
printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j));
#endif /* QAK */
} /* end if */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@ -3743,15 +3731,8 @@ test_select_hyper_copy(void)
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) {
if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2))
TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__);
#ifdef QAK
for(i=0; i<SPACE3_DIM1; i++)
for(j=0; j<SPACE3_DIM2; j++)
if((unsigned)*(rbuf+i*SPACE3_DIM2+j)!=(unsigned)*(rbuf2+i*SPACE3_DIM2+j))
printf("i=%d, j=%d, *rbuf=%u, *rbuf2=%u\n",i,j,(unsigned)*(rbuf+i*SPACE3_DIM2+j),(unsigned)*(rbuf2+i*SPACE3_DIM2+j));
#endif /* QAK */
} /* end if */
/* Close memory dataspace */
ret = H5Sclose(sid2);
@ -5220,7 +5201,7 @@ test_select_hyper_union_3d(void)
tmp2_space = H5Scombine_select(sid2,H5S_SELECT_OR,tmp_space);
CHECK(tmp2_space, FAIL, "H5Scombin_select");
npoints = H5Sget_select_npoints(tmp2_space);
npoints = (hsize_t)H5Sget_select_npoints(tmp2_space);
VERIFY(npoints, 15*26, "H5Sget_select_npoints");
/* Create a dataset */
@ -5902,37 +5883,20 @@ test_select_hyper_union_random_5d(hid_t read_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Get initial random # seed */
seed=(unsigned)time(NULL)+(unsigned)clock();
seed = (unsigned)HDtime(NULL) + (unsigned)HDclock();
/* Crunch through a bunch of random hyperslab reads from the file dataset */
for(test_num=0; test_num<NRAND_HYPER; test_num++) {
/* Save random # seed for later use */
/* (Used in case of errors, to regenerate the hyperslab sequence) */
#ifndef QAK
seed+=(unsigned)clock();
#else /* QAK */
seed=987909620;
#endif /* QAK */
seed += (unsigned)HDclock();
HDsrandom(seed);
#ifdef QAK
printf("test_num=%d, seed=%u\n",test_num,seed);
#endif /* QAK */
#ifndef QAK
for(i=0; i<NHYPERSLABS; i++) {
#else /* QAK */
for(i=0; i<2; i++) {
#endif /* QAK */
#ifdef QAK
printf("hyperslab=%d\n",i);
#endif /* QAK */
/* Select random hyperslab location & size for selection */
for(j=0; j<SPACE5_RANK; j++) {
start[j] = ((hsize_t)HDrandom() % dims1[j]);
count[j] = (((hsize_t)HDrandom() % (dims1[j] - start[j])) + 1);
#ifdef QAK
printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[j],j,(int)(start[j]+count[j]-1));
#endif /* QAK */
} /* end for */
/* Select hyperslab */
@ -5953,41 +5917,9 @@ printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[
npoints2 = H5Sget_select_npoints(sid2);
VERIFY(npoints, npoints2, "H5Sget_select_npoints");
#ifdef QAK
printf("random I/O, before H5Dread(), npoints=%lu\n",(unsigned long)npoints);
{
hsize_t blocks[128][2][SPACE5_RANK];
hssize_t nblocks;
int k;
nblocks=H5Sget_select_hyper_nblocks(sid1);
printf("nblocks=%d\n",(int)nblocks);
H5Sget_select_hyper_blocklist(sid1,0,nblocks,blocks);
for(j=0; j<nblocks; j++) {
printf("Block #%d, start = {",j);
for(k=0; k<SPACE5_RANK; k++) {
printf("%d",blocks[j][0][k]);
if(k<(SPACE5_RANK-1))
printf(", ");
else
printf("}, end = {");
} /* end for */
for(k=0; k<SPACE5_RANK; k++) {
printf("%d",blocks[j][1][k]);
if(k<(SPACE5_RANK-1))
printf(", ");
else
printf("}\n");
} /* end for */
} /* end for */
}
#endif /* QAK */
/* Read selection from disk */
ret=H5Dread(dataset,H5T_NATIVE_INT,sid2,sid1,read_plist,rbuf);
CHECK(ret, FAIL, "H5Dread");
#ifdef QAK
printf("random I/O, after H5Dread()\n");
#endif /* QAK */
/* Compare data read with data written out */
tbuf=rbuf;