summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repacktst.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2012-09-24 23:13:57 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2012-09-24 23:13:57 (GMT)
commit50e3990f2a9e3bba421460d8d5cb21bb6f6e98fe (patch)
tree764c642d62a1082e02cb0004871dc33b81dbff08 /tools/h5repack/h5repacktst.c
parent528bd520b83136e9c50ac6cff4ac116fc8054e7a (diff)
downloadhdf5-50e3990f2a9e3bba421460d8d5cb21bb6f6e98fe.zip
hdf5-50e3990f2a9e3bba421460d8d5cb21bb6f6e98fe.tar.gz
hdf5-50e3990f2a9e3bba421460d8d5cb21bb6f6e98fe.tar.bz2
[svn-r22805] Purpose:
HDFFV-8012 - h5repack changes max dims and cause failure if only "-f none" is used without changing layout for chunked dataset when a chunk dim is bigger than a dataset dim Description: "h5repack -f <obj>:NONE <file.h5> out.h5" command failed if source file contains chunked dataset and a chunk dim is bigger than a dataset dim. Another issue is that the command changed max dims if chunk dim is smaller than the dataset dim. These issue occurred when dataset size is smaller than 64k (compact size limit) Fixed them. Tested: jam (linux32-LE), koala (linux64-LE), ostrich (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows (32-LE cmake), cmake (jam)
Diffstat (limited to 'tools/h5repack/h5repacktst.c')
-rw-r--r--tools/h5repack/h5repacktst.c101
1 files changed, 79 insertions, 22 deletions
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 4f1707b..791e268 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -3104,65 +3104,119 @@ out:
*/
#define DIM1_L3 300
#define DIM2_L3 200
+/* small size */
+#define SDIM1_L3 4
+#define SDIM2_L3 50
static
int make_layout3(hid_t loc_id)
{
- hid_t dcpl=-1; /* dataset creation property list */
- hid_t sid=-1; /* dataspace ID */
- hsize_t dims[RANK]={DIM1_L3,DIM2_L3};
+ hid_t dcpl1=-1; /* dataset creation property list */
+ hid_t dcpl2=-1; /* dataset creation property list */
+ hid_t dcpl3=-1; /* dataset creation property list */
+ hid_t sid1=-1; /* dataspace ID */
+ hid_t sid2=-1; /* dataspace ID */
+ hsize_t dims1[RANK]={DIM1_L3,DIM2_L3};
+ hsize_t dims2[RANK]={SDIM1_L3,SDIM2_L3};
hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[RANK]={DIM1_L3*2,5};
- int buf[DIM1_L3][DIM2_L3];
+ hsize_t chunk_dims1[RANK]={DIM1_L3*2,5};
+ hsize_t chunk_dims2[RANK]={SDIM1_L3 + 2, SDIM2_L3/2};
+ hsize_t chunk_dims3[RANK]={SDIM1_L3 - 2, SDIM2_L3/2};
+ int buf1[DIM1_L3][DIM2_L3];
+ int buf2[SDIM1_L3][SDIM2_L3];
int i, j, n;
+ /* init buf1 */
for (i=n=0; i<DIM1_L3; i++)
{
for (j=0; j<DIM2_L3; j++)
{
- buf[i][j]=n++;
+ buf1[i][j]=n++;
+ }
+ }
+
+ /* init buf2 */
+ for (i=n=0; i<SDIM1_L3; i++)
+ {
+ for (j=0; j<SDIM2_L3; j++)
+ {
+ buf2[i][j]=n++;
}
}
/*-------------------------------------------------------------------------
- * make several dataset with several layout options
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size bigger than compact max (64K)
*-------------------------------------------------------------------------
*/
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if((sid1 = H5Screate_simple(RANK, dims1, maxdims)) < 0)
return -1;
/* create a dataset creation property list; the same DCPL is used for all dsets */
- if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
{
goto out;
}
+ if(H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0)
+ goto out;
+ if (make_dset(loc_id,"chunk_unlimit1",sid1,dcpl1,buf1) < 0)
+ {
+ goto out;
+ }
/*-------------------------------------------------------------------------
- * H5D_CHUNKED
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size smaller than compact (64K)
*-------------------------------------------------------------------------
*/
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+
+ /* create a space */
+ if((sid2 = H5Screate_simple(RANK, dims2, maxdims)) < 0)
+ return -1;
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if (make_dset(loc_id,"chunk_unlimit1",sid,dcpl,buf) < 0)
- {
+
+ if(H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0)
goto out;
- }
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ if (make_dset(loc_id,"chunk_unlimit2",sid2,dcpl2,buf2) < 0)
goto out;
- if (make_dset(loc_id,"chunk_unlimit2",sid,dcpl,buf) < 0)
- {
+ /*-------------------------------------------------------------------------
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dims are smaller than dset dims
+ * - dset size smaller than compact (64K)
+ *-------------------------------------------------------------------------
+ */
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ if ((dcpl3 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+
+ if(H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0)
+ goto out;
+
+ if (make_dset(loc_id,"chunk_unlimit3",sid2,dcpl3,buf2) < 0)
goto out;
- }
/*-------------------------------------------------------------------------
* close space and dcpl
*-------------------------------------------------------------------------
*/
- if(H5Sclose(sid) < 0)
+ if(H5Sclose(sid1) < 0)
goto out;
- if(H5Pclose(dcpl) < 0)
+ if(H5Sclose(sid2) < 0)
+ goto out;
+ if(H5Pclose(dcpl1) < 0)
+ goto out;
+ if(H5Pclose(dcpl2) < 0)
+ goto out;
+ if(H5Pclose(dcpl3) < 0)
goto out;
return 0;
@@ -3170,8 +3224,11 @@ int make_layout3(hid_t loc_id)
out:
H5E_BEGIN_TRY
{
- H5Pclose(dcpl);
- H5Sclose(sid);
+ H5Sclose(sid1);
+ H5Sclose(sid2);
+ H5Pclose(dcpl1);
+ H5Pclose(dcpl2);
+ H5Pclose(dcpl3);
} H5E_END_TRY;
return -1;
}