summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c++/src/H5FaccProp.cpp20
-rw-r--r--c++/src/H5FaccProp.h9
-rw-r--r--perform/chunk.c16
-rw-r--r--src/H5P.c132
-rw-r--r--src/H5Ppublic.h8
-rw-r--r--test/tselect.c4
6 files changed, 186 insertions, 3 deletions
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index 4eae889..9625c00 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -189,6 +189,7 @@ void FileAccPropList::getMpi( MPI_Comm& comm, MPI_Info& info ) const
}
*/
+#ifdef H5_WANT_H5_V1_4_COMPAT
void FileAccPropList::setCache( int mdc_nelmts, int rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const
{
herr_t ret_value = H5Pset_cache( id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0 );
@@ -198,6 +199,24 @@ void FileAccPropList::setCache( int mdc_nelmts, int rdcc_nelmts, size_t rdcc_nby
}
}
+void FileAccPropList::getCache( int& mdc_nelmts, int& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const
+{
+ herr_t ret_value = H5Pget_cache( id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0 );
+ if( ret_value < 0 )
+ {
+ throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed");
+ }
+}
+#else /* H5_WANT_H5_V1_4_COMPAT */
+void FileAccPropList::setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const
+{
+ herr_t ret_value = H5Pset_cache( id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0 );
+ if( ret_value < 0 )
+ {
+ throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed");
+ }
+}
+
void FileAccPropList::getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const
{
herr_t ret_value = H5Pget_cache( id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0 );
@@ -206,6 +225,7 @@ void FileAccPropList::getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rd
throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed");
}
}
+#endif /* H5_WANT_H5_V1_4_COMPAT */
void FileAccPropList::setGcReferences( unsigned gc_ref ) const
{
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index 2851b5f..c48c65a 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -61,12 +61,21 @@ class FileAccPropList : public PropList {
// family driver and retrieves the member's file access property list.
// bool getFamily( hsize_t& memb_size, FileAccPropList& memb_plist ) const;
+#ifdef H5_WANT_H5_V1_4_COMPAT
// Sets the meta data cache and raw data chunk cache parameters.
void setCache( int mdc_nelmts, int rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const;
// Retrieves maximum sizes of data caches and the preemption
// policy value.
+ void getCache( int& mdc_nelmts, int& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const;
+#else /* H5_WANT_H5_V1_4_COMPAT */
+ // Sets the meta data cache and raw data chunk cache parameters.
+ void setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const;
+
+ // Retrieves maximum sizes of data caches and the preemption
+ // policy value.
void getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const;
+#endif /* H5_WANT_H5_V1_4_COMPAT */
// Sets the low-level driver to split meta data from raw data.
// void setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist,
diff --git a/perform/chunk.c b/perform/chunk.c
index 5c023fa..0b915c8 100644
--- a/perform/chunk.c
+++ b/perform/chunk.c
@@ -162,13 +162,18 @@ create_dataset (void)
*-------------------------------------------------------------------------
*/
static double
-test_rowmaj (int op, hsize_t cache_size, hsize_t io_size)
+test_rowmaj (int op, size_t cache_size, hsize_t io_size)
{
hid_t file, dset, mem_space, file_space;
signed char *buf = calloc (1, SQUARE(io_size));
hsize_t i, j, hs_size[2];
hssize_t hs_offset[2];
+#ifdef H5_WANT_H5_V1_4_COMPAT
int mdc_nelmts, rdcc_nelmts;
+#else /* H5_WANT_H5_V1_4_COMPAT */
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+#endif /* H5_WANT_H5_V1_4_COMPAT */
double w0;
H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0);
@@ -237,14 +242,19 @@ test_rowmaj (int op, hsize_t cache_size, hsize_t io_size)
*-------------------------------------------------------------------------
*/
static double
-test_diag (int op, hsize_t cache_size, hsize_t io_size, hsize_t offset)
+test_diag (int op, size_t cache_size, hsize_t io_size, hsize_t offset)
{
hid_t file, dset, mem_space, file_space;
hsize_t i, hs_size[2];
hsize_t nio = 0;
hssize_t hs_offset[2];
signed char *buf = calloc (1, SQUARE (io_size));
+#ifdef H5_WANT_H5_V1_4_COMPAT
int mdc_nelmts, rdcc_nelmts;
+#else /* H5_WANT_H5_V1_4_COMPAT */
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+#endif /* H5_WANT_H5_V1_4_COMPAT */
double w0;
H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0);
@@ -315,7 +325,7 @@ main (void)
hsize_t io_size;
double effic, io_percent;
FILE *f, *d;
- int cache_size;
+ size_t cache_size;
double w0;
/*
diff --git a/src/H5P.c b/src/H5P.c
index 71e14bc..5d47446 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -1987,6 +1987,137 @@ H5Pget_driver_info(hid_t plist_id)
FUNC_LEAVE(ret_value);
} /* end H5Pget_driver_info() */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_cache
+ *
+ * Purpose: Set the number of objects in the meta data cache and the
+ * maximum number of chunks and bytes in the raw data chunk
+ * cache.
+ *
+ * The RDCC_W0 value should be between 0 and 1 inclusive and
+ * indicates how much chunks that have been fully read or fully
+ * written are favored for preemption. A value of zero means
+ * fully read or written chunks are treated no differently than
+ * other chunks (the preemption is strictly LRU) while a value
+ * of one means fully read chunks are always preempted before
+ * other chunks.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, May 19, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_cache(hid_t plist_id, int mdc_nelmts,
+ int _rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t rdcc_nelmts=(size_t)_rdcc_nelmts; /* Work around variable changing size */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER (H5Pset_cache, FAIL);
+ H5TRACE5("e","iIszzd",plist_id,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
+
+ /* Check arguments */
+ if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) )
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
+ if (mdc_nelmts<0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "meta data cache size must be non-negative");
+ if (rdcc_w0<0.0 || rdcc_w0>1.0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set sizes */
+ if(H5P_set(plist, H5F_ACS_META_CACHE_SIZE_NAME, &mdc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set meta data cache size");
+ if(H5P_set(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache element size");
+ if(H5P_set(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size");
+ if(H5P_set(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_cache
+ *
+ * Purpose: Retrieves the maximum possible number of elements in the meta
+ * data cache and the maximum possible number of elements and
+ * bytes and the RDCC_W0 value in the raw data chunk cache. Any
+ * (or all) arguments may be null pointers in which case the
+ * corresponding datum is not returned.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, May 19, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_cache(hid_t plist_id, int *mdc_nelmts,
+ int *_rdcc_nelmts, size_t *rdcc_nbytes, double *rdcc_w0)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t rdcc_nelmts; /* Work around variable changing size */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER (H5Pget_cache, FAIL);
+ H5TRACE5("e","i*Is*z*z*d",plist_id,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
+
+ /* Check arguments */
+ if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get sizes */
+ if (mdc_nelmts)
+ if(H5P_get(plist, H5F_ACS_META_CACHE_SIZE_NAME, mdc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get meta data cache size");
+ if (_rdcc_nelmts) {
+ if(H5P_get(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache element size");
+ *_rdcc_nelmts=rdcc_nelmts;
+ } /* end if */
+ if (rdcc_nbytes)
+ if(H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, rdcc_nbytes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size");
+ if (rdcc_w0)
+ if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, rdcc_w0) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+#else /* H5_WANT_H5_V1_4_COMPAT */
/*-------------------------------------------------------------------------
* Function: H5Pset_cache
@@ -2111,6 +2242,7 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts,
done:
FUNC_LEAVE(ret_value);
}
+#endif /* H5_WANT_H5_V1_4_COMPAT */
/*-------------------------------------------------------------------------
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 416d9b7..9a34f58 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -190,11 +190,19 @@ __DLL__ H5Z_filter_t H5Pget_filter(hid_t plist_id, int filter,
unsigned cd_values[]/*out*/,
size_t namelen, char name[]);
__DLL__ herr_t H5Pset_deflate(hid_t plist_id, unsigned aggression);
+#ifdef H5_WANT_H5_V1_4_COMPAT
+__DLL__ herr_t H5Pset_cache(hid_t plist_id, int mdc_nelmts, int rdcc_nelmts,
+ size_t rdcc_nbytes, double rdcc_w0);
+__DLL__ herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts/*out*/,
+ int *rdcc_nelmts/*out*/,
+ size_t *rdcc_nbytes/*out*/, double *rdcc_w0);
+#else /* H5_WANT_H5_V1_4_COMPAT */
__DLL__ herr_t H5Pset_cache(hid_t plist_id, int mdc_nelmts, size_t rdcc_nelmts,
size_t rdcc_nbytes, double rdcc_w0);
__DLL__ herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts/*out*/,
size_t *rdcc_nelmts/*out*/,
size_t *rdcc_nbytes/*out*/, double *rdcc_w0);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
__DLL__ herr_t H5Pset_hyper_cache(hid_t plist_id, unsigned cache,
unsigned limit);
__DLL__ herr_t H5Pget_hyper_cache(hid_t plist_id, unsigned *cache,
diff --git a/test/tselect.c b/test/tselect.c
index 785d8be..0250786 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -3710,7 +3710,11 @@ test_select(void)
hid_t plist_id; /* Property list for reading random hyperslabs */
hid_t fapl; /* Property list accessing the file */
int mdc_nelmts; /* Metadata number of elements */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ int rdcc_nelmts; /* Raw data number of elements */
+#else /* H5_WANT_H5_V1_4_COMPAT */
size_t rdcc_nelmts; /* Raw data number of elements */
+#endif /* H5_WANT_H5_V1_4_COMPAT */
size_t rdcc_nbytes; /* Raw data number of bytes */
double rdcc_w0; /* Raw data write percentage */
herr_t ret; /* Generic return value */