summaryrefslogtreecommitdiffstats
path: root/src/H5Sselect.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-03-07 19:12:20 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-03-07 19:12:20 (GMT)
commitac0ef34a4132dcf8c27eb6731cb2686acc593205 (patch)
tree2efe1bf4d516206f806ae74016e921a3a42ee58a /src/H5Sselect.c
parente367f64e24b95876d7c2673c7181aa12533d3f31 (diff)
downloadhdf5-ac0ef34a4132dcf8c27eb6731cb2686acc593205.zip
hdf5-ac0ef34a4132dcf8c27eb6731cb2686acc593205.tar.gz
hdf5-ac0ef34a4132dcf8c27eb6731cb2686acc593205.tar.bz2
[svn-r24769] Description:
Check in Mohamad's changes to support collective I/O on point selections, along with some other minor cleanups. Tested on: Mac OSX/64 10.9.2 (amazon) w/parallel & serial (h5committest forthcoming)
Diffstat (limited to 'src/H5Sselect.c')
-rw-r--r--src/H5Sselect.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 44688b6..2cb4b38 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -34,8 +34,8 @@
/* Local functions */
#ifdef LATER
-static herr_t H5S_select_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
-static htri_t H5S_select_iter_has_next_block (const H5S_sel_iter_t *iter);
+static herr_t H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
+static htri_t H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter);
#endif /* LATER */
@@ -922,7 +922,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hsize_t *coords)
+H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords)
{
herr_t ret_value; /* return value */
@@ -964,7 +964,7 @@ H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hsize_t *coords)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_select_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
+H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
herr_t ret_value; /* return value */
@@ -1004,7 +1004,7 @@ H5S_select_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
REVISION LOG
--------------------------------------------------------------------------*/
hsize_t
-H5S_select_iter_nelmts (const H5S_sel_iter_t *sel_iter)
+H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter)
{
hsize_t ret_value; /* return value */
@@ -1043,7 +1043,7 @@ H5S_select_iter_nelmts (const H5S_sel_iter_t *sel_iter)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_select_iter_has_next_block (const H5S_sel_iter_t *iter)
+H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter)
{
herr_t ret_value; /* return value */
@@ -1217,24 +1217,13 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
H5T_t *dt; /* Datatype structure */
H5S_sel_iter_t iter; /* Selection iteration info */
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
- uint8_t *loc; /* Current element location in buffer */
- hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */
hssize_t nelmts; /* Number of elements in selection */
hsize_t space_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */
- hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
- hsize_t curr_off; /* Current offset within sequence */
- hsize_t tmp_off; /* Temporary offset within sequence */
- size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
- size_t curr_len; /* Length of bytes left to process in sequence */
- size_t nseq; /* Number of sequences generated */
- size_t curr_seq; /* Current sequnce being worked on */
- size_t nelem; /* Number of elements used in sequences */
size_t max_elem; /* Maximum number of elements allowed in sequences */
size_t elmt_size; /* Datatype size */
unsigned ndims; /* Number of dimensions in dataspace */
- int i; /* Local Index variable */
- herr_t user_ret=0; /* User's return value */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t user_ret = 0; /* User's return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1274,12 +1263,21 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
/* Loop, while elements left in selection */
while(max_elem > 0 && user_ret == 0) {
+ hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
+ size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
+ size_t nelem; /* Number of elements used in sequences */
+ size_t nseq; /* Number of sequences generated */
+ size_t curr_seq; /* Current sequence being worked on */
+
/* Get the sequences of bytes */
if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Loop, while sequences left to process */
- for(curr_seq=0; curr_seq<nseq && user_ret==0; curr_seq++) {
+ for(curr_seq = 0; curr_seq < nseq && user_ret == 0; curr_seq++) {
+ hsize_t curr_off; /* Current offset within sequence */
+ size_t curr_len; /* Length of bytes left to process in sequence */
+
/* Get the current offset */
curr_off = off[curr_seq];
@@ -1288,6 +1286,11 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
/* Loop, while bytes left in sequence */
while(curr_len > 0 && user_ret == 0) {
+ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */
+ hsize_t tmp_off; /* Temporary offset within sequence */
+ uint8_t *loc; /* Current element location in buffer */
+ int i; /* Local Index variable */
+
/* Compute the coordinate from the offset */
for(i = (int)ndims, tmp_off = curr_off; i >= 0; i--) {
coords[i] = tmp_off % space_size[i];
@@ -1298,22 +1301,22 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
loc = (unsigned char *)buf + curr_off;
/* Call user's callback routine */
- user_ret=(*op)(loc,type_id,ndims,coords,operator_data);
+ user_ret = (*op)(loc, type_id, ndims, coords, operator_data);
/* Increment offset in dataspace */
- curr_off+=elmt_size;
+ curr_off += elmt_size;
/* Decrement number of bytes left in sequence */
- curr_len-=elmt_size;
+ curr_len -= elmt_size;
} /* end while */
} /* end for */
/* Decrement number of elements left to process */
- max_elem-=nelem;
+ max_elem -= nelem;
} /* end while */
/* Set return value */
- ret_value=user_ret;
+ ret_value = user_ret;
done:
/* Release selection iterator */