summaryrefslogtreecommitdiffstats
path: root/src/H5Fistore.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-09-30 18:50:49 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-09-30 18:50:49 (GMT)
commitbeab7f66e5dd260732fad34b9c26ccb0d8d580a5 (patch)
treed4513e30c4d6b722d466b295e6d009272e937d54 /src/H5Fistore.c
parent8460a082a4e1fc9ea9be15cfb6bbdd866ebf9f4b (diff)
downloadhdf5-beab7f66e5dd260732fad34b9c26ccb0d8d580a5.zip
hdf5-beab7f66e5dd260732fad34b9c26ccb0d8d580a5.tar.gz
hdf5-beab7f66e5dd260732fad34b9c26ccb0d8d580a5.tar.bz2
[svn-r730] Changes since 19980928
---------------------- ./MANIFEST Changed freebsd2.2.1 to freebsd2.2.7 to match change in file name. Added a few missing files. Are all of these supposed to be distributed? ./tools/testfiles/h5dumptst.c + ./tools/testfiles/tall-1.ddl + ./tools/testfiles/tall-2.ddl + ./tools/testfiles/tall-3.ddl ./tools/testfiles/tall.ddl ./tools/testfiles/tall.h5 + ./tools/testfiles/tattr-1.ddl + ./tools/testfiles/tattr-2.ddl + ./tools/testfiles/tattr-3.ddl + ./tools/testfiles/tattr-4.ddl ./tools/testfiles/tattr.ddl ./tools/testfiles/tattr.h5 + ./tools/testfiles/tdset-1.ddl + ./tools/testfiles/tdset-2.ddl + ./tools/testfiles/tdset-3.ddl + ./tools/testfiles/tdset-4.ddl ./tools/testfiles/tdset.ddl ./tools/testfiles/tdset.h5 + ./tools/testfiles/tgroup-1.ddl + ./tools/testfiles/tgroup-2.ddl + ./tools/testfiles/tgroup-3.ddl ./tools/testfiles/tgroup.ddl ./tools/testfiles/tgroup.h5 + ./tools/testfiles/tslink-1.ddl + ./tools/testfiles/tslink-2.ddl ./tools/testfiles/tslink.ddl ./tools/testfiles/tslink.h5 ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5Dprivate.h ./src/H5Farray.c ./src/H5Fistore.c ./src/H5Fprivate.h ./src/H5Gstab.c ./src/H5P.c ./src/H5Ppublic.h ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Spoint.c ./src/H5Sprivate.h ./test/istore.c Implemented split ratios as documented in previous e-mails. Frank, the new API functions are H5Pget_btree_ratios() and H5Pset_btree_ratios(). ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Spoint.c ./src/H5Sprivate.h Added more type checking for the data transfer property list passed to these functions. ./src/H5D.c Added a dataset transfer property list as an argument to H5D_allocate() for the parallel version in order to pass split ratios down to H5F_istore_lock(). Eventually we won't need the split ratios for H5D_allocate() because we'll build a completely full B-tree from the leaves up, but it might be useful to have other transfer properties at that level anyway. I always caled H5D_allocate() with &H5D_dflt_xfer. ./MANIFEST ./test/Makefile.in ./test/overhead.c [NEW] Added an `overhead' test run by `make timings'.
Diffstat (limited to 'src/H5Fistore.c')
-rw-r--r--src/H5Fistore.c131
1 files changed, 77 insertions, 54 deletions
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index 31f1ec8..88399fd 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -68,11 +68,18 @@
static hbool_t interface_initialize_g = FALSE;
#define INTERFACE_INIT NULL
+/*
+ * Given a B-tree node return the dimensionality of the chunks pointed to by
+ * that node.
+ */
+#define H5F_ISTORE_NDIMS(X) ((intn)(((X)->sizeof_rkey-8)/8))
+
/* Raw data chunks are cached. Each entry in the cache is: */
typedef struct H5F_rdcc_ent_t {
hbool_t locked; /*entry is locked in cache */
hbool_t dirty; /*needs to be written to disk? */
H5O_layout_t *layout; /*the layout message */
+ double split_ratios[3];/*B-tree node splitting ratios */
H5O_pline_t *pline; /*filter pipeline message */
hssize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */
size_t rd_count; /*bytes remaining to be read */
@@ -215,7 +222,7 @@ H5F_istore_decode_key(H5F_t __unused__ *f, H5B_t *bt, uint8 *raw, void *_key)
{
H5F_istore_key_t *key = (H5F_istore_key_t *) _key;
intn i;
- intn ndims = (intn)((bt->sizeof_rkey-8)/4);
+ intn ndims = H5F_ISTORE_NDIMS(bt);
FUNC_ENTER(H5F_istore_decode_key, FAIL);
@@ -224,12 +231,12 @@ H5F_istore_decode_key(H5F_t __unused__ *f, H5B_t *bt, uint8 *raw, void *_key)
assert(bt);
assert(raw);
assert(key);
- assert(ndims > 0 && ndims <= H5O_LAYOUT_NDIMS);
+ assert(ndims>0 && ndims<=H5O_LAYOUT_NDIMS);
/* decode */
UINT32DECODE(raw, key->nbytes);
UINT32DECODE(raw, key->filter_mask);
- for (i = 0; i < ndims; i++) {
+ for (i=0; i<ndims; i++) {
UINT64DECODE(raw, key->offset[i]);
}
@@ -250,14 +257,14 @@ H5F_istore_decode_key(H5F_t __unused__ *f, H5B_t *bt, uint8 *raw, void *_key)
* Friday, October 10, 1997
*
* Modifications:
- *
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5F_istore_encode_key(H5F_t __unused__ *f, H5B_t *bt, uint8 *raw, void *_key)
{
H5F_istore_key_t *key = (H5F_istore_key_t *) _key;
- intn ndims = (intn)((bt->sizeof_rkey-8) / 4);
+ intn ndims = H5F_ISTORE_NDIMS(bt);
intn i;
FUNC_ENTER(H5F_istore_encode_key, FAIL);
@@ -267,12 +274,12 @@ H5F_istore_encode_key(H5F_t __unused__ *f, H5B_t *bt, uint8 *raw, void *_key)
assert(bt);
assert(raw);
assert(key);
- assert(ndims > 0 && ndims <= H5O_LAYOUT_NDIMS);
+ assert(ndims>0 && ndims<=H5O_LAYOUT_NDIMS);
/* encode */
UINT32ENCODE(raw, key->nbytes);
UINT32ENCODE(raw, key->filter_mask);
- for (i = 0; i < ndims; i++) {
+ for (i=0; i<ndims; i++) {
UINT64ENCODE(raw, key->offset[i]);
}
@@ -826,7 +833,8 @@ H5F_istore_flush_entry (H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset)
* Create the chunk it if it doesn't exist, or reallocate the chunk if
* its size changed. Then write the data into the file.
*/
- if (H5B_insert(f, H5B_ISTORE, &(ent->layout->addr), &udata)<0) {
+ if (H5B_insert(f, H5B_ISTORE, &(ent->layout->addr), ent->split_ratios,
+ &udata)<0) {
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"unable to allocate chunk");
}
@@ -1161,8 +1169,9 @@ H5F_istore_prune (H5F_t *f, size_t size)
*/
static void *
H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
- const H5O_pline_t *pline, const hssize_t offset[],
- hbool_t relax, intn *idx_hint/*in,out*/)
+ const double split_ratios[], const H5O_pline_t *pline,
+ const hssize_t offset[], hbool_t relax,
+ intn *idx_hint/*in,out*/)
{
uintn idx; /*hash index number */
hbool_t found = FALSE; /*already in cache? */
@@ -1177,7 +1186,8 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
void *ret_value=NULL; /*return value */
FUNC_ENTER (H5F_istore_lock, NULL);
-
+ assert(split_ratios);
+
if (rdcc->nslots>0) {
idx = layout->addr.offset;
for (i=0; i<layout->ndims; i++) idx = (idx<<1) ^ offset[i];
@@ -1316,6 +1326,9 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
ent->rd_count = chunk_size;
ent->wr_count = chunk_size;
ent->chunk = chunk;
+ ent->split_ratios[0] = split_ratios[0];
+ ent->split_ratios[1] = split_ratios[1];
+ ent->split_ratios[2] = split_ratios[2];
/* Add it to the cache */
assert(NULL==rdcc->slot[idx]);
@@ -1413,6 +1426,7 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout,
*/
static herr_t
H5F_istore_unlock (H5F_t *f, const H5O_layout_t *layout,
+ const double split_ratios[],
const H5O_pline_t *pline, hbool_t dirty,
const hssize_t offset[], intn *idx_hint,
uint8 *chunk, size_t naccessed)
@@ -1451,6 +1465,9 @@ H5F_istore_unlock (H5F_t *f, const H5O_layout_t *layout,
}
x.alloc_size = x.chunk_size;
x.chunk = chunk;
+ x.split_ratios[0] = split_ratios[0];
+ x.split_ratios[1] = split_ratios[1];
+ x.split_ratios[2] = split_ratios[2];
H5F_istore_flush_entry (f, &x, TRUE);
} else {
H5MM_xfree (chunk);
@@ -1492,7 +1509,7 @@ H5F_istore_unlock (H5F_t *f, const H5O_layout_t *layout,
*-------------------------------------------------------------------------
*/
herr_t
-H5F_istore_read(H5F_t *f, const H5O_layout_t *layout,
+H5F_istore_read(H5F_t *f, const H5D_xfer_t *xfer, const H5O_layout_t *layout,
const H5O_pline_t *pline, const hssize_t offset_f[],
const hsize_t size[], void *buf)
{
@@ -1580,6 +1597,7 @@ H5F_istore_read(H5F_t *f, const H5O_layout_t *layout,
if (f->shared->access_parms->driver==H5F_LOW_MPIO){
H5F_istore_ud1_t udata;
H5O_layout_t l; /* temporary layout */
+ H5D_xfer_t tmp_xfer = *xfer;
if (H5F_istore_get_addr(f, layout, chunk_offset, &udata)==FAIL){
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"unable to locate raw data chunk");
@@ -1595,15 +1613,14 @@ H5F_istore_read(H5F_t *f, const H5O_layout_t *layout,
for (i=l.ndims; i-- > 0;)
l.dim[i] = layout->dim[i];
l.addr = udata.addr;
- if (H5F_arr_read(f, &l,
- pline, NULL /* no efl */,
- sub_size, size_m,
- sub_offset_m, offset_wrt_chunk,
- H5D_XFER_DFLT, buf)==FAIL){
+ tmp_xfer.xfer_mode = H5D_XFER_DFLT;
+ if (H5F_arr_read(f, &tmp_xfer, &l, pline, NULL/*no efl*/,
+ sub_size, size_m, sub_offset_m, offset_wrt_chunk,
+ buf)==FAIL){
HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
"unable to read raw data from file");
- };
- }else{
+ }
+ } else {
#endif
#ifdef AKC
@@ -1613,23 +1630,24 @@ H5F_istore_read(H5F_t *f, const H5O_layout_t *layout,
}
printf(")\n");
#endif
-
- /*
- * Lock the chunk, transfer data to the application, then unlock the
- * chunk.
- */
- if (NULL==(chunk=H5F_istore_lock (f, layout, pline, chunk_offset,
- FALSE, &idx_hint))) {
- HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
- "unable to read raw data chunk");
- }
- H5V_hyper_copy(layout->ndims, sub_size, size_m, sub_offset_m,
- (void*)buf, layout->dim, offset_wrt_chunk, chunk);
- if (H5F_istore_unlock (f, layout, pline, FALSE, chunk_offset,
- &idx_hint, chunk, naccessed)<0) {
- HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
- "unable to unlock raw data chunk");
- }
+ /*
+ * Lock the chunk, transfer data to the application, then unlock
+ * the chunk.
+ */
+ if (NULL==(chunk=H5F_istore_lock (f, layout, xfer->split_ratios,
+ pline, chunk_offset,
+ FALSE, &idx_hint))) {
+ HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
+ "unable to read raw data chunk");
+ }
+ H5V_hyper_copy(layout->ndims, sub_size, size_m, sub_offset_m,
+ (void*)buf, layout->dim, offset_wrt_chunk, chunk);
+ if (H5F_istore_unlock (f, layout, xfer->split_ratios, pline,
+ FALSE, chunk_offset, &idx_hint, chunk,
+ naccessed)<0) {
+ HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL,
+ "unable to unlock raw data chunk");
+ }
#ifdef HAVE_PARALLEL
}
#endif
@@ -1663,7 +1681,7 @@ H5F_istore_read(H5F_t *f, const H5O_layout_t *layout,
*-------------------------------------------------------------------------
*/
herr_t
-H5F_istore_write(H5F_t *f, const H5O_layout_t *layout,
+H5F_istore_write(H5F_t *f, const H5D_xfer_t *xfer, const H5O_layout_t *layout,
const H5O_pline_t *pline, const hssize_t offset_f[],
const hsize_t size[], const void *buf)
{
@@ -1688,7 +1706,7 @@ H5F_istore_write(H5F_t *f, const H5O_layout_t *layout,
assert(layout && H5D_CHUNKED==layout->type);
assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS);
assert(H5F_addr_defined(&(layout->addr)));
- assert (offset_f);
+ assert(offset_f);
assert(size);
assert(buf);
@@ -1755,6 +1773,7 @@ H5F_istore_write(H5F_t *f, const H5O_layout_t *layout,
if (f->shared->access_parms->driver==H5F_LOW_MPIO){
H5F_istore_ud1_t udata;
H5O_layout_t l; /* temporary layout */
+ H5D_xfer_t tmp_xfer = *xfer;
if (H5F_istore_get_addr(f, layout, chunk_offset, &udata)==FAIL){
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"unable to locate raw data chunk");
@@ -1770,15 +1789,14 @@ H5F_istore_write(H5F_t *f, const H5O_layout_t *layout,
for (i=l.ndims; i-- > 0;)
l.dim[i] = layout->dim[i];
l.addr = udata.addr;
- if (H5F_arr_write(f, &l,
- pline, NULL /* no efl */,
- sub_size, size_m,
- sub_offset_m, offset_wrt_chunk,
- H5D_XFER_DFLT, buf)==FAIL){
+ tmp_xfer.xfer_mode = H5D_XFER_DFLT;
+ if (H5F_arr_write(f, &tmp_xfer, &l, pline, NULL/*no efl*/,
+ sub_size, size_m, sub_offset_m, offset_wrt_chunk,
+ buf)==FAIL){
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
- "unable to write raw data to file");
- };
- }else{
+ "unable to write raw data to file");
+ }
+ } else {
#endif
#ifdef AKC
@@ -1792,7 +1810,8 @@ H5F_istore_write(H5F_t *f, const H5O_layout_t *layout,
* Lock the chunk, copy from application to chunk, then unlock the
* chunk.
*/
- if (NULL==(chunk=H5F_istore_lock (f, layout, pline, chunk_offset,
+ if (NULL==(chunk=H5F_istore_lock (f, layout, xfer->split_ratios,
+ pline, chunk_offset,
naccessed==chunk_size,
&idx_hint))) {
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
@@ -1801,8 +1820,9 @@ H5F_istore_write(H5F_t *f, const H5O_layout_t *layout,
H5V_hyper_copy(layout->ndims, sub_size,
layout->dim, offset_wrt_chunk, chunk,
size_m, sub_offset_m, buf);
- if (H5F_istore_unlock (f, layout, pline, TRUE, chunk_offset,
- &idx_hint, chunk, naccessed)<0) {
+ if (H5F_istore_unlock (f, layout, xfer->split_ratios, pline, TRUE,
+ chunk_offset, &idx_hint, chunk,
+ naccessed)<0) {
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"uanble to unlock raw data chunk");
}
@@ -2047,7 +2067,8 @@ H5F_istore_get_addr (H5F_t *f, const H5O_layout_t *layout,
*/
herr_t
H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout,
- const hsize_t *space_dim, const H5O_pline_t *pline)
+ const hsize_t *space_dim, const double split_ratios[],
+ const H5O_pline_t *pline)
{
intn i, carry;
@@ -2106,13 +2127,15 @@ H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout,
* Lock the chunk, copy from application to chunk, then unlock the
* chunk.
*/
- if (NULL==(chunk=H5F_istore_lock (f, layout, pline, chunk_offset,
- FALSE, &idx_hint))) {
+ if (NULL==(chunk=H5F_istore_lock (f, layout, split_ratios, pline,
+ chunk_offset, FALSE,
+ &idx_hint))) {
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"unable to read raw data chunk");
}
- if (H5F_istore_unlock (f, layout, pline, TRUE, chunk_offset,
- &idx_hint, chunk, chunk_size)<0) {
+ if (H5F_istore_unlock (f, layout, split_ratios, pline, TRUE,
+ chunk_offset, &idx_hint, chunk,
+ chunk_size)<0) {
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL,
"uanble to unlock raw data chunk");
}