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.c807
1 files changed, 450 insertions, 357 deletions
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index b62fa53..ed3fedd 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -272,98 +272,100 @@ main(void)
GOERROR;
PASSED();
- TESTING(" files with file space info setting-- options -S and -P are set & -L");
- ++j; /* #3 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if (h5repack_init(&pack_options, 0, TRUE) < 0)
- GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE; /* "PAGE" specified via -S */
- pack_options.fs_persist = TRUE;
- if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ if (h5_using_default_driver(NULL)) {
+ TESTING(" files with file space info setting-- options -S and -P are set & -L");
+ ++j; /* #3 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
+ GOERROR;
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE; /* "PAGE" specified via -S */
+ pack_options.fs_persist = TRUE;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
- TESTING(" files with file space info setting-- options -P and -T are set & -L");
- ++j; /* #4 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if (h5repack_init(&pack_options, 0, TRUE) < 0)
- GOERROR;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
- pack_options.fs_threshold = 2;
- if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ TESTING(" files with file space info setting-- options -P and -T are set & -L");
+ ++j; /* #4 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
+ GOERROR;
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_threshold = 2;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
- TESTING(" files with file space info setting-- options -S and -G are set & -L");
- ++j; /* #5 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if (h5repack_init(&pack_options, 0, TRUE) < 0)
- GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
- pack_options.fs_pagesize = 8192;
- if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ TESTING(" files with file space info setting-- options -S and -G are set & -L");
+ ++j; /* #5 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
+ GOERROR;
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
+ pack_options.fs_pagesize = 8192;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
- TESTING(" files with file space info setting-- options -S, -P, -T, -G are set");
- ++j; /* #6 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if (h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
- pack_options.fs_threshold = 1;
- pack_options.fs_pagesize = 8192;
- if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ TESTING(" files with file space info setting-- options -S, -P, -T, -G are set");
+ ++j; /* #6 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_threshold = 1;
+ pack_options.fs_pagesize = 8192;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
- TESTING(" files with file space info setting-- options -S, -T, -G are set & -L");
- ++j; /* #7 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if (h5repack_init(&pack_options, 0, TRUE) < 0)
- GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
- pack_options.fs_threshold = 1;
- pack_options.fs_pagesize = 4096;
- if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ TESTING(" files with file space info setting-- options -S, -T, -G are set & -L");
+ ++j; /* #7 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
+ GOERROR;
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
+ pack_options.fs_threshold = 1;
+ pack_options.fs_pagesize = 4096;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* file with fill values
@@ -389,20 +391,22 @@ main(void)
* file with all kinds of dataset datatypes
*-------------------------------------------------------------------------
*/
- TESTING(" copy of datasets (all datatypes)");
- if (h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
- GOERROR;
- if (h5repack_cmp_pl(FNAME1, pack_options.fin_fapl, FNAME1OUT, pack_options.fout_fapl) <= 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ if (!h5_using_parallel_driver(NULL)) {
+ TESTING(" copy of datasets (all datatypes)");
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_cmp_pl(FNAME1, pack_options.fin_fapl, FNAME1OUT, pack_options.fout_fapl) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* file with attributes
@@ -1487,49 +1491,53 @@ main(void)
GOERROR;
PASSED();
- /*-------------------------------------------------------------------------
- * test file with userblock
- *-------------------------------------------------------------------------
- */
- TESTING(" file with userblock");
- if (h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- if (h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0)
- GOERROR;
- if (verify_userblock(FNAME16OUT) < 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ if (h5_using_default_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" file with userblock");
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ if (h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0)
+ GOERROR;
+ if (verify_userblock(FNAME16OUT) < 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* test --latest options
*-------------------------------------------------------------------------
*/
- TESTING(" latest file format options");
- if (h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- pack_options.latest = 1;
- pack_options.grp_compact = 10;
- pack_options.grp_indexed = 5;
- pack_options.msg_size[0] = 10;
- pack_options.msg_size[1] = 20;
- pack_options.msg_size[2] = 30;
- pack_options.msg_size[3] = 40;
- pack_options.msg_size[4] = 50;
- if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ if (!h5_using_parallel_driver(NULL)) {
+ TESTING(" latest file format options");
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ pack_options.latest = 1;
+ pack_options.grp_compact = 10;
+ pack_options.grp_indexed = 5;
+ pack_options.msg_size[0] = 10;
+ pack_options.msg_size[1] = 20;
+ pack_options.msg_size[2] = 30;
+ pack_options.msg_size[3] = 40;
+ pack_options.msg_size[4] = 50;
+ if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* test several global filters
@@ -1560,36 +1568,38 @@ main(void)
SKIPPED();
#endif
- /*-------------------------------------------------------------------------
- * test file with userblock
- *-------------------------------------------------------------------------
- */
- TESTING(" file with added userblock");
+ if (h5_using_default_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" file with added userblock");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
- /* add the options for a user block size and user block filename */
- pack_options.ublock_size = USERBLOCK_SIZE;
- pack_options.ublock_filename = FNAME_UB;
+ /* add the options for a user block size and user block filename */
+ pack_options.ublock_size = USERBLOCK_SIZE;
+ pack_options.ublock_filename = FNAME_UB;
- if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
- GOERROR;
- if (verify_userblock(FNAME8OUT) < 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
+ if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
+ GOERROR;
+ if (verify_userblock(FNAME8OUT) < 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
- PASSED();
+ PASSED();
#else
- SKIPPED();
+ SKIPPED();
#endif
+ }
/*-------------------------------------------------------------------------
* test file with aligment
@@ -1664,48 +1674,50 @@ main(void)
PASSED();
- /*-------------------------------------------------------------------------
- * test --metadata_block_size option
- * Also verify that output file using the metadata_block_size option is
- * larger than the output file one not using it.
- * FNAME4 is used because it is the same as the test file used for the
- * shell script version of this test (h5repack.sh).
- *-------------------------------------------------------------------------
- */
- TESTING(" metadata block size option");
- /* First run without metadata option. No need to verify the correctness */
- /* since this has been verified by earlier tests. Just record the file */
- /* size of the output file. */
- if (h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
- GOERROR;
- if (HDstat(FNAME4OUT, &file_stat) < 0)
- GOERROR;
- fsize1 = file_stat.st_size;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
+ if (h5_using_default_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * test --metadata_block_size option
+ * Also verify that output file using the metadata_block_size option is
+ * larger than the output file one not using it.
+ * FNAME4 is used because it is the same as the test file used for the
+ * shell script version of this test (h5repack.sh).
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" metadata block size option");
+ /* First run without metadata option. No need to verify the correctness */
+ /* since this has been verified by earlier tests. Just record the file */
+ /* size of the output file. */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
+ GOERROR;
+ if (HDstat(FNAME4OUT, &file_stat) < 0)
+ GOERROR;
+ fsize1 = file_stat.st_size;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
- /* run it again with metadata option */
- if (h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- pack_options.meta_block_size = 8192;
- if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
- GOERROR;
- /* record the file size of the output file */
- if (HDstat(FNAME4OUT, &file_stat) < 0)
- GOERROR;
- fsize2 = file_stat.st_size;
- /* verify second file size is larger than the first one */
- if (fsize2 <= fsize1)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ /* run it again with metadata option */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ pack_options.meta_block_size = 8192;
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
+ GOERROR;
+ /* record the file size of the output file */
+ if (HDstat(FNAME4OUT, &file_stat) < 0)
+ GOERROR;
+ fsize2 = file_stat.st_size;
+ /* verify second file size is larger than the first one */
+ if (fsize2 <= fsize1)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* clean temporary test files
@@ -1725,7 +1737,10 @@ main(void)
return 0;
error:
+ h5tools_close();
+
puts("***** H5REPACK TESTS FAILED *****");
+
return 1;
}
@@ -1760,12 +1775,14 @@ make_testfiles(void)
* create another file for general copy test (all datatypes)
*-------------------------------------------------------------------------
*/
- if ((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
- if (make_all_objects(fid) < 0)
- goto out;
- if (H5Fclose(fid) < 0)
- return -1;
+ if (!h5_using_parallel_driver(NULL)) {
+ if ((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_all_objects(fid) < 0)
+ goto out;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ }
/*-------------------------------------------------------------------------
* create a file for attributes copy test
@@ -1934,19 +1951,21 @@ make_testfiles(void)
if (H5Fclose(fid) < 0)
return -1;
- /*-------------------------------------------------------------------------
- * create a file with userblock
- *-------------------------------------------------------------------------
- */
- if (make_userblock() < 0)
- goto out;
+ if (h5_using_default_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * create a file with userblock
+ *-------------------------------------------------------------------------
+ */
+ if (make_userblock() < 0)
+ goto out;
- /*-------------------------------------------------------------------------
- * create a userblock file
- *-------------------------------------------------------------------------
- */
- if (make_userblock_file() < 0)
- goto out;
+ /*-------------------------------------------------------------------------
+ * create a userblock file
+ *-------------------------------------------------------------------------
+ */
+ if (make_userblock_file() < 0)
+ goto out;
+ }
/*-------------------------------------------------------------------------
* create a file with named datatypes
@@ -1959,30 +1978,32 @@ make_testfiles(void)
if (H5Fclose(fid) < 0)
return -1;
- /*-------------------------------------------------------------------------
- * create obj and region reference type datasets (bug1814)
- * add attribute with int type (bug1726)
- * add attribute with obj and region reference type (bug1726)
- *-------------------------------------------------------------------------
- */
- if ((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
- /* create reference type datasets */
- if (make_references(fid) < 0)
- goto out;
- if (H5Fclose(fid) < 0)
- return -1;
+ if (!h5_using_parallel_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * create obj and region reference type datasets (bug1814)
+ * add attribute with int type (bug1726)
+ * add attribute with obj and region reference type (bug1726)
+ *-------------------------------------------------------------------------
+ */
+ if ((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+ /* create reference type datasets */
+ if (make_references(fid) < 0)
+ goto out;
+ if (H5Fclose(fid) < 0)
+ return -1;
- /*-------------------------------------------------------------------------
- * create a file with obj and region references in attribute of compound and
- * vlen datatype
- *-------------------------------------------------------------------------*/
- if ((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
- if (make_complex_attr_references(fid) < 0)
- goto out;
- if (H5Fclose(fid) < 0)
- return -1;
+ /*-------------------------------------------------------------------------
+ * create a file with obj and region references in attribute of compound and
+ * vlen datatype
+ *-------------------------------------------------------------------------*/
+ if ((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_complex_attr_references(fid) < 0)
+ goto out;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ }
/*-------------------------------------------------------------------------
* create 8 files with combinations ???
@@ -2018,111 +2039,113 @@ make_testfiles(void)
if (H5Fclose(fid) < 0)
return -1;
- /*
- * #2 -- h5repack_page_persist.h5
- * Setting:
- * strategy=PAGE, persist=TRUE, threshold=1
- * inpage=512
- * latest format
- */
- /* Create file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if (H5Pset_file_space_page_size(fcpl, (hsize_t)512) < 0)
- return -1;
- if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- return -1;
- if (H5Fclose(fid) < 0)
- return -1;
- if (H5Pclose(fcpl) < 0)
- return -1;
-
- /*
- * #3 -- h5repack_fsm_aggr_persist.h5
- * Setting:
- * strategy=FSM_AGGR, persist=TRUE, threshold=1
- * default: inpage=4096
- */
- /* Create file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
- return -1;
- if (H5Fclose(fid) < 0)
- return -1;
- if (H5Pclose(fcpl) < 0)
- return -1;
-
- /*
- * #4 -- h5repack_page_threshold.h5
- * Setting:
- * strategy=PAGE, persist=FALSE, threshold=3
- * inpage=8192
- * latest format
- */
-
- /* Create file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)3) < 0)
- return -1;
- if (H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- return -1;
- if (H5Fclose(fid) < 0)
- return -1;
- if (H5Pclose(fcpl) < 0)
- return -1;
-
- /*
- * #5 -- h5repack_fsm_aggr_threshold.h5
- * Setting:
- * strategy=FSM_AGGR, persist=FALSE, threshold=3
- * inpage=4096
- */
+ if (h5_using_default_driver(NULL)) {
+ /*
+ * #2 -- h5repack_page_persist.h5
+ * Setting:
+ * strategy=PAGE, persist=TRUE, threshold=1
+ * inpage=512
+ * latest format
+ */
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)512) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
+
+ /*
+ * #3 -- h5repack_fsm_aggr_persist.h5
+ * Setting:
+ * strategy=FSM_AGGR, persist=TRUE, threshold=1
+ * default: inpage=4096
+ */
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
+
+ /*
+ * #4 -- h5repack_page_threshold.h5
+ * Setting:
+ * strategy=PAGE, persist=FALSE, threshold=3
+ * inpage=8192
+ * latest format
+ */
- /* Create file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)3) < 0)
- return -1;
- if (H5Pset_file_space_page_size(fcpl, (hsize_t)FS_PAGESIZE_DEF) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
- return -1;
- if (H5Fclose(fid) < 0)
- return -1;
- if (H5Pclose(fcpl) < 0)
- return -1;
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)3) < 0)
+ return -1;
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
+
+ /*
+ * #5 -- h5repack_fsm_aggr_threshold.h5
+ * Setting:
+ * strategy=FSM_AGGR, persist=FALSE, threshold=3
+ * inpage=4096
+ */
- /*
- * #6 -- h5repack_aggr.h5
- * Setting:
- * strategy=AGGR, persist=FALSE, threshold=1
- * latest format
- */
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)3) < 0)
+ return -1;
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)FS_PAGESIZE_DEF) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
+
+ /*
+ * #6 -- h5repack_aggr.h5
+ * Setting:
+ * strategy=AGGR, persist=FALSE, threshold=1
+ * latest format
+ */
- /* Create file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- return -1;
- if (H5Fclose(fid) < 0)
- return -1;
- if (H5Pclose(fcpl) < 0)
- return -1;
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
+ }
/*
* #7 -- h5repack_none.h5
@@ -2726,6 +2749,7 @@ 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;
@@ -2746,6 +2770,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 +2791,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]) < 0)
goto error;
H5Dclose(dsid);
@@ -2765,7 +2799,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]) < 0)
goto error;
H5Dclose(dsid);
@@ -2773,6 +2807,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 +2824,7 @@ error:
H5E_BEGIN_TRY
{
H5Tclose(dtid);
+ H5Pclose(dxpl);
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(dsid);
@@ -2813,6 +2850,7 @@ 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;
@@ -2833,6 +2871,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 +2890,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]) < 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]) < 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 +2918,7 @@ make_scaleoffset(hid_t loc_id)
error:
H5E_BEGIN_TRY
{
+ H5Pclose(dxpl);
H5Dclose(dsid);
H5Tclose(dtid);
H5Pclose(dcpl);
@@ -2894,6 +2945,7 @@ 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;
@@ -2921,6 +2973,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;
@@ -3010,7 +3072,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]) < 0)
goto error;
/* close */
@@ -3021,6 +3083,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 +3097,7 @@ error:
{
H5Tclose(dtid);
H5Dclose(dsid);
+ H5Pclose(dxpl);
H5Pclose(dcpl);
H5Sclose(sid);
}
@@ -5802,11 +5867,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 +5914,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 +5948,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);
}