summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2018-07-22 20:22:34 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2018-07-22 20:22:34 (GMT)
commit09913e2f8e0264dd6f312689d530d0bb5d3c431e (patch)
tree291d118718d53cb83bddc9b0c6c7384ef43db1b7 /c++/test
parentc983fc3c5bc3cab152ce80990536c2faf4642392 (diff)
downloadhdf5-09913e2f8e0264dd6f312689d530d0bb5d3c431e.zip
hdf5-09913e2f8e0264dd6f312689d530d0bb5d3c431e.tar.gz
hdf5-09913e2f8e0264dd6f312689d530d0bb5d3c431e.tar.bz2
Added class DSetAccPropList
Description: - Added class DSetAccPropList for the dataset access property list. - Added wrapper for H5Dget_access_plist to class DataSet // Gets the access property list of this dataset. DSetAccPropList getAccessPlist() const; - Added wrappers for H5Pset_chunk_cache and H5Pget_chunk_cache to class DSetAccPropList // Sets the raw data chunk cache parameters. void setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) // Retrieves the raw data chunk cache parameters. void getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) - Added two more arguments to H5Location::createDataSet: const DSetAccPropList& dapl = DSetAccPropList::DEFAULT const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT - Added one more argument to H5Location::openDataSet: const DSetAccPropList& dapl = DSetAccPropList::DEFAULT Platforms tested: Linux/64 (jelly) Linux/32 (jam) Darwin (osx1010test)
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/dsets.cpp115
1 files changed, 113 insertions, 2 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index a3a055d..14f1bd4 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -1121,7 +1121,6 @@ static herr_t test_types(H5File& file)
* Purpose Tests getObjinfo()
*
* Return Success: 0
- *
* Failure: -1
*
* July, 2018
@@ -1177,13 +1176,124 @@ static herr_t test_getinfo(H5File& file)
/*-------------------------------------------------------------------------
+ * Function: test_chunk_cache
+ *
+ * Purpose Tests setting rdcc info on a DAPL, and interaction
+ * with the corresponding properties in the file structure.
+ *
+ * Return Success: 0
+ * Failure: number of errors
+ *
+ * July 2018
+ *-------------------------------------------------------------------------
+ */
+const int RANK1 = 1;
+const H5std_string FILE_ACCPLIST("test_accplist.h5");
+
+static herr_t test_chunk_cache(FileAccPropList fapl)
+{
+ SUBTEST("DSetAccPropList::set/getChunkCache");
+
+ try {
+ // Create a default dataset access and file access property lists
+ FileAccPropList fapl_def;
+ DSetAccPropList dapl;
+
+ // Verify that chunk cache parameters are the same
+ int mdc_nelmts = 0;
+ size_t nslots_1 = 0, nslots_4 = 0, nbytes_1 = 0, nbytes_4 = 0;
+ double w0_1 = 0.0F, w0_4 = 0.0F;
+ fapl_def.getCache(mdc_nelmts, nslots_1, nbytes_1, w0_1);
+ dapl.getChunkCache(nslots_4, nbytes_4, w0_4);
+ verify_val(nslots_1, nslots_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(nbytes_1, nbytes_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(w0_1, w0_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+
+ // Set a link access property on dapl to verify property list inheritance
+ dapl.setNumLinks((size_t)134);
+ size_t nlinks = dapl.getNumLinks();
+ verify_val(nlinks, (size_t)134, "DSetAccPropList::getNumLinks", __LINE__, __FILE__);
+
+ // Make a copy of the external fapl
+ FileAccPropList fapl_local(fapl);
+
+ // Set new rdcc settings on fapl local
+ size_t nslots_2 = nslots_1 * 2;
+ size_t nbytes_2 = nbytes_1 * 2;
+ double w0_2 = w0_1 / (double)2.0F;
+ fapl_local.getCache(mdc_nelmts, nslots_2, nbytes_2, w0_2);
+
+ // Create a new file using default fcpl and the passed-in fapl
+ H5File file(FILE_ACCPLIST, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl_local);
+
+ // Create dataset creation property list
+ DSetCreatPropList dcpl;
+
+ // Set chunk dimensions
+ hsize_t cdims[RANK1];
+ cdims[0] = 10;
+ dcpl.setChunk(RANK1, cdims);
+
+ // Create memory space
+ hsize_t mdims[RANK1];
+ mdims[0] = 10;
+ DataSpace mspace(RANK1, mdims);
+
+ // Create a dataset using that dataset creation properties
+ DataSet dataset(file.createDataSet(DSET_CHUNKED_NAME, PredType::NATIVE_INT, mspace, dcpl, dapl));
+
+ // Get the dataset access property list
+ DSetAccPropList dapl2 = dataset.getAccessPlist();
+
+ // Retrieve and verify the raw data chunk cache parameters
+ nslots_4 = nbytes_4 = 0;
+ w0_4 = 0.0F;
+ dapl2.getChunkCache(nslots_4, nbytes_4, w0_4);
+ verify_val(nslots_2, nslots_4, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(nbytes_2, nbytes_4, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(H5_DBL_ABS_EQUAL(w0_2, w0_4), 1, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__);
+
+
+ // Set new values on original dapl
+ size_t nslots_3 = nslots_1 * 2;
+ size_t nbytes_3 = H5D_CHUNK_CACHE_NBYTES_DEFAULT;
+ double w0_3 = w0_2 / 2;
+ dapl.getChunkCache(nslots_3, nbytes_3, w0_3);
+
+ // Close dataset
+ dataset.close();
+
+ // Reopen dataset
+ DataSet dataset2(file.openDataSet(DSET_CHUNKED_NAME, dapl));
+
+ // Get the dataset access property list
+ DSetAccPropList dapl3 = dataset2.getAccessPlist();
+
+ // Retrieve and verify the raw data chunk cache parameters
+ dapl3.getChunkCache(nslots_4, nbytes_4, w0_4);
+ verify_val(nslots_3, nslots_4, "DSetCreatPropList::getLayout", __LINE__, __FILE__);
+ verify_val(nbytes_3, nbytes_4, "DSetCreatPropList::getLayout", __LINE__, __FILE__);
+ verify_val(H5_DBL_ABS_EQUAL(w0_3, w0_4), 1, "DSetCreatPropList::getLayout", __LINE__, __FILE__);
+
+
+ PASSED();
+ return 0;
+ } // end top try block
+
+ catch (Exception& E)
+ {
+ return -1;
+ }
+} // test_chunk_cache
+
+
+/*-------------------------------------------------------------------------
* Function: test_virtual
*
* Purpose Tests fixed, unlimited, and printf selections in the same
* VDS
*
* Return Success: 0
- *
* Failure: number of errors
*
* Programmer Binh-Minh Ribler
@@ -1305,6 +1415,7 @@ void test_dset()
nerrors += test_multiopen (file) < 0 ? 1:0;
nerrors += test_types(file) < 0 ? 1:0;
nerrors += test_virtual() < 0 ? 1:0;
+ nerrors += test_chunk_cache(fapl) < 0 ? 1:0;
// Close group "emit diagnostics".
grp.close();