summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repacktst.c
diff options
context:
space:
mode:
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;
}