diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-09-30 18:50:49 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-09-30 18:50:49 (GMT) |
commit | beab7f66e5dd260732fad34b9c26ccb0d8d580a5 (patch) | |
tree | d4513e30c4d6b722d466b295e6d009272e937d54 /src | |
parent | 8460a082a4e1fc9ea9be15cfb6bbdd866ebf9f4b (diff) | |
download | hdf5-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')
-rw-r--r-- | src/H5B.c | 207 | ||||
-rw-r--r-- | src/H5Bprivate.h | 2 | ||||
-rw-r--r-- | src/H5D.c | 41 | ||||
-rw-r--r-- | src/H5Distore.c | 131 | ||||
-rw-r--r-- | src/H5Dprivate.h | 5 | ||||
-rw-r--r-- | src/H5Farray.c | 88 | ||||
-rw-r--r-- | src/H5Fistore.c | 131 | ||||
-rw-r--r-- | src/H5Fprivate.h | 20 | ||||
-rw-r--r-- | src/H5Gstab.c | 4 | ||||
-rw-r--r-- | src/H5P.c | 97 | ||||
-rw-r--r-- | src/H5Ppublic.h | 4 | ||||
-rw-r--r-- | src/H5Sall.c | 26 | ||||
-rw-r--r-- | src/H5Shyper.c | 52 | ||||
-rw-r--r-- | src/H5Spoint.c | 18 | ||||
-rw-r--r-- | src/H5Sprivate.h | 5 |
15 files changed, 538 insertions, 293 deletions
@@ -102,6 +102,7 @@ /* PRIVATE PROTOTYPES */ static H5B_ins_t H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type, + const double split_ratios[], uint8 *lt_key, hbool_t *lt_key_changed, uint8 *md_key, void *udata, @@ -121,8 +122,9 @@ static herr_t H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx); static size_t H5B_nodesize(H5F_t *f, const H5B_class_t *type, size_t *total_nkey_size, size_t sizeof_rkey); static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, - H5B_t *old_bt, const haddr_t *old_addr, - void *udata, haddr_t *new_addr /*out*/ ); + H5B_t *old_bt, const haddr_t *old_addr, intn idx, + const double split_ratios[], void *udata, + haddr_t *new_addr/*out*/); #ifdef H5B_DEBUG static herr_t H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type, void *udata); @@ -259,6 +261,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, FUNC_LEAVE(ret_value); } + /*------------------------------------------------------------------------- * Function: H5B_load @@ -280,12 +283,12 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, static H5B_t * H5B_load(H5F_t *f, const haddr_t *addr, const void *_type, void *udata) { - const H5B_class_t *type = (const H5B_class_t *) _type; - size_t size, total_nkey_size; - H5B_t *bt = NULL; - intn i; - uint8 *p; - H5B_t *ret_value = NULL; + const H5B_class_t *type = (const H5B_class_t *) _type; + size_t size, total_nkey_size; + H5B_t *bt = NULL; + intn i; + uint8 *p; + H5B_t *ret_value = NULL; FUNC_ENTER(H5B_load, NULL); @@ -391,9 +394,9 @@ H5B_load(H5F_t *f, const haddr_t *addr, const void *_type, void *udata) static herr_t H5B_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt) { - intn i; - size_t size = 0; - uint8 *p = bt->page; + intn i; + size_t size = 0; + uint8 *p = bt->page; FUNC_ENTER(H5B_flush, FAIL); @@ -506,9 +509,9 @@ H5B_flush(H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt) herr_t H5B_find(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata) { - H5B_t *bt = NULL; - intn idx = -1, lt = 0, rt, cmp = 1; - int ret_value = FAIL; + H5B_t *bt = NULL; + intn idx = -1, lt = 0, rt, cmp = 1; + int ret_value = FAIL; FUNC_ENTER(H5B_find, FAIL); @@ -605,12 +608,13 @@ H5B_find(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata) */ static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, - const haddr_t *old_addr, void *udata, haddr_t *new_addr /*out */ ) + const haddr_t *old_addr, intn idx, const double split_ratios[], + void *udata, haddr_t *new_addr/*out*/) { - H5B_t *new_bt = NULL, *tmp_bt = NULL; - herr_t ret_value = FAIL; - intn i, k; - size_t recsize = 0; + H5B_t *new_bt = NULL, *tmp_bt = NULL; + herr_t ret_value = FAIL; + intn i, k, nleft, nright; + size_t recsize = 0; FUNC_ENTER(H5B_split, FAIL); @@ -628,6 +632,53 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, recsize = old_bt->sizeof_rkey + H5F_SIZEOF_ADDR(f); k = H5B_K(f, type); +#ifdef H5B_DEBUG + if (H5DEBUG(B)) { + const char *side; + if (!H5F_addr_defined(&(old_bt->left)) && + !H5F_addr_defined(&(old_bt->right))) { + side = "ONLY"; + } else if (!H5F_addr_defined(&(old_bt->right))) { + side = "RIGHT"; + } else if (!H5F_addr_defined(&(old_bt->left))) { + side = "LEFT"; + } else { + side = "MIDDLE"; + } + fprintf(H5DEBUG(B), "H5B_split: %3d {%5.3f,%5.3f,%5.3f} %6s", + 2*k, split_ratios[0], split_ratios[1], split_ratios[2], side); + } +#endif + + /* + * Decide how to split the children of the old node among the old node + * and the new node. + */ + if (!H5F_addr_defined(&(old_bt->right))) { + nleft = 2 * k * split_ratios[2]; /*right*/ + } else if (!H5F_addr_defined(&(old_bt->left))) { + nleft = 2 * k * split_ratios[0]; /*left*/ + } else { + nleft = 2 * k * split_ratios[1]; /*middle*/ + } + + /* + * Keep the new child in the same node as the child that split. This can + * result in nodes that have an unused child when data is written + * sequentially, but it simplifies stuff below. + */ + if (idx<nleft && nleft==2*k) { + --nleft; + } else if (idx>=nleft && 0==nleft) { + nleft++; + } + nright = 2*k - nleft; +#ifdef H5B_DEBUG + if (H5DEBUG(B)) { + fprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright); + } +#endif + /* * Create the new B-tree node. */ @@ -645,31 +696,32 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, * Copy data from the old node to the new node. */ HDmemcpy(new_bt->page + H5B_SIZEOF_HDR(f), - old_bt->page + H5B_SIZEOF_HDR(f) + k * recsize, - k * recsize + new_bt->sizeof_rkey); + old_bt->page + H5B_SIZEOF_HDR(f) + nleft * recsize, + nright * recsize + new_bt->sizeof_rkey); HDmemcpy(new_bt->native, - old_bt->native + k * type->sizeof_nkey, - (k+1) * type->sizeof_nkey); + old_bt->native + nleft * type->sizeof_nkey, + (nright+1) * type->sizeof_nkey); - for (i = 0; i <= k; i++) { + for (i=0; i<=nright; i++) { /* key */ - new_bt->key[i].dirty = old_bt->key[k+i].dirty; - if (old_bt->key[k+i].nkey) { + new_bt->key[i].dirty = old_bt->key[nleft+i].dirty; + if (old_bt->key[nleft+i].nkey) { new_bt->key[i].nkey = new_bt->native + i * type->sizeof_nkey; } /* child */ - if (i < k) { - new_bt->child[i] = old_bt->child[k+i]; + if (i < nright) { + new_bt->child[i] = old_bt->child[nleft+i]; } } - new_bt->ndirty = new_bt->nchildren = k; + new_bt->ndirty = new_bt->nchildren = nright; /* * Truncate the old node. */ old_bt->dirty = TRUE; - old_bt->ndirty = old_bt->nchildren = k; - + old_bt->nchildren = nleft; + old_bt->ndirty = MIN(old_bt->ndirty, old_bt->nchildren); + /* * Update sibling pointers. */ @@ -782,11 +834,21 @@ H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx) * * Modifications: * + * Robb Matzke, 28 Sep 1998 + * The optional SPLIT_RATIOS[] indicates what percent of the child + * pointers should go in the left node when a node splits. There are + * three possibilities and a separate split ratio can be specified for + * each: [0] The node that split is the left-most node at its level of + * the tree, [1] the node that split has left and right siblings, [2] + * the node that split is the right-most node at its level of the tree. + * When a node is an only node at its level then we use the right-most + * rule. If SPLIT_RATIOS is null then default values are used. + * *------------------------------------------------------------------------- */ herr_t H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, - void *udata) + const double split_ratios[], void *udata) { /* * These are defined this way to satisfy alignment constraints. @@ -815,9 +877,10 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, assert(type->sizeof_nkey <= sizeof _lt_key); assert(addr && H5F_addr_defined(addr)); - if ((my_ins = H5B_insert_helper(f, addr, type, lt_key, <_key_changed, - md_key, udata, rt_key, &rt_key_changed, - &child/*out*/ )) < 0 || my_ins < 0) { + if ((my_ins = H5B_insert_helper(f, addr, type, split_ratios, lt_key, + <_key_changed, md_key, udata, rt_key, + &rt_key_changed, &child/*out*/))<0 || + my_ins<0) { HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key"); } @@ -934,14 +997,14 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, buf = H5MM_xfree(buf); FUNC_LEAVE(ret_value); } - + /*------------------------------------------------------------------------- * Function: H5B_insert_child * - * Purpose: Insert a child at the specified address with the - * specified left or right key. The BT argument is a pointer - * to a protected B-tree node. + * Purpose: Insert a child to the left or right of child[IDX] depending + * on whether ANCHOR is H5B_INS_LEFT or H5B_INS_RIGHT. The BT + * argument is a pointer to a protected B-tree node. * * Return: Success: SUCCEED * @@ -960,12 +1023,13 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, intn idx, const haddr_t *child, H5B_ins_t anchor, void *md_key) { - size_t recsize; - intn i; + size_t recsize; + intn i; FUNC_ENTER(H5B_insert_child, FAIL); assert(bt); assert(child); + assert(bt->nchildren<2*H5B_K(f, type)); bt->dirty = TRUE; recsize = bt->sizeof_rkey + H5F_SIZEOF_ADDR(f); @@ -974,6 +1038,8 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, /* * The MD_KEY is the left key of the new node. */ + idx++; + HDmemmove(bt->page + H5B_SIZEOF_HDR(f) + (idx+1) * recsize, bt->page + H5B_SIZEOF_HDR(f) + idx * recsize, (bt->nchildren - idx) * recsize + bt->sizeof_rkey); @@ -1060,20 +1126,30 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, * * Modifications: * + * Robb Matzke, 28 Sep 1998 + * The optional SPLIT_RATIOS[] indicates what percent of the child + * pointers should go in the left node when a node splits. There are + * three possibilities and a separate split ratio can be specified for + * each: [0] The node that split is the left-most node at its level of + * the tree, [1] the node that split has left and right siblings, [2] + * the node that split is the right-most node at its level of the tree. + * When a node is an only node at its level then we use the right-most + * rule. If SPLIT_RATIOS is null then default values are used. + * *------------------------------------------------------------------------- */ static H5B_ins_t H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type, - uint8 *lt_key, hbool_t *lt_key_changed, - uint8 *md_key, void *udata, + const double split_ratios[], uint8 *lt_key, + hbool_t *lt_key_changed, uint8 *md_key, void *udata, uint8 *rt_key, hbool_t *rt_key_changed, haddr_t *new_node/*out*/) { - H5B_t *bt = NULL, *twin = NULL, *tmp_bt = NULL; - intn lt = 0, idx = -1, rt, cmp = -1; - haddr_t child_addr; - H5B_ins_t my_ins = H5B_INS_ERROR; - H5B_ins_t ret_value = H5B_INS_ERROR; + H5B_t *bt = NULL, *twin = NULL, *tmp_bt = NULL; + intn lt = 0, idx = -1, rt, cmp = -1; + haddr_t child_addr; + H5B_ins_t my_ins = H5B_INS_ERROR; + H5B_ins_t ret_value = H5B_INS_ERROR; FUNC_ENTER(H5B_insert_helper, H5B_INS_ERROR); @@ -1163,7 +1239,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type, HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key"); } - if ((my_ins = H5B_insert_helper(f, bt->child+idx, type, + if ((my_ins = H5B_insert_helper(f, bt->child+idx, type, split_ratios, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, @@ -1219,7 +1295,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type, HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key"); } - if ((my_ins = H5B_insert_helper(f, bt->child+idx, type, + if ((my_ins = H5B_insert_helper(f, bt->child+idx, type, split_ratios, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, @@ -1278,7 +1354,7 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type, * Follow a branch out of this node to another subtree. */ assert(idx >= 0 && idx < bt->nchildren); - if ((my_ins = H5B_insert_helper(f, bt->child + idx, type, + if ((my_ins = H5B_insert_helper(f, bt->child+idx, type, split_ratios, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, @@ -1332,27 +1408,24 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type, ret_value = H5B_INS_NOOP; } else if (H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) { - /* Make sure IDX is the slot number for the new node. */ - if (H5B_INS_RIGHT == my_ins) - idx++; - /* * If this node is full then split it before inserting the new child. */ if (bt->nchildren == 2 * H5B_K(f, type)) { - if (H5B_split(f, type, bt, addr, udata, new_node /*out */ ) < 0) { + if (H5B_split(f, type, bt, addr, idx, split_ratios, udata, + new_node/*out*/)<0) { HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, - "can't split node"); + "unable to split node"); } if (NULL == (twin = H5AC_protect(f, H5AC_BT, new_node, type, udata))) { HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, - "can't load B-tree"); + "unable to load node"); } - if (idx <= H5B_K(f, type)) { + if (idx<bt->nchildren) { tmp_bt = bt; } else { - idx -= H5B_K(f, type); + idx -= bt->nchildren; tmp_bt = twin; } } else { @@ -1881,7 +1954,7 @@ static size_t H5B_nodesize(H5F_t *f, const H5B_class_t *type, size_t *total_nkey_size/*out*/, size_t sizeof_rkey) { - size_t size; + size_t size; FUNC_ENTER(H5B_nodesize, (size_t) 0); @@ -1930,8 +2003,8 @@ herr_t H5B_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent, intn fwidth, const H5B_class_t *type, void *udata) { - H5B_t *bt = NULL; - int i; + H5B_t *bt = NULL; + int i; FUNC_ENTER(H5B_debug, FAIL); @@ -2027,10 +2100,10 @@ static herr_t H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type, void *udata) { - H5B_t *bt = NULL; - intn i, ncell, cmp; - static int ncalls = 0; - herr_t status; + H5B_t *bt = NULL; + intn i, ncell, cmp; + static int ncalls = 0; + herr_t status; /* A queue of child data */ struct child_t { diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index c20135e..fe287b6 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -127,7 +127,7 @@ herr_t H5B_create (H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *); herr_t H5B_find (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata); herr_t H5B_insert (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, - void *udata); + const double split_ratios[], void *udata); herr_t H5B_remove(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata); herr_t H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, @@ -72,12 +72,19 @@ const H5D_xfer_t H5D_xfer_dflt = { NULL, /* Type conversion buffer or NULL */ NULL, /* Background buffer or NULL */ H5T_BKG_NO, /* Type of background buffer needed */ + {0.1, 0.5, 0.9}, /* B-tree node splitting ratios */ #ifndef HAVE_PARALLEL - 1, /* Cache the hyperslab blocks by default */ -#else /* HAVE_PARALLEL */ - 0, /* Don't cache the hyperslab blocks by default (for parallel) */ + 1, /* Cache the hyperslab blocks by default*/ +#else + 0, /* + * Don't cache the hyperslab blocks by + * default (for parallel) + */ #endif /* HAVE_PARALLEL */ - 0, /* Default to no upper limit on hyperslab block size to cache */ + 0, /* + * Default to no upper limit on hyperslab + * block size to cache + */ #ifdef HAVE_PARALLEL H5D_XFER_DFLT, /* Independent data transfer */ #endif @@ -89,7 +96,7 @@ static hbool_t interface_initialize_g = FALSE; static herr_t H5D_init_interface(void); static void H5D_term_interface(void); #ifdef HAVE_PARALLEL -static herr_t H5D_allocate (H5D_t *dataset); +static herr_t H5D_allocate (H5D_t *dataset, const H5D_xfer_t *xfer); #endif @@ -876,7 +883,8 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, * Also, only the slowest varying dimension of a simple data space * can be extendible. */ - if ((ndims=H5S_get_simple_extent_dims(space, new_dset->layout.dim, max_dim))<0) { + if ((ndims=H5S_get_simple_extent_dims(space, new_dset->layout.dim, + max_dim))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize contiguous storage"); } @@ -1011,7 +1019,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, */ if (new_dset->ent.file->shared->access_parms->driver == H5F_LOW_MPIO && new_dset->layout.type == H5D_CHUNKED){ - if (H5D_allocate(new_dset)==FAIL){ + if (H5D_allocate(new_dset, &H5D_xfer_dflt)<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "fail in file space allocation for chunks"); } @@ -1164,7 +1172,7 @@ H5D_open(H5G_entry_t *loc, const char *name) if (dataset->ent.file->shared->access_parms->driver==H5F_LOW_MPIO && dataset->layout.type == H5D_CHUNKED && (dataset->ent.file->intent & H5F_ACC_RDWR)){ - if (H5D_allocate(dataset)==FAIL){ + if (H5D_allocate(dataset, &H5D_xfer_dflt)<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "fail in file space allocation dataset"); } @@ -2052,7 +2060,7 @@ H5D_extend (H5D_t *dataset, const hsize_t *size) */ if (dataset->ent.file->shared->access_parms->driver==H5F_LOW_MPIO && dataset->layout.type==H5D_CHUNKED){ - if (H5D_allocate(dataset)==FAIL){ + if (H5D_allocate(dataset, &H5D_xfer_dflt)<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "fail in file space allocation for chunks"); } @@ -2141,10 +2149,10 @@ H5D_typeof (H5D_t *dset) *------------------------------------------------------------------------- */ static herr_t -H5D_allocate (H5D_t *dataset) +H5D_allocate (H5D_t *dataset, const H5D_xfer_t *xfer) { - H5S_t *space = NULL; - herr_t ret_value = FAIL; + H5S_t *space = NULL; + herr_t ret_value = FAIL; hsize_t space_dim[H5O_LAYOUT_NDIMS]; intn space_ndims; H5O_layout_t *layout; @@ -2172,7 +2180,8 @@ H5D_allocate (H5D_t *dataset) "unable to read data space info from dataset header"); } /* get current dims of dataset */ - if ((space_ndims=H5S_get_simple_extent_dims(space, space_dim, NULL)) <= 0 || + if ((space_ndims=H5S_get_simple_extent_dims(space, space_dim, + NULL)) <= 0 || space_ndims+1 != layout->ndims){ HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate chunk storage"); @@ -2181,9 +2190,9 @@ H5D_allocate (H5D_t *dataset) space_dim[space_ndims] = layout->dim[space_ndims]; if (H5F_istore_allocate(dataset->ent.file, - (layout), space_dim, - &(dataset->create_parms->pline))==FAIL){ - HRETURN(FAIL); + (layout), space_dim, xfer->split_ratios, + &(dataset->create_parms->pline))<0) { + HRETURN(FAIL); } break; diff --git a/src/H5Distore.c b/src/H5Distore.c index 31f1ec8..88399fd 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.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"); } diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 5bc6920..c647cf0 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -55,8 +55,9 @@ typedef struct H5D_xfer_t { void *tconv_buf; /*type conversion buffer or null */ void *bkg_buf; /*background buffer or null */ H5T_bkg_t need_bkg; /*type of background buffer needed */ - uintn cache_hyper; /* Whether to (try to) cache hyperslab blocks during I/O */ - uintn block_limit; /* The largest hyperslab block to try to cache */ + double split_ratios[3];/*B-tree node splitting ratios */ + uintn cache_hyper; /*cache hyperslab blocks during I/O? */ + uintn block_limit; /*largest hyperslab block to cache */ H5D_transfer_t xfer_mode; /*independent or collective transfer */ } H5D_xfer_t; diff --git a/src/H5Farray.c b/src/H5Farray.c index 27ec922..b3ebcff 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -110,14 +110,19 @@ H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/) * June 2, 1998 Albert Cheng * Added xfer_mode argument * + * Sep 28, 1998 Robb Matzke + * Added the `xfer' argument and removed the `xfer_mode' + * argument since it's a field of `xfer'. + * *------------------------------------------------------------------------- */ herr_t -H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, +H5F_arr_read (H5F_t *f, const H5D_xfer_t *xfer, + const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, const hsize_t _hslab_size[], const hsize_t mem_size[], const hssize_t mem_offset[], const hssize_t file_offset[], - const H5D_transfer_t xfer_mode, void *_buf/*out*/) + void *_buf/*out*/) { uint8 *buf = (uint8 *)_buf; /*cast for arithmetic */ hssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */ @@ -148,7 +153,7 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, H5V_vector_cpy (layout->ndims, hslab_size, _hslab_size); #ifdef HAVE_PARALLEL - if (xfer_mode==H5D_XFER_COLLECTIVE){ + if (xfer->xfer_mode==H5D_XFER_COLLECTIVE){ if (layout->type != H5D_CONTIGUOUS) HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "collective access on non-contiguous datasets not " @@ -222,7 +227,7 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, * memory. */ #ifdef HAVE_PARALLEL - if (xfer_mode==H5D_XFER_COLLECTIVE){ + if (xfer->xfer_mode==H5D_XFER_COLLECTIVE){ /* Currently supports same number of collective access. * Need to be changed LATER to combine all reads into one * collective MPIO call. @@ -253,7 +258,8 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "external data read failed"); } - } else if (H5F_block_read (f, &addr, elmt_size, xfer_mode, buf)<0) { + } else if (H5F_block_read (f, &addr, elmt_size, xfer->xfer_mode, + buf)<0) { HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "block read failed"); } @@ -286,7 +292,7 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, "unable to copy into a proper hyperslab"); } } - if (H5F_istore_read (f, layout, pline, file_offset, hslab_size, + if (H5F_istore_read (f, xfer, layout, pline, file_offset, hslab_size, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "chunked read failed"); } @@ -328,15 +334,19 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, * June 2, 1998 Albert Cheng * Added xfer_mode argument * + * Sep 28, 1998 Robb Matzke + * Added `xfer' argument, removed `xfer_mode' argument since it + * is a member of H5D_xfer_t. + * *------------------------------------------------------------------------- */ herr_t -H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, +H5F_arr_write (H5F_t *f, const H5D_xfer_t *xfer, + const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, const hsize_t _hslab_size[], const hsize_t mem_size[], const hssize_t mem_offset[], - const hssize_t file_offset[], const H5D_transfer_t xfer_mode, - const void *_buf) + const hssize_t file_offset[], const void *_buf) { const uint8 *buf = (const uint8 *)_buf; /*cast for arithmetic */ hssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */ @@ -355,35 +365,40 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, FUNC_ENTER (H5F_arr_write, FAIL); /* Check args */ - assert (f); - assert (layout); - assert (_hslab_size); - assert (file_offset); - assert (mem_offset); - assert (mem_size); - assert (buf); + assert(f); + assert(layout); + assert(_hslab_size); + assert(file_offset); + assert(mem_offset); + assert(mem_size); + assert(buf); /* Make a local copy of _size so we can modify it */ H5V_vector_cpy (layout->ndims, hslab_size, _hslab_size); #ifdef HAVE_PARALLEL - if (xfer_mode==H5D_XFER_COLLECTIVE){ - if (layout->type != H5D_CONTIGUOUS) + if (xfer->xfer_mode==H5D_XFER_COLLECTIVE) { + if (layout->type != H5D_CONTIGUOUS) { HRETURN_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, - "collective access on non-contiguous datasets not supported yet"); + "collective access on non-contiguous datasets not " + "supported yet"); + } } #endif #ifdef QAK -{ - extern int qak_debug; - - printf("%s: layout->ndims=%d\n",FUNC,(int)layout->ndims); - for(i=0; i<layout->ndims; i++) - printf("%s: %d: hslab_size=%d, mem_size=%d, mem_offset=%d, file_offset=%d\n",FUNC,i,(int)_hslab_size[i],(int)mem_size[i],(int)mem_offset[i],(int)file_offset[i]); - if(qak_debug) { - printf("%s: *buf=%d, *(buf+1)=%d\n", FUNC,(int)*(const uint16 *)buf,(int)*((const uint16 *)buf+1)); + { + extern int qak_debug; + + printf("%s: layout->ndims=%d\n",FUNC,(int)layout->ndims); + for(i=0; i<layout->ndims; i++) + printf("%s: %d: hslab_size=%d, mem_size=%d, mem_offset=%d, " + "file_offset=%d\n", FUNC, i, (int)_hslab_size[i], + (int)mem_size[i],(int)mem_offset[i],(int)file_offset[i]); + if(qak_debug) { + printf("%s: *buf=%d, *(buf+1)=%d\n", FUNC, + (int)*(const uint16 *)buf, (int)*((const uint16 *)buf+1)); + } } -} #endif /* QAK */ switch (layout->type) { @@ -440,7 +455,7 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, * disk. */ #ifdef HAVE_PARALLEL - if (xfer_mode==H5D_XFER_COLLECTIVE){ + if (xfer->xfer_mode==H5D_XFER_COLLECTIVE){ /* Currently supports same number of collective access. * Need to be changed LATER to combine all writes into one * collective MPIO call. @@ -454,11 +469,13 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, f->shared->access_parms->u.mpio.comm); #ifdef AKC -printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); + printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); #endif - if (max != min) + if (max != min) { HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, - "collective access with unequal number of blocks not supported yet"); + "collective access with unequal number of " + "blocks not supported yet"); + } } #endif @@ -470,7 +487,8 @@ printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "external data write failed"); } - } else if (H5F_block_write (f, &addr, elmt_size, xfer_mode, buf)<0) { + } else if (H5F_block_write(f, &addr, elmt_size, xfer->xfer_mode, + buf)<0) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); } @@ -490,7 +508,7 @@ printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); case H5D_CHUNKED: /* - * This method is unable to access external raw daa files or to copy + * This method is unable to access external raw data files or to copy * from a proper hyperslab. */ if (efl && efl->nused>0) { @@ -504,7 +522,7 @@ printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max); "unable to copy from a proper hyperslab"); } } - if (H5F_istore_write (f, layout, pline, file_offset, hslab_size, + if (H5F_istore_write (f, xfer, layout, pline, file_offset, hslab_size, buf)<0) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "chunked write failed"); 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"); } diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index a4e47fd..9513689 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -506,6 +506,7 @@ typedef struct H5F_t { struct H5O_layout_t; /*forward decl for prototype arguments */ struct H5O_efl_t; /*forward decl for prototype arguments */ struct H5O_pline_t; /*forward decl for prototype arguments */ +struct H5D_xfer_t; /*forward decl for prototype arguments */ /* library variables */ extern const H5F_create_t H5F_create_dflt; @@ -529,18 +530,18 @@ herr_t H5F_istore_debug(H5F_t *f, const haddr_t *addr, FILE * stream, /* Functions that operate on array storage */ herr_t H5F_arr_create(H5F_t *f, struct H5O_layout_t *layout /*in,out*/); -herr_t H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout, +herr_t H5F_arr_read (H5F_t *f, const struct H5D_xfer_t *xfer, + const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, const hsize_t _hslab_size[], const hsize_t mem_size[], const hssize_t mem_offset[], - const hssize_t file_offset[], - const H5D_transfer_t xfer_mode, void *_buf/*out*/); -herr_t H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout, + const hssize_t file_offset[], void *_buf/*out*/); +herr_t H5F_arr_write (H5F_t *f, const struct H5D_xfer_t *xfer, + const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, const hsize_t _hslab_size[], const hsize_t mem_size[], const hssize_t mem_offset[], - const hssize_t file_offset[], - const H5D_transfer_t xfer_mode, const void *_buf); + const hssize_t file_offset[], const void *_buf); /* Functions that operate on indexed storage */ herr_t H5F_istore_init (H5F_t *f); @@ -548,17 +549,20 @@ herr_t H5F_istore_flush (H5F_t *f, hbool_t preempt); herr_t H5F_istore_dest (H5F_t *f); herr_t H5F_istore_stats (H5F_t *f, hbool_t headers); herr_t H5F_istore_create(H5F_t *f, struct H5O_layout_t *layout /*in,out*/); -herr_t H5F_istore_read(H5F_t *f, const struct H5O_layout_t *layout, +herr_t H5F_istore_read(H5F_t *f, const struct H5D_xfer_t *xfer, + const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const hssize_t offset[], const hsize_t size[], void *buf /*out */ ); -herr_t H5F_istore_write(H5F_t *f, const struct H5O_layout_t *layout, +herr_t H5F_istore_write(H5F_t *f, const struct H5D_xfer_t *xfer, + const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const hssize_t offset[], const hsize_t size[], const void *buf); herr_t H5F_istore_allocate (H5F_t *f, const struct H5O_layout_t *layout, const hsize_t *space_dim, + const double split_ratios[], const struct H5O_pline_t *pline); /* Functions that operate on contiguous storage wrt boot block */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index e5a5bab..cd71183 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -183,6 +183,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent) { H5O_stab_t stab; /*symbol table message */ H5G_bt_ud1_t udata; /*data to pass through B-tree */ + static double split_ratios[3] = {0.1, 0.5, 0.9}; FUNC_ENTER(H5G_stab_insert, FAIL); @@ -202,7 +203,8 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent) udata.ent = *obj_ent; /* insert */ - if (H5B_insert(grp_ent->file, H5B_SNODE, &(stab.btree_addr), &udata) < 0) { + if (H5B_insert(grp_ent->file, H5B_SNODE, &(stab.btree_addr), split_ratios, + &udata) < 0) { HRETURN_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry"); } @@ -2524,6 +2524,103 @@ H5Pset_deflate(hid_t plist_id, unsigned level) } +/*------------------------------------------------------------------------- + * Function: H5Pget_btree_ratios + * + * Purpose: Queries B-tree split ratios. See H5Pset_btree_ratios(). + * + * Return: Success: SUCCEED with split ratios returned through + * the non-null arguments. + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Monday, September 28, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/, + double *right/*out*/) +{ + H5D_xfer_t *plist = NULL; + + FUNC_ENTER(H5Pget_btree_ratios, FAIL); + H5TRACE4("e","ixxx",plist_id,left,middle,right); + + /* Check arguments */ + if (H5P_DATASET_XFER!=H5P_get_class(plist_id) || + NULL==(plist=H5I_object(plist_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "not a dataset transfer property list"); + } + + /* Get values */ + if (left) *left = plist->split_ratios[0]; + if (middle) *middle = plist->split_ratios[1]; + if (right) *right = plist->split_ratios[2]; + + FUNC_LEAVE(SUCCEED); +} + + +/*------------------------------------------------------------------------- + * Function: H5Pset_btree_ratios + * + * Purpose: Sets B-tree split ratios for a dataset transfer property + * list. The split ratios determine what percent of children go + * in the first node when a node splits. The LEFT ratio is + * used when the splitting node is the left-most node at its + * level in the tree; the RIGHT ratio is when the splitting node + * is the right-most node at its level; and the MIDDLE ratio for + * all other cases. A node which is the only node at its level + * in the tree uses the RIGHT ratio when it splits. All ratios + * are real numbers between 0 and 1, inclusive. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Monday, September 28, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_btree_ratios(hid_t plist_id, double left, double middle, + double right) +{ + + H5D_xfer_t *plist = NULL; + + FUNC_ENTER(H5Pget_btree_ratios, FAIL); + H5TRACE4("e","iddd",plist_id,left,middle,right); + + /* Check arguments */ + if (H5P_DATASET_XFER!=H5P_get_class(plist_id) || + NULL==(plist=H5I_object(plist_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "not a dataset transfer property list"); + } + if (left<0.0 || left>1.0 || middle<0.0 || middle>1.0 || + right<0.0 || right>1.0) { + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "split ratio must satisfy 0.0<=X<=1.0"); + } + + /* Set values */ + plist->split_ratios[0] = left; + plist->split_ratios[1] = middle; + plist->split_ratios[2] = right; + + FUNC_LEAVE(SUCCEED); +} + + #ifdef HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: H5Pset_mpi diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 123ec41..cc6c4e3 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -108,6 +108,10 @@ herr_t H5Pget_cache (hid_t plist_id, int *mdc_nelmts/*out*/, double *rdcc_w0); herr_t H5Pset_hyper_cache(hid_t plist_id, unsigned cache, unsigned limit); herr_t H5Pget_hyper_cache(hid_t plist_id, unsigned *cache, unsigned *limit); +herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, + double right); +herr_t H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, + double *middle/*out*/, double *right/*out*/); #ifdef HAVE_PARALLEL herr_t H5Pset_mpi (hid_t plist_id, MPI_Comm comm, MPI_Info info); diff --git a/src/H5Sall.c b/src/H5Sall.c index 71d8181..e3ea157 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -27,15 +27,13 @@ static size_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts, - const void *_xfer_parms, - void *buf/*out*/); + const H5D_xfer_t *xfer_parms, void *buf/*out*/); static herr_t H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts, - const void *_xfer_parms, - const void *buf); + const H5D_xfer_t *xfer_parms, const void *buf); static size_t H5S_all_mgath (const void *_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, void *_tconv_buf/*out*/); @@ -168,12 +166,11 @@ H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, size_t max) */ static size_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout, - const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, - size_t elmt_size, const H5S_t *file_space, - H5S_sel_iter_t *file_iter, size_t nelmts, - const void *_xfer_parms, void *_buf/*out*/) + const struct H5O_pline_t *pline, + const struct H5O_efl_t *efl, size_t elmt_size, + const H5S_t *file_space, H5S_sel_iter_t *file_iter, + size_t nelmts, const H5D_xfer_t *xfer_parms, void *_buf/*out*/) { - const H5D_xfer_t *xfer_parms=(const H5D_xfer_t *)_xfer_parms; /* Coerce the type */ hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */ @@ -225,8 +222,8 @@ H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout, /* * Gather from file. */ - if (H5F_arr_read (f, layout, pline, efl, hsize, hsize, zero, file_offset, - xfer_parms->xfer_mode, buf/*out*/)<0) { + if (H5F_arr_read (f, xfer_parms, layout, pline, efl, hsize, hsize, zero, + file_offset, buf/*out*/)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, "read error"); } @@ -262,9 +259,8 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts, - const void *_xfer_parms, const void *_buf) + const H5D_xfer_t *xfer_parms, const void *_buf) { - const H5D_xfer_t *xfer_parms=(const H5D_xfer_t *)_xfer_parms; /* Coerce the type */ hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of hyperslab */ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero vector */ @@ -312,8 +308,8 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout, /* * Scatter to file. */ - if (H5F_arr_write (f, layout, pline, efl, hsize, hsize, zero, - file_offset, xfer_parms->xfer_mode, buf)<0) { + if (H5F_arr_write (f, xfer_parms, layout, pline, efl, hsize, hsize, zero, + file_offset, buf)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error"); } diff --git a/src/H5Shyper.c b/src/H5Shyper.c index c67be6b..54ee1bd 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -58,15 +58,13 @@ static size_t H5S_hyper_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts, - const void *_xfer_parms, - void *buf/*out*/); + const H5D_xfer_t *xfer_parms, void *buf/*out*/); static herr_t H5S_hyper_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts, - const void *_xfer_parms, - const void *buf); + const H5D_xfer_t *xfer_parms, const void *buf); static size_t H5S_hyper_mgath (const void *_buf, size_t elmt_size, const H5S_t *mem_space, H5S_sel_iter_t *mem_iter, size_t nelmts, @@ -454,10 +452,10 @@ H5S_hyper_block_cache (H5S_hyper_node_t *node, H5S_hyper_fhyper_info_t *fhyper_i hsize[i]=(node->end[i]-node->start[i])+1; hsize[fhyper_info->space->extent.u.simple.rank]=fhyper_info->elmt_size; - if (H5F_arr_read (fhyper_info->f, fhyper_info->layout, - fhyper_info->pline, fhyper_info->efl, - hsize, hsize, zero, file_offset, - fhyper_info->xfer_parms->xfer_mode, node->cinfo.block/*out*/)<0) + if (H5F_arr_read (fhyper_info->f, fhyper_info->xfer_parms, + fhyper_info->layout, fhyper_info->pline, + fhyper_info->efl, hsize, hsize, zero, file_offset, + node->cinfo.block/*out*/)<0) HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, FAIL, "read error"); } /* end if */ else { @@ -571,10 +569,10 @@ H5S_hyper_block_write (H5S_hyper_node_t *node, H5S_hyper_fhyper_info_t *fhyper_i hsize[i]=(node->end[i]-node->start[i])+1; hsize[fhyper_info->space->extent.u.simple.rank]=fhyper_info->elmt_size; - if (H5F_arr_write (fhyper_info->f, fhyper_info->layout, - fhyper_info->pline, fhyper_info->efl, - hsize, hsize, zero, file_offset, - fhyper_info->xfer_parms->xfer_mode, node->cinfo.block/*out*/)<0) + if (H5F_arr_write (fhyper_info->f, fhyper_info->xfer_parms, + fhyper_info->layout, fhyper_info->pline, + fhyper_info->efl, hsize, hsize, zero, file_offset, + node->cinfo.block/*out*/)<0) HRETURN_ERROR (H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error"); /* Release the temporary buffer */ @@ -691,13 +689,13 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) /* * Gather from file. */ - if (H5F_arr_read (fhyper_info->f, fhyper_info->layout, - fhyper_info->pline, fhyper_info->efl, - hsize, hsize, zero, file_offset, - fhyper_info->xfer_parms->xfer_mode, - fhyper_info->dst/*out*/)<0) { + if (H5F_arr_read (fhyper_info->f, fhyper_info->xfer_parms, + fhyper_info->layout, fhyper_info->pline, + fhyper_info->efl, hsize, hsize, zero, + file_offset, + fhyper_info->dst/*out*/)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, - "read error"); + "read error"); } #ifdef QAK printf("%s: check 2.3, region #%d\n",FUNC,(int)i); @@ -793,10 +791,9 @@ H5S_hyper_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const void *_xfer_parms, + size_t nelmts, const H5D_xfer_t *xfer_parms, void *_buf/*out*/) { - const H5D_xfer_t *xfer_parms=(const H5D_xfer_t *)_xfer_parms; /* Coerce the type */ H5S_hyper_bound_t **lo_bounds; /* Lower (closest to the origin) bound array for each dimension */ H5S_hyper_bound_t **hi_bounds; /* Upper (farthest from the origin) bound array for each dimension */ H5S_hyper_fhyper_info_t fhyper_info; /* Block of parameters to pass into recursive calls */ @@ -962,12 +959,12 @@ H5S_hyper_fwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) /* * Scatter to file. */ - if (H5F_arr_write (fhyper_info->f, fhyper_info->layout, - fhyper_info->pline, fhyper_info->efl, - hsize, hsize, zero, file_offset, - fhyper_info->xfer_parms->xfer_mode, - fhyper_info->src)<0) { - HRETURN_ERROR (H5E_DATASPACE, H5E_WRITEERROR, 0, "write error"); + if (H5F_arr_write (fhyper_info->f, fhyper_info->xfer_parms, + fhyper_info->layout, fhyper_info->pline, + fhyper_info->efl, hsize, hsize, zero, + file_offset, fhyper_info->src)<0) { + HRETURN_ERROR (H5E_DATASPACE, H5E_WRITEERROR, 0, + "write error"); } } /* end else */ @@ -1054,10 +1051,9 @@ H5S_hyper_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const void *_xfer_parms, + size_t nelmts, const H5D_xfer_t *xfer_parms, const void *_buf) { - const H5D_xfer_t *xfer_parms=(const H5D_xfer_t *)_xfer_parms; /* Coerce the type */ H5S_hyper_bound_t **lo_bounds; /* Lower (closest to the origin) bound array for each dimension */ H5S_hyper_bound_t **hi_bounds; /* Upper (farthest from the origin) bound array for each dimension */ H5S_hyper_fhyper_info_t fhyper_info; /* Block of parameters to pass into recursive calls */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index f3edd63..d532fcf 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -28,14 +28,14 @@ static size_t H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts, - const void *_xfer_parms, + const H5D_xfer_t *xfer_parms, void *buf/*out*/); static herr_t H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, size_t nelmts, - const void *_xfer_parms, + const H5D_xfer_t *xfer_parms, const void *buf); static size_t H5S_point_mgath (const void *_buf, size_t elmt_size, const H5S_t *mem_space, @@ -267,10 +267,9 @@ H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const void *_xfer_parms, + size_t nelmts, const H5D_xfer_t *xfer_parms, void *_buf/*out*/) { - const H5D_xfer_t *xfer_parms=(const H5D_xfer_t *)_xfer_parms; /* Coerce the type */ hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */ @@ -318,8 +317,8 @@ H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout, file_offset[i] += file_space->select.offset[i]; /* Go read the point */ - if (H5F_arr_read (f, layout, pline, efl, hsize, hsize, zero, - file_offset, xfer_parms->xfer_mode, buf/*out*/)<0) { + if (H5F_arr_read (f, xfer_parms, layout, pline, efl, hsize, hsize, + zero, file_offset, buf/*out*/)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, "read error"); } @@ -377,10 +376,9 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const void *_xfer_parms, + size_t nelmts, const H5D_xfer_t *xfer_parms, const void *_buf) { - const H5D_xfer_t *xfer_parms=(const H5D_xfer_t *)_xfer_parms; /* Coerce the type */ hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of hyperslab */ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero vector */ @@ -447,8 +445,8 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout, } #endif /* QAK */ /* Go write the point */ - if (H5F_arr_write (f, layout, pline, efl, hsize, hsize, zero, - file_offset, xfer_parms->xfer_mode, buf)<0) { + if (H5F_arr_write (f, xfer_parms, layout, pline, efl, hsize, hsize, + zero, file_offset, buf)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_WRITEERROR, 0, "write error"); } diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 7d3b93b..c870a29 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -20,6 +20,7 @@ /* Private headers needed by this file */ #include <H5private.h> +#include <H5Fprivate.h> #include <H5Gprivate.h> /*for H5G_entry_t */ #include <H5Oprivate.h> @@ -192,7 +193,7 @@ typedef struct H5S_fconv_t { const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const void *xfer_parms, + size_t nelmts, const struct H5D_xfer_t *xfer_parms, void *tconv_buf/*out*/); /* Scatter elements from type conversion buffer to disk */ @@ -200,7 +201,7 @@ typedef struct H5S_fconv_t { const struct H5O_pline_t *pline, const struct H5O_efl_t *efl, size_t elmt_size, const H5S_t *file_space, H5S_sel_iter_t *file_iter, - size_t nelmts, const void *xfer_parms, + size_t nelmts, const struct H5D_xfer_t *xfer_parms, const void *tconv_buf); } H5S_fconv_t; |