From 30eaf92786a6b3d07f00082f03a8215ed1335ff2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 2 Apr 2002 15:44:48 -0500 Subject: [svn-r5129] Purpose: Bug Fix Description: The selection offset was being ignored for certain optimized hyperslab selection I/O operations. Solution: Include the selection offset in the calculation of the location of the hyperslab to operate on. Platforms tested: FreeBSD 4.5 (sleipnir) --- release_docs/RELEASE.txt | 15 +++--- src/H5Sall.c | 4 ++ test/tselect.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 139 insertions(+), 8 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 9394ba5..fd0da60 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -65,15 +65,18 @@ New Features Bug Fixes since HDF5-1.4.3 Release ================================== + * Fixed bug where selection offset was being ignored for certain hyperslab + selections when optimized I/O was being performed. QAK - 2002/04/02 + * Fixed limitation in h5dumper with object names which reached over 1024 + characters in length. We can now handle arbitrarily larger sizes for + object names. BW - 2002/03/29 + * Fixed bug where variable-length string type doesn't behave as + string. SLU - 2002/03/28 * Fixed bug in H5Gget_objinfo() which was not setting the 'fileno' - of the H5G_stat_t struct. QAK - 3/27/02 + of the H5G_stat_t struct. QAK - 2002/03/27 * Fixed data corruption bug in hyperslab routines when contiguous hyperslab that spans entire dimension and is larger than type - conversion buffer is attempted to be read. QAK - 3/26/02 - * Fixed bug where variable-length string type doesn't behave as string. - * Fixed limitation in h5dumper with object names which reached over 1024 - characters in length. We can now handle arbitrarily larger sizes for - object names. BW - 3/29/02 + conversion buffer is attempted to be read. QAK - 2002/03/26 Documentation diff --git a/src/H5Sall.c b/src/H5Sall.c index 7388070..4106549 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -479,6 +479,7 @@ printf("%s: check 1.0\n",FUNC); mem_size=(mem_node->end[u]-mem_node->start[u])+1; mem_off=mem_node->start[u]; } /* end else */ + mem_off+=mem_space->select.offset[u]; } /* end if */ else { mem_size=mem_space->extent.u.simple.size[u]; @@ -495,6 +496,7 @@ printf("%s: check 1.0\n",FUNC); file_size=(file_node->end[u]-file_node->start[u])+1; file_off=file_node->start[u]; } /* end else */ + file_off+=file_space->select.offset[u]; } /* end if */ else { file_size=file_space->extent.u.simple.size[u]; @@ -708,6 +710,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout, mem_size=(mem_node->end[u]-mem_node->start[u])+1; mem_off=mem_node->start[u]; } /* end else */ + mem_off+=mem_space->select.offset[u]; } /* end if */ else { mem_size=mem_space->extent.u.simple.size[u]; @@ -724,6 +727,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout, file_size=(file_node->end[u]-file_node->start[u])+1; file_off=file_node->start[u]; } /* end else */ + file_off+=file_space->select.offset[u]; } /* end if */ else { file_size=file_space->extent.u.simple.size[u]; diff --git a/test/tselect.c b/test/tselect.c index 8d34219..71b265e 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -80,6 +80,12 @@ #define SPACE7_DIM3 17 #define SPACE7_DIM4 19 +/* 2-D dataset with easy dimensions */ +#define SPACE8_NAME "Space8" +#define SPACE8_RANK 2 +#define SPACE8_DIM1 10 +#define SPACE8_DIM2 10 + /* Element selection information */ #define POINT1_NPOINTS 10 @@ -1220,9 +1226,7 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims2[] = {SPACE7_DIM4, SPACE7_DIM3, SPACE7_DIM2, SPACE7_DIM1}; hssize_t start[SPACE7_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE7_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE7_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE7_RANK]; /* Block size of hyperslab */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ @@ -1814,6 +1818,125 @@ test_select_hyper_offset(void) /**************************************************************** ** +** test_select_hyper_offset2(): Test basic H5S (dataspace) selection code. +** Tests optimized hyperslab I/O with selection offsets. +** +****************************************************************/ +static void +test_select_hyper_offset2(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE8_DIM1, SPACE8_DIM2}; + hsize_t dims2[] = {SPACE8_DIM1, SPACE8_DIM2}; + hssize_t start[SPACE8_RANK]; /* Starting location of hyperslab */ + hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */ + hssize_t offset[SPACE8_RANK]; /* Offset of selection */ + uint8_t *wbuf, /* buffer to write to disk */ + *rbuf, /* buffer read from disk */ + *tbuf, /* temporary buffer pointer */ + *tbuf2; /* temporary buffer pointer */ + int i,j; /* Counters */ + herr_t ret; /* Generic return value */ + htri_t valid; /* Generic boolean return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing More Hyperslab Selection Functions with Offsets\n")); + + /* Allocate write & read buffers */ + wbuf=malloc(sizeof(uint8_t)*SPACE8_DIM1*SPACE8_DIM2); + rbuf=calloc(sizeof(uint8_t),SPACE8_DIM1*SPACE8_DIM2); + + /* Initialize write buffer */ + for(i=0, tbuf=wbuf; i