summaryrefslogtreecommitdiffstats
path: root/tools/test/h5repack/h5repacktst.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/test/h5repack/h5repacktst.c')
-rw-r--r--tools/test/h5repack/h5repacktst.c230
1 files changed, 155 insertions, 75 deletions
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index b62fa53..e7cc21a 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -624,7 +624,7 @@ main(void)
SKIPPED();
#endif
- TESTING(" addding shuffle filter");
+ TESTING(" adding shuffle filter");
/*-------------------------------------------------------------------------
* test an individual object option
@@ -653,7 +653,7 @@ main(void)
*-------------------------------------------------------------------------
*/
- TESTING(" addding shuffle filter to all");
+ TESTING(" adding shuffle filter to all");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1592,17 +1592,17 @@ main(void)
#endif
/*-------------------------------------------------------------------------
- * test file with aligment
+ * test file with alignment
*-------------------------------------------------------------------------
*/
- TESTING(" file with aligment");
+ TESTING(" file with alignment");
#ifdef H5_HAVE_FILTER_DEFLATE
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- /* add the options for aligment */
+ /* add the options for alignment */
pack_options.alignment = 1;
pack_options.threshold = 1;
@@ -1613,7 +1613,7 @@ main(void)
if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
GOERROR;
- /* verify aligment */
+ /* verify alignment */
{
hsize_t threshold;
hsize_t alignment;
@@ -2432,14 +2432,15 @@ make_szip(hid_t loc_id)
unsigned szip_pixels_per_block = 8;
hsize_t dims[RANK] = {DIM1, DIM2};
hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int ** buf = NULL;
int szip_can_encode = 0;
/* Create and fill array */
- H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
if (NULL == buf)
goto error;
- H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/* create a space */
if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
@@ -2463,7 +2464,7 @@ make_szip(hid_t loc_id)
/* set szip data */
if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0)
goto error;
- if (make_dset(loc_id, "dset_szip", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_szip", sid, dcpl, buf) < 0)
goto error;
}
else
@@ -2506,15 +2507,16 @@ make_deflate(hid_t loc_id)
hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK] = {DIM1, DIM2};
hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int ** buf = NULL;
hobj_ref_t bufref[1]; /* reference */
hsize_t dims1r[1] = {1};
/* Create and fill array */
- H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
if (NULL == buf)
goto error;
- H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/* create a space */
if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
@@ -2534,7 +2536,7 @@ make_deflate(hid_t loc_id)
/* set deflate data */
if (H5Pset_deflate(dcpl, 9) < 0)
goto error;
- if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf) < 0)
goto error;
/* create a reference to the dataset, test second seeep of file for references */
@@ -2585,13 +2587,14 @@ make_shuffle(hid_t loc_id)
hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK] = {DIM1, DIM2};
hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int ** buf = NULL;
/* Create and fill array */
- H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
if (NULL == buf)
goto error;
- H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/* create a space */
if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
@@ -2611,7 +2614,7 @@ make_shuffle(hid_t loc_id)
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
goto error;
- if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -2654,13 +2657,14 @@ make_fletcher32(hid_t loc_id)
hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK] = {DIM1, DIM2};
hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int ** buf = NULL;
/* Create and fill array */
- H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
if (NULL == buf)
goto error;
- H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/* create a space */
if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
@@ -2683,7 +2687,7 @@ make_fletcher32(hid_t loc_id)
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
goto error;
- if (make_dset(loc_id, "dset_fletcher32", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_fletcher32", sid, dcpl, buf) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -2726,15 +2730,17 @@ make_nbit(hid_t loc_id)
hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hid_t dtid = H5I_INVALID_HID;
hid_t dsid = H5I_INVALID_HID;
+ hid_t dxpl = H5P_DEFAULT;
hsize_t dims[RANK] = {DIM1, DIM2};
hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int ** buf = NULL;
/* Create and fill array */
- H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
if (NULL == buf)
goto error;
- H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/* create a space */
if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
@@ -2746,6 +2752,16 @@ make_nbit(hid_t loc_id)
if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
+ }
+#endif
+
dtid = H5Tcopy(H5T_NATIVE_INT);
if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0)
goto error;
@@ -2757,7 +2773,7 @@ make_nbit(hid_t loc_id)
goto error;
if ((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
goto error;
H5Dclose(dsid);
@@ -2765,7 +2781,7 @@ make_nbit(hid_t loc_id)
goto error;
if ((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
goto error;
H5Dclose(dsid);
@@ -2773,6 +2789,8 @@ make_nbit(hid_t loc_id)
* close
*-------------------------------------------------------------------------
*/
+ if (dxpl != H5P_DEFAULT && H5Pclose(dxpl) < 0)
+ goto error;
if (H5Sclose(sid) < 0)
goto error;
if (H5Pclose(dcpl) < 0)
@@ -2788,6 +2806,7 @@ error:
H5E_BEGIN_TRY
{
H5Tclose(dtid);
+ H5Pclose(dxpl);
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(dsid);
@@ -2813,15 +2832,17 @@ make_scaleoffset(hid_t loc_id)
hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hid_t dtid = H5I_INVALID_HID;
hid_t dsid = H5I_INVALID_HID;
+ hid_t dxpl = H5P_DEFAULT;
hsize_t dims[RANK] = {DIM1, DIM2};
hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int ** buf = NULL;
/* Create and fill array */
- H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
if (NULL == buf)
goto error;
- H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/* create a space */
if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
@@ -2833,6 +2854,16 @@ make_scaleoffset(hid_t loc_id)
if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
+ }
+#endif
+
dtid = H5Tcopy(H5T_NATIVE_INT);
/* remove the filters from the dcpl */
@@ -2842,20 +2873,22 @@ make_scaleoffset(hid_t loc_id)
goto error;
if ((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
goto error;
H5Dclose(dsid);
if ((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
goto error;
H5Tclose(dtid);
H5Dclose(dsid);
/*-------------------------------------------------------------------------
- * close space and dcpl
+ * close space, dxpl and dcpl
*-------------------------------------------------------------------------
*/
+ if (dxpl != H5P_DEFAULT && H5Pclose(dxpl) < 0)
+ goto error;
if (H5Sclose(sid) < 0)
goto error;
if (H5Pclose(dcpl) < 0)
@@ -2868,6 +2901,7 @@ make_scaleoffset(hid_t loc_id)
error:
H5E_BEGIN_TRY
{
+ H5Pclose(dxpl);
H5Dclose(dsid);
H5Tclose(dtid);
H5Pclose(dcpl);
@@ -2894,22 +2928,24 @@ make_all_filters(hid_t loc_id)
hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hid_t dtid = H5I_INVALID_HID;
hid_t dsid = H5I_INVALID_HID;
+ hid_t dxpl = H5P_DEFAULT;
#if defined(H5_HAVE_FILTER_SZIP)
unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block = 8;
#endif /* H5_HAVE_FILTER_SZIP */
hsize_t dims[RANK] = {DIM1, DIM2};
hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int ** buf = NULL;
#if defined(H5_HAVE_FILTER_SZIP)
int szip_can_encode = 0;
#endif
/* Create and fill array */
- H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
if (NULL == buf)
goto error;
- H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/* create a space */
if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
@@ -2921,6 +2957,16 @@ make_all_filters(hid_t loc_id)
if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
+ }
+#endif
+
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
goto error;
@@ -2949,7 +2995,7 @@ make_all_filters(hid_t loc_id)
goto error;
#endif
- if (make_dset(loc_id, "dset_all", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_all", sid, dcpl, buf) < 0)
goto error;
/* remove the filters from the dcpl */
@@ -2958,7 +3004,7 @@ make_all_filters(hid_t loc_id)
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
goto error;
- if (make_dset(loc_id, "dset_fletcher32", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_fletcher32", sid, dcpl, buf) < 0)
goto error;
/* Make sure encoding is enabled */
@@ -2970,7 +3016,7 @@ make_all_filters(hid_t loc_id)
/* set szip data */
if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0)
goto error;
- if (make_dset(loc_id, "dset_szip", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_szip", sid, dcpl, buf) < 0)
goto error;
}
else {
@@ -2984,7 +3030,7 @@ make_all_filters(hid_t loc_id)
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
goto error;
- if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf) < 0)
goto error;
#if defined(H5_HAVE_FILTER_DEFLATE)
@@ -2994,7 +3040,7 @@ make_all_filters(hid_t loc_id)
/* set deflate data */
if (H5Pset_deflate(dcpl, 1) < 0)
goto error;
- if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf) < 0)
goto error;
#endif
@@ -3010,7 +3056,7 @@ make_all_filters(hid_t loc_id)
goto error;
if ((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
goto error;
/* close */
@@ -3021,6 +3067,8 @@ make_all_filters(hid_t loc_id)
if (H5Sclose(sid) < 0)
goto error;
+ if (dxpl != H5P_DEFAULT && H5Pclose(dxpl) < 0)
+ goto error;
if (H5Pclose(dcpl) < 0)
goto error;
@@ -3033,6 +3081,7 @@ error:
{
H5Tclose(dtid);
H5Dclose(dsid);
+ H5Pclose(dxpl);
H5Pclose(dcpl);
H5Sclose(sid);
}
@@ -3152,15 +3201,16 @@ make_layout(hid_t loc_id)
hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK] = {DIM1, DIM2};
hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int ** buf = NULL;
int i;
char name[16];
/* Create and fill array */
- H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
if (NULL == buf)
goto error;
- H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/*-------------------------------------------------------------------------
* make several dataset with no filters
@@ -3168,7 +3218,7 @@ make_layout(hid_t loc_id)
*/
for (i = 0; i < 4; i++) {
HDsprintf(name, "dset%d", i + 1);
- if (write_dset(loc_id, RANK, dims, name, H5T_NATIVE_INT, buf[0]) < 0)
+ if (write_dset(loc_id, RANK, dims, name, H5T_NATIVE_INT, buf) < 0)
goto error;
}
@@ -3189,7 +3239,7 @@ make_layout(hid_t loc_id)
*/
if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
goto error;
- if (make_dset(loc_id, "dset_compact", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_compact", sid, dcpl, buf) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -3198,7 +3248,7 @@ make_layout(hid_t loc_id)
*/
if (H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0)
goto error;
- if (make_dset(loc_id, "dset_contiguous", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_contiguous", sid, dcpl, buf) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -3207,7 +3257,7 @@ make_layout(hid_t loc_id)
*/
if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
- if (make_dset(loc_id, "dset_chunk", sid, dcpl, buf[0]) < 0)
+ if (make_dset(loc_id, "dset_chunk", sid, dcpl, buf) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -3264,13 +3314,13 @@ make_layout2(hid_t loc_id)
hsize_t s_dims[RANK] = {S_DIM1, S_DIM2}; /* Dataspace (< 1 k) */
hsize_t chunk_dims[RANK] = {S_DIM1 / 2, S_DIM2 / 2}; /* Dimension sizes for chunks */
- int **s_buf = NULL; /* Temporary buffer */
-
/* Create and fill array */
- H5TEST_ALLOCATE_2D_ARRAY(s_buf, int, S_DIM1, S_DIM2);
+ struct {
+ int arr[S_DIM1][S_DIM2];
+ } *s_buf = malloc(sizeof(*s_buf));
if (NULL == s_buf)
goto error;
- H5TEST_FILL_2D_ARRAY(s_buf, int, S_DIM1, S_DIM2);
+ H5TEST_FILL_2D_HEAP_ARRAY(s_buf, int);
/* Create dataspaces */
if ((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0)
@@ -3281,7 +3331,7 @@ make_layout2(hid_t loc_id)
goto error;
if (H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0)
goto error;
- if (make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf[0]) < 0)
+ if (make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf) < 0)
goto error;
/* Create chunked datasets */
@@ -3289,7 +3339,7 @@ make_layout2(hid_t loc_id)
goto error;
if (H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0)
goto error;
- if (make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf[0]) < 0)
+ if (make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf) < 0)
goto error;
ret_value = 0;
@@ -3343,19 +3393,21 @@ make_layout3(hid_t loc_id)
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 = NULL;
- int ** buf2 = NULL;
- /* Create and fill arrays */
- H5TEST_ALLOCATE_2D_ARRAY(buf1, int, DIM1_L3, DIM2_L3);
- if (NULL == buf1)
- goto error;
- H5TEST_FILL_2D_ARRAY(buf1, int, DIM1_L3, DIM2_L3);
+ /* Create arrays */
+ struct {
+ int arr[DIM1_L3][DIM2_L3];
+ } *buf1 = malloc(sizeof(*buf1));
+ struct {
+ int arr[SDIM1_L3][SDIM2_L3];
+ } *buf2 = malloc(sizeof(*buf2));
- H5TEST_ALLOCATE_2D_ARRAY(buf2, int, SDIM1_L3, SDIM2_L3);
- if (NULL == buf2)
+ if (NULL == buf1 || NULL == buf2)
goto error;
- H5TEST_FILL_2D_ARRAY(buf2, int, SDIM1_L3, SDIM2_L3);
+
+ /* Fill arrays */
+ H5TEST_FILL_2D_HEAP_ARRAY(buf1, int);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf2, int);
/*-------------------------------------------------------------------------
* make chunked dataset with
@@ -3373,7 +3425,7 @@ make_layout3(hid_t loc_id)
if (H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0)
goto error;
- if (make_dset(loc_id, "chunk_unlimit1", sid1, dcpl1, buf1[0]) < 0)
+ if (make_dset(loc_id, "chunk_unlimit1", sid1, dcpl1, buf1) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -3394,7 +3446,7 @@ make_layout3(hid_t loc_id)
if (H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0)
goto error;
- if (make_dset(loc_id, "chunk_unlimit2", sid2, dcpl2, buf2[0]) < 0)
+ if (make_dset(loc_id, "chunk_unlimit2", sid2, dcpl2, buf2) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -3411,7 +3463,7 @@ make_layout3(hid_t loc_id)
if (H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0)
goto error;
- if (make_dset(loc_id, "chunk_unlimit3", sid2, dcpl3, buf2[0]) < 0)
+ if (make_dset(loc_id, "chunk_unlimit3", sid2, dcpl3, buf2) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -5802,11 +5854,25 @@ out:
static int
make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t dcpl, void *buf)
{
- hid_t did = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t dxpl_id = H5P_DEFAULT;
if ((did = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
return -1;
- if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto out;
+ if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0)
+ goto out;
+ }
+#endif
+
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
+ goto out;
+ if (dxpl_id != H5P_DEFAULT && H5Pclose(dxpl_id) < 0)
goto out;
if (H5Dclose(did) < 0)
return -1;
@@ -5835,17 +5901,30 @@ out:
static int
write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf)
{
- hid_t did = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t dxpl_id = H5P_DEFAULT;
if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
return -1;
if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if (buf) {
- if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto out;
+ if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0)
+ goto out;
+ }
+#endif
+
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
goto out;
}
+ if (dxpl_id != H5P_DEFAULT && H5Pclose(dxpl_id) < 0)
+ goto out;
if (H5Dclose(did) < 0)
goto out;
if (H5Sclose(sid) < 0)
@@ -5856,6 +5935,7 @@ write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t t
out:
H5E_BEGIN_TRY
{
+ H5Pclose(dxpl_id);
H5Dclose(did);
H5Sclose(sid);
}
@@ -6244,7 +6324,7 @@ gen_refered_objs(hid_t loc_id)
goto out;
}
- /* create normal dataset which is refered */
+ /* create normal dataset which is referred */
did2 = H5Dcreate2(loc_id, NAME_OBJ_DS2, H5T_STD_I8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (did2 < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__);
@@ -6284,7 +6364,7 @@ out:
* Generate object references to objects (dataset,group and named datatype)
*
* Note:
- * copied from h5copygentest.c and upate to create named datatype
+ * copied from h5copygentest.c and update to create named datatype
*
* Programmer: Jonathan Kim (March 18, 2010)
*------------------------------------------------------------------------*/