summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2016-08-11 20:56:13 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2016-08-11 20:56:13 (GMT)
commit6dec81e7ac7edacf524a8f4dbb125d4fe40f3dc0 (patch)
tree63c89d90dfee9e6e7dabef15b007e98a024a7d14 /testpar
parent1d9e5ff1ca96bd10b66507ba281cb4617090e65e (diff)
downloadhdf5-6dec81e7ac7edacf524a8f4dbb125d4fe40f3dc0.zip
hdf5-6dec81e7ac7edacf524a8f4dbb125d4fe40f3dc0.tar.gz
hdf5-6dec81e7ac7edacf524a8f4dbb125d4fe40f3dc0.tar.bz2
[svn-r30278] Merge revision 30270 to the 1.8 branch
Fix an issue that could occur when allocating a chunked dataset in parallel, with an alignment threshold set to be larger than the chunk size but smaller than the size of the small data aggregator. Tested: h5committest, jelly, ummon (trunk); h5committest, jelly, ummon (1.8)
Diffstat (limited to 'testpar')
-rw-r--r--testpar/t_mdset.c86
-rw-r--r--testpar/testphdf5.c5
-rw-r--r--testpar/testphdf5.h1
3 files changed, 92 insertions, 0 deletions
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index f294b93..b4fa936 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -2608,6 +2608,92 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm)
#undef Writer_Root
#undef Reader_Root
+
+/*
+ * Test creating a chunked dataset in parallel in a file with an alignment set
+ * and an alignment threshold large enough to avoid aligning the chunks but
+ * small enough that the raw data aggregator will be aligned if it is treated as
+ * an object that must be aligned by the library
+ */
+#define CHUNK_SIZE 72
+#define NCHUNKS 32
+#define AGGR_SIZE 2048
+#define EXTRA_ALIGN 100
+
+ void chunk_align_bug_1(void)
+ {
+ int mpi_rank;
+ hid_t file_id, dset_id, fapl_id, dcpl_id, space_id;
+ hsize_t dims = CHUNK_SIZE * NCHUNKS, cdims = CHUNK_SIZE;
+ h5_stat_size_t file_size;
+ hsize_t align;
+ herr_t ret;
+ const char *filename;
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+
+ filename = (const char *)GetTestParameters();
+
+ /* Create file without alignment */
+ fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
+ VRFY((fapl_id >= 0), "create_faccess_plist succeeded");
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ VRFY((file_id >= 0), "H5Fcreate succeeded");
+
+ /* Close file */
+ ret = H5Fclose(file_id);
+ VRFY((ret >= 0), "H5Fclose succeeded");
+
+ /* Get file size */
+ file_size = h5_get_file_size(filename, fapl_id);
+ VRFY((file_size >= 0), "h5_get_file_size succeeded");
+
+ /* Calculate alignment value, set to allow a chunk to squeak in between the
+ * original EOF and the aligned location of the aggregator. Add some space
+ * for the dataset metadata */
+ align = (hsize_t)file_size + CHUNK_SIZE + EXTRA_ALIGN;
+
+ /* Set aggregator size and alignment, disable metadata aggregator */
+ HDassert(AGGR_SIZE > CHUNK_SIZE);
+ ret = H5Pset_small_data_block_size(fapl_id, AGGR_SIZE);
+ VRFY((ret >= 0), "H5Pset_small_data_block_size succeeded");
+ ret = H5Pset_meta_block_size(fapl_id, 0);
+ VRFY((ret >= 0), "H5Pset_meta_block_size succeeded");
+ ret = H5Pset_alignment(fapl_id, CHUNK_SIZE + 1, align);
+ VRFY((ret >= 0), "H5Pset_small_data_block_size succeeded");
+
+ /* Reopen file with new settings */
+ file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
+ VRFY((file_id >= 0), "H5Fopen succeeded");
+
+ /* Create dataset */
+ space_id = H5Screate_simple(1, &dims, NULL);
+ VRFY((space_id >= 0), "H5Screate_simple succeeded");
+ dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
+ VRFY((dcpl_id >= 0), "H5Pcreate succeeded");
+ ret = H5Pset_chunk(dcpl_id, 1, &cdims);
+ VRFY((ret >= 0), "H5Pset_chunk succeeded");
+ dset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_CHAR, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "H5Dcreate2 succeeded");
+
+ /* Close ids */
+ ret = H5Dclose(dset_id);
+ VRFY((dset_id >= 0), "H5Dclose succeeded");
+ ret = H5Sclose(space_id);
+ VRFY((space_id >= 0), "H5Sclose succeeded");
+ ret = H5Pclose(dcpl_id);
+ VRFY((dcpl_id >= 0), "H5Pclose succeeded");
+ ret = H5Pclose(fapl_id);
+ VRFY((fapl_id >= 0), "H5Pclose succeeded");
+
+ /* Close file */
+ ret = H5Fclose(file_id);
+ VRFY((ret >= 0), "H5Fclose succeeded");
+
+ return;
+} /* end chunk_align_bug_1() */
+
+
/*=============================================================================
* End of t_mdset.c
*===========================================================================*/
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 7992e80..eaa9eb1 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -489,6 +489,11 @@ int main(int argc, char **argv)
&rr_obj_flush_confusion_params);
}
+ AddTest("alnbg1",
+ chunk_align_bug_1, NULL,
+ "Chunk allocation with alignment bug.",
+ PARATESTFILE);
+
AddTest("tldsc",
lower_dim_size_comp_test, NULL,
"test lower dim size comp in span tree to mpi derived type",
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index efd3424..4fb668e 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -283,6 +283,7 @@ void io_mode_confusion(void);
void rr_obj_hdr_flush_confusion(void);
void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm);
void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm);
+void chunk_align_bug_1(void);
void lower_dim_size_comp_test(void);
void link_chunk_collective_io_test(void);
void contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type);