summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-06-12 22:04:35 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-06-12 22:04:35 (GMT)
commit4117cfe2b9e19a79e00c5176f354f906235f1b80 (patch)
treef059fde101de2ba0463c8a63c305ee8d240fc48b /src
parent78e128c544064ba4861a3eb7a72908e7ae7916eb (diff)
downloadhdf5-4117cfe2b9e19a79e00c5176f354f906235f1b80.zip
hdf5-4117cfe2b9e19a79e00c5176f354f906235f1b80.tar.gz
hdf5-4117cfe2b9e19a79e00c5176f354f906235f1b80.tar.bz2
[svn-r27197] Improve performance of "printf" VDS with selections in the file space - the
library no longer iterates over all source datasets in the printf mapping, it now only looks at the ones that could be involved in I/O (the ones whose bounds overlap with the selection in the unlimited dimension). Tested: ummon
Diffstat (limited to 'src')
-rw-r--r--src/H5Dvirtual.c58
-rw-r--r--src/H5Oprivate.h2
-rw-r--r--src/H5Shyper.c16
3 files changed, 60 insertions, 16 deletions
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index bfd4e0c..f6a16ee 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -1493,6 +1493,10 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
const H5S_t *mem_space, hsize_t *tot_nelmts)
{
hssize_t select_nelmts; /* Number of elements in selection */
+ hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */
+ hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */
+ int rank;
+ hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */
size_t i, j; /* Local index variables */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1519,12 +1523,44 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
/* Check for "printf" source dataset resolution */
if(storage->list[i].parsed_source_file_name
|| storage->list[i].parsed_source_dset_name) {
+ hbool_t partial_block;
+
+ HDassert(storage->list[i].unlim_dim_virtual >= 0);
+
+ /* Get selection bounds if necessary */
+ if(!bounds_init) {
+ /* Get rank of VDS */
+ if((rank = H5S_GET_EXTENT_NDIMS(io_info->dset->shared->space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions")
+
+ /* Get selection bounds */
+ if(H5S_SELECT_BOUNDS(file_space, bounds_start, bounds_end) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds")
+
+ /* Adjust bounds_end to represent the extent just enclosing them
+ * (add 1) */
+ for(j = 0; j < (size_t)rank; j++)
+ bounds_end[j]++;
+
+ /* Bounds are now initialized */
+ bounds_init = TRUE;
+ } /* end if */
+
+ /* Get index of first block in virtual selection */
+ storage->list[i].sub_dset_io_start = (size_t)H5S_hyper_get_first_inc_block(storage->list[i].source_dset.virtual_select, bounds_start[storage->list[i].unlim_dim_virtual], NULL);
+
+ /* Get index of first block outside of virtual selection */
+ storage->list[i].sub_dset_io_end = (size_t)H5S_hyper_get_first_inc_block(storage->list[i].source_dset.virtual_select, bounds_end[storage->list[i].unlim_dim_virtual], &partial_block);
+ if(partial_block)
+ storage->list[i].sub_dset_io_end++;
+ if(storage->list[i].sub_dset_io_end > storage->list[i].sub_dset_nused)
+ storage->list[i].sub_dset_io_end = storage->list[i].sub_dset_nused;
+
/* Iterate over sub-source dsets */
- for(j = 0; j < storage->list[i].sub_dset_nused; j++) {
- /* Check for no clipped selection. This should be an assertion
- * once we have I/O scoping for printf working VDSINC */
- if(!storage->list[i].sub_dset[j].clipped_virtual_select)
- break;
+ for(j = storage->list[i].sub_dset_io_start;
+ j < storage->list[i].sub_dset_io_end; j++) {
+ /* There should always be a clipped virtual selection here */
+ HDassert(storage->list[i].sub_dset[j].clipped_virtual_select);
/* Project intersection of file space and mapping virtual space
* onto memory space */
@@ -1634,7 +1670,8 @@ H5D__virtual_post_io(H5O_storage_virtual_t *storage)
if(storage->list[i].parsed_source_file_name
|| storage->list[i].parsed_source_dset_name) {
/* Iterate over sub-source dsets */
- for(j = 0; j < storage->list[i].sub_dset_nused; j++)
+ for(j = storage->list[i].sub_dset_io_start;
+ j < storage->list[i].sub_dset_io_end; j++)
/* Close projected memory space */
if(storage->list[i].sub_dset[j].projected_mem_space) {
if(H5S_close(storage->list[i].sub_dset[j].projected_mem_space) < 0)
@@ -1761,7 +1798,8 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
if(storage->list[i].parsed_source_file_name
|| storage->list[i].parsed_source_dset_name) {
/* Iterate over sub-source dsets */
- for(j = 0; j < storage->list[i].sub_dset_nused; j++)
+ for(j = storage->list[i].sub_dset_io_start;
+ j < storage->list[i].sub_dset_io_end; j++)
if(H5D__virtual_read_one(io_info, type_info, file_space, &storage->list[i].sub_dset[j]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read source dataset")
} /* end if */
@@ -1785,7 +1823,8 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
if(storage->list[i].parsed_source_file_name
|| storage->list[i].parsed_source_dset_name) {
/* Iterate over sub-source dsets */
- for(j = 0; j < storage->list[i].sub_dset_nused; j++)
+ for(j = storage->list[i].sub_dset_io_start;
+ j < storage->list[i].sub_dset_io_end; j++)
if(storage->list[i].sub_dset[j].projected_mem_space)
if(H5S_select_subtract(fill_space, storage->list[i].sub_dset[j].projected_mem_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection")
@@ -1942,7 +1981,8 @@ H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
if(storage->list[i].parsed_source_file_name
|| storage->list[i].parsed_source_dset_name) {
/* Iterate over sub-source dsets */
- for(j = 0; j < storage->list[i].sub_dset_nused; j++) {
+ for(j = storage->list[i].sub_dset_io_start;
+ j < storage->list[i].sub_dset_io_end; j++) {
HDassert(0 && "Checking code coverage..."); //VDSINC
if(H5D__virtual_write_one(io_info, type_info, file_space, &storage->list[i].sub_dset[j]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to write to source dataset")
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 604dd73..8462382 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -449,6 +449,8 @@ typedef struct H5O_storage_virtual_ent_t {
H5O_storage_virtual_srcdset_t *sub_dset; /* Array of sub-source dataset info structs */
size_t sub_dset_nalloc; /* Number of slots allocated in sub_dset */
size_t sub_dset_nused; /* Number of slots "used" in sub_dset - essentially the farthest sub dataset in the extent */
+ size_t sub_dset_io_start; /* First element in sub_dset involved in current I/O op. Field has no meaning and may be uninitialized at all other times */
+ size_t sub_dset_io_end; /* First element in sub_dset outside of current I/O op. Field has no meaning and may be uninitialized at all other times */
H5O_storage_virtual_name_seg_t *parsed_source_file_name; /* Parsed version of source_dset.file_name */
size_t psfn_static_strlen; /* Length of parsed_source_file_name without block number substitutions */
size_t psfn_nsubs; /* Number of block number substitutions in parsed_source_file_name */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index db81211..fb34981 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -10180,25 +10180,27 @@ H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size,
HDassert(hslab);
HDassert(hslab->unlim_dim >= 0);
HDassert(hslab->opt_unlim_diminfo[hslab->unlim_dim].count == H5S_UNLIMITED);
- HDassert(partial);
diminfo = &hslab->opt_unlim_diminfo[hslab->unlim_dim];
/* Check for selection outside of clip_size */
if(diminfo->start >= clip_size) {
ret_value = 0;
- partial = FALSE;
+ if(partial)
+ partial = FALSE;
} /* end if */
else {
/* Calculate index of first incomplete block */
ret_value = (clip_size - diminfo->start + diminfo->stride
- diminfo->block) / diminfo->stride;
- /* Check for partial block */
- if((diminfo->stride * ret_value) < (clip_size - diminfo->start))
- *partial = TRUE;
- else
- *partial = FALSE;
+ if(partial) {
+ /* Check for partial block */
+ if((diminfo->stride * ret_value) < (clip_size - diminfo->start))
+ *partial = TRUE;
+ else
+ *partial = FALSE;
+ } /* end if */
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)