summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-06-17 05:26:10 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-06-17 05:26:10 (GMT)
commitf5ddc36428e90357cb2fa9827cba69722295bc97 (patch)
treeb47b7cbde9c2991754cbe830b680474247ca6ccb
parentb2dab0602a642d433fdd110f3d816639133e3db0 (diff)
downloadhdf5-f5ddc36428e90357cb2fa9827cba69722295bc97.zip
hdf5-f5ddc36428e90357cb2fa9827cba69722295bc97.tar.gz
hdf5-f5ddc36428e90357cb2fa9827cba69722295bc97.tar.bz2
[svn-r25301] - Update analysis shipping and View generation to use new Hyperslab API extensions
- fix bugs with irregular hyperslab selections when converting to IOD slabs - update dataset I/O to use IOD list I/O APIs.
-rw-r--r--src/H5Shyper.c24
-rw-r--r--src/H5VLiod_analysis.c21
-rw-r--r--src/H5VLiod_dset.c97
-rw-r--r--src/H5VLiod_server.h2
-rw-r--r--src/H5VLiod_util.c11
-rw-r--r--src/H5VLiod_view.c15
6 files changed, 133 insertions, 37 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 12f8b4e..db07e71 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -9374,7 +9374,13 @@ H5Sselect_is_regular(hid_t space_id)
if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS)
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "not a hyperslab selection")
- if(space->select.sel_info.hslab->diminfo_valid)
+ /* Rebuild diminfo if it is invalid and has not been confirmed to be
+ * impossible */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO) {
+ (void)H5S_hyper_rebuild((H5S_t *)space);
+ }
+
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)
ret_value = TRUE;
else
ret_value = FALSE;
@@ -9391,7 +9397,7 @@ done:
retrieve the start, stride, count, block arrays of a regular
hyperslab selection
RETURNS
- TRUE/FALSE/FAIL
+ SUCCESS/FAIL
--------------------------------------------------------------------------*/
herr_t
H5Sget_reg_hyperslab_params(hid_t space_id, hsize_t start[], hsize_t stride[],
@@ -9407,11 +9413,21 @@ H5Sget_reg_hyperslab_params(hid_t space_id, hsize_t start[], hsize_t stride[],
H5TRACE5("e", "i*h*h*h*h", space_id, start, stride, count, block);
/* Check args */
- if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
- if(!space->select.sel_info.hslab->diminfo_valid)
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_IMPOSSIBLE)
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "not a regular hyperslab selection")
+ /* Rebuild diminfo if it is invalid and has not been confirmed to be
+ * impossible */
+ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO) {
+ (void)H5S_hyper_rebuild((H5S_t *)space);
+ }
+
+ if(space->select.sel_info.hslab->diminfo_valid != H5S_DIMINFO_VALID_YES) {
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "not a regular hyperslab selection")
+ }
+
diminfo = space->select.sel_info.hslab->opt_diminfo;
ndims = space->extent.rank;
diff --git a/src/H5VLiod_analysis.c b/src/H5VLiod_analysis.c
index 9ad61f8..a5aeb10 100644
--- a/src/H5VLiod_analysis.c
+++ b/src/H5VLiod_analysis.c
@@ -78,7 +78,7 @@ static herr_t H5VL__iod_farm_work(iod_obj_map_t *obj_map, iod_handle_t *cohs,
hid_t *combine_type_id);
static herr_t H5VL__iod_farm_split(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid,
- hid_t space_id, iod_size_t num_cells, hid_t type_id,
+ hid_t space_id, hid_t type_id,
const char *split_script, void **split_data,
size_t *split_num_elmts, hid_t *split_type_id);
@@ -828,8 +828,6 @@ H5VL__iod_farm_work(iod_obj_map_t *obj_map, iod_handle_t *cohs,
for(i=0 ; i<num_ions_g ; i++) {
hid_t space_id;
- farm_input.num_cells = 0;
-
/* Get all ranges that are on Node i into a dataspace */
for(u = 0; u < obj_map->u_map.array_map.n_range ; u++) {
uint32_t worker = obj_map->u_map.array_map.array_range[u].nearest_rank;
@@ -889,14 +887,14 @@ H5VL__iod_farm_work(iod_obj_map_t *obj_map, iod_handle_t *cohs,
#if H5_EFF_DEBUG
fprintf(stderr, "Farming to %d\n", worker);
#endif
- farm_input.num_cells = obj_map->u_map.array_map.array_range[u].n_cell;
coords.start_cell = obj_map->u_map.array_map.array_range[u].start_cell;
coords.end_cell = obj_map->u_map.array_map.array_range[u].end_cell;
if(FAIL == (space_layout = H5VL__iod_get_space_layout(coords, region)))
HGOTO_ERROR_FF(FAIL, "can't generate local dataspace selection");
- /* MSC - AND region and space_layout */
+ if(H5Smodify_select(space_layout, H5S_SELECT_AND, region) < 0)
+ HGOTO_ERROR_FF(FAIL, "Unable to AND 2 dataspace selections");
farm_input.space_id = space_layout;
farm_input.coh = cohs[worker];
@@ -905,8 +903,8 @@ H5VL__iod_farm_work(iod_obj_map_t *obj_map, iod_handle_t *cohs,
if (worker == 0) {
hg_reqs[u] = HG_REQUEST_NULL;
/* Do a local split */
- if(FAIL == H5VL__iod_farm_split(cohs[0], obj_map->oid, rtid, space_layout,
- farm_input.num_cells, farm_input.type_id, split_script,
+ if(FAIL == H5VL__iod_farm_split(cohs[0], obj_map->oid, rtid, farm_input.space_id,
+ farm_input.type_id, split_script,
&split_data[u], &split_num_elmts[u], &split_type_id))
HGOTO_ERROR_FF(FAIL, "can't split in farmed job");
} else {
@@ -1021,7 +1019,7 @@ done:
*/
static herr_t
H5VL__iod_farm_split(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid,
- hid_t space_id, iod_size_t num_cells, hid_t type_id,
+ hid_t space_id, hid_t type_id,
const char *split_script, void **split_data,
size_t *split_num_elmts, hid_t *split_type_id)
{
@@ -1034,8 +1032,6 @@ H5VL__iod_farm_split(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid,
elmt_size = H5Tget_size(type_id);
buf_size = nelmts * elmt_size;
- assert(num_cells == nelmts);
-
/* allocate buffer to hold data */
if(NULL == (data = malloc(buf_size)))
HGOTO_ERROR_FF(FAIL, "can't allocate read buffer");
@@ -1097,13 +1093,12 @@ H5VL_iod_server_analysis_farm_cb(AXE_engine_t UNUSED axe_engine,
iod_trans_id_t rtid = input->rtid;
iod_obj_id_t obj_id = input->obj_id; /* The ID of the object */
const char *split_script = input->split_script;
- iod_size_t num_cells = input->num_cells;
void *split_data = NULL;
size_t split_num_elmts = 0;
hid_t split_type_id = FAIL;
herr_t ret_value = SUCCEED;
- if(H5VL__iod_farm_split(coh, obj_id, rtid, space_id, num_cells, type_id, split_script,
+ if(H5VL__iod_farm_split(coh, obj_id, rtid, space_id, type_id, split_script,
&split_data, &split_num_elmts, &split_type_id) < 0)
HGOTO_ERROR_FF(FAIL, "can't split in farmed job");
@@ -1275,7 +1270,7 @@ H5VL__iod_read_selection(iod_handle_t coh, iod_obj_id_t obj_id,
/* read the data selection from IOD. */
/* MSC - will need to do it in pieces, not it one shot. */
elmt_size = H5Tget_size(type_id);
- ret = H5VL__iod_server_final_io(obj_oh, space_id, elmt_size, FALSE,
+ ret = H5VL__iod_server_final_io(coh, obj_oh, space_id, elmt_size, FALSE,
buf, buf_size, (uint64_t)0, 0, rtid);
if(SUCCEED != ret)
HGOTO_ERROR_FF(ret, "can't read from array object");
diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c
index 5a97906..39a2914 100644
--- a/src/H5VLiod_dset.c
+++ b/src/H5VLiod_dset.c
@@ -29,6 +29,11 @@
* Purpose: The IOD plugin server side dataset routines.
*/
+/* offsetof */
+#ifndef offsetof
+# define offsetof(typ, memb) ((long)((char *)&(((typ *)0)->memb)))
+#endif
+
/* User data for VL traverssal */
typedef struct {
iod_handle_t coh;
@@ -676,7 +681,7 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine,
/* If the data is not VL, we can read the data from the array the normal way */
elmt_size = H5Tget_size(src_id);
- ret = H5VL__iod_server_final_io(iod_oh.rd_oh, space_id, elmt_size, FALSE,
+ ret = H5VL__iod_server_final_io(coh, iod_oh.rd_oh, space_id, elmt_size, FALSE,
buf, buf_size, (uint64_t)0, raw_cs_scope, read_tid);
if(ret != SUCCEED)
HGOTO_ERROR_FF(FAIL, "failed to read from array object");
@@ -828,7 +833,7 @@ H5VL_iod_server_dset_get_vl_size_cb(AXE_engine_t UNUSED axe_engine,
buf_size = nelmts * 8;//sizeof(size_t);
/* read the array values containing the BLOB IDs and lengths */
- ret = H5VL__iod_server_final_io(iod_oh.rd_oh, space_id, elmt_size, FALSE,
+ ret = H5VL__iod_server_final_io(coh, iod_oh.rd_oh, space_id, elmt_size, FALSE,
buf, buf_size, (uint64_t)0, cs_scope, rtid);
if(ret != SUCCEED)
HGOTO_ERROR_FF(ret, "can't read from array object");
@@ -1195,7 +1200,7 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine,
HGOTO_ERROR_FF(FAIL, "data type conversion failed")
elmt_size = H5Tget_size(dst_id);
- ret = H5VL__iod_server_final_io(iod_oh.wr_oh, space_id, elmt_size, TRUE,
+ ret = H5VL__iod_server_final_io(coh, iod_oh.wr_oh, space_id, elmt_size, TRUE,
buf, buf_size, cs, raw_cs_scope, wtid);
/* free the block handle */
@@ -1421,8 +1426,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size,
- hbool_t write_op, void *buf,
+H5VL__iod_server_final_io(iod_handle_t coh, iod_handle_t iod_oh, hid_t space_id,
+ size_t elmt_size, hbool_t write_op, void *buf,
size_t UNUSED buf_size, iod_checksum_t UNUSED cs,
uint32_t cs_scope, iod_trans_id_t tid)
{
@@ -1432,6 +1437,8 @@ H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size,
iod_array_iodesc_t *file_desc; /* file descriptor used to do IO */
iod_hyperslab_t *hslabs = NULL; /* IOD hyperslab generated from HDF5 filespace */
iod_checksum_t *cs_list = NULL;
+ iod_ret_t *ret_list = NULL;
+ iod_array_io_t *array_io = NULL;
uint8_t *buf_ptr = NULL;
iod_ret_t ret;
herr_t ret_value = SUCCEED;
@@ -1481,6 +1488,71 @@ H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size,
HGOTO_ERROR_FF(FAIL, "unable to generate IOD file descriptor from dataspace selection");
}
+
+
+ if(NULL == (array_io = (iod_array_io_t *)calloc
+ (sizeof(iod_array_io_t), (size_t)num_descriptors)))
+ HGOTO_ERROR_FF(FAIL, "can't allocate list array");
+ if(NULL == (ret_list = (iod_ret_t *)calloc
+ (sizeof(iod_ret_t), (size_t)num_descriptors)))
+ HGOTO_ERROR_FF(FAIL, "can't allocate return array");
+ if(cs_scope & H5_CHECKSUM_IOD) {
+ /* allocate cs array */
+ if(NULL == (cs_list = (iod_checksum_t *)calloc
+ (sizeof(iod_checksum_t), (size_t)num_descriptors)))
+ HGOTO_ERROR_FF(FAIL, "can't allocate checksum array");
+ }
+
+ buf_ptr = (uint8_t *)buf;
+ for(n=0 ; n<num_descriptors ; n++) {
+ hsize_t num_bytes = 0;
+ hsize_t num_elems = 1;
+
+ mem_desc = malloc(offsetof(iod_mem_desc_t, frag[1]));
+
+ /* determine how many bytes the current descriptor holds */
+ for(i=0 ; i<ndims ; i++) {
+ num_elems *= (hslabs[n].count[i] * hslabs[n].block[i]);
+ }
+ num_bytes = num_elems * elmt_size;
+
+ mem_desc->nfrag = 1;
+ mem_desc->frag[0].addr = (void *)buf_ptr;
+ mem_desc->frag[0].len = (iod_size_t)num_bytes;
+
+ if(write_op && (cs_scope & H5_CHECKSUM_IOD))
+ cs_list[n] = H5_checksum_crc64(buf_ptr, (size_t)num_bytes);
+
+ array_io[n].oh = iod_oh;
+ array_io[n].hints = NULL;
+ array_io[n].mem_desc = mem_desc;
+ array_io[n].io_desc = &hslabs[n];
+ if(cs_scope & H5_CHECKSUM_IOD)
+ array_io[n].cs = &cs_list[n];
+ else
+ array_io[n].cs = NULL;
+ array_io[n].ret = &ret_list[n];
+
+ buf_ptr += num_bytes;
+ }
+
+ if(write_op) {
+ /* write to array */
+ ret = iod_array_write_list(coh, tid, num_descriptors, array_io, NULL);
+ if(ret < 0)
+ HGOTO_ERROR_FF(ret, "can't write to array object");
+ }
+ else {
+ /* Read from array */
+ ret = iod_array_read_list(coh, tid, num_descriptors, array_io, NULL);
+ if(ret < 0)
+ HGOTO_ERROR_FF(ret, "can't read from array object");
+ }
+
+
+
+#if 0
+
file_desc = (iod_array_iodesc_t *)hslabs;
buf_ptr = (uint8_t *)buf;
@@ -1537,6 +1609,7 @@ H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size,
if(ret < 0)
HGOTO_ERROR_FF(ret, "can't read from array object");
}
+#endif
/* If this is a read operation, compute checksum for each IOD
read, and compare it against checksum returned from IOD */
@@ -1571,6 +1644,12 @@ done:
/* free allocated descriptors */
for(n=0 ; n<num_descriptors ; n++) {
+ if(ret_list[n] != 0)
+ HDONE_ERROR_FF(FAIL, "I/O Failed");
+
+ free(array_io[n].mem_desc);
+ array_io[n].mem_desc = NULL;
+
free(hslabs[n].start);
hslabs[n].start = NULL;
free(hslabs[n].stride);
@@ -1588,11 +1667,17 @@ done:
free(cs_list);
cs_list = NULL;
}
+ if(ret_list) {
+ free(ret_list);
+ ret_list = NULL;
+ }
+
+#if 0
if(mem_desc) {
free(mem_desc);
mem_desc = NULL;
}
-
+#endif
return ret_value;
} /* end H5VL_iod_server_final_io() */
diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h
index c38cc1f..ac50b33 100644
--- a/src/H5VLiod_server.h
+++ b/src/H5VLiod_server.h
@@ -417,7 +417,7 @@ H5_DLL herr_t H5VL__iod_server_type_is_vl(hid_t type_id, hbool_t *is_vl_data);
H5_DLL herr_t H5VL_iod_verify_scratch_pad(scratch_pad *sp, iod_checksum_t iod_cs);
H5_DLL herr_t H5VL_iod_verify_kv_pair(void *key, iod_size_t key_size, void *value, iod_size_t val_size,
iod_checksum_t *iod_cs);
-H5_DLL herr_t H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size,
+H5_DLL herr_t H5VL__iod_server_final_io(iod_handle_t coh, iod_handle_t iod_oh, hid_t space_id, size_t elmt_size,
hbool_t write_op, void *buf, size_t buf_size,
iod_checksum_t cs, uint32_t cs_scope, iod_trans_id_t tid);
diff --git a/src/H5VLiod_util.c b/src/H5VLiod_util.c
index cc18f21..b6bfb4c 100644
--- a/src/H5VLiod_util.c
+++ b/src/H5VLiod_util.c
@@ -391,7 +391,7 @@ H5VL_iod_get_file_desc(hid_t space_id, hssize_t *count, iod_hyperslab_t *hslabs)
/* if the selection is a regular hyperslab
selection, only 1 iod hyperslab object is
needed */
- if(H5Sselect_is_regular(space_id)) {
+ if(TRUE == H5Sselect_is_regular(space_id)) {
num_descriptors = 1;
if(NULL != hslabs) {
@@ -414,28 +414,27 @@ H5VL_iod_get_file_desc(hid_t space_id, hssize_t *count, iod_hyperslab_t *hslabs)
if(NULL != hslabs) {
hsize_t *blocks = NULL;
size_t block_count = 0;
+ hsize_t *cur_ptr;
block_count = (unsigned int)ndims * (hsize_t)num_descriptors * sizeof(hsize_t) * 2;
if(NULL == (blocks = (hsize_t *)malloc(block_count)))
HGOTO_ERROR_FF(FAIL, "can't allocate array for points coords");
- fprintf(stderr, "block count = %zu\n", block_count);
-
if(H5Sget_select_hyper_blocklist(space_id, (hsize_t)0,
(hsize_t)num_descriptors, blocks) < 0)
HGOTO_ERROR_FF(FAIL, "Failed to retrieve point coordinates");
+
+ cur_ptr = blocks; /* temp pointer into blocks array */
/* populate the hyperslab */
for(n=0 ; n<num_descriptors ; n++) {
- hsize_t *cur_ptr = blocks; /* temp pointer into blocks array */
-
/* adjust the current pointer to the current block */
cur_ptr += n*ndims*2;
for(i=0 ; i<ndims ; i++) {
hslabs[n].start[i] = *(cur_ptr+i);
hslabs[n].count[i] = 1;
- hslabs[n].block[i] = *(cur_ptr+ndims+i) - hslabs[n].start[i];
+ hslabs[n].block[i] = *(cur_ptr+ndims+i) - hslabs[n].start[i] + 1;
hslabs[n].stride[i] = hslabs[n].block[i];
}
}
diff --git a/src/H5VLiod_view.c b/src/H5VLiod_view.c
index 07b338b..294c8f5 100644
--- a/src/H5VLiod_view.c
+++ b/src/H5VLiod_view.c
@@ -565,8 +565,7 @@ H5VL__iod_apply_query(hid_t file_id, hid_t rcxt_id, hid_t qid, hid_t vcpl_id,
*result = result1 + result2;
if(sid1!=FAIL && sid2!=FAIL) {
- /* MSC - AND the selections when API is available */
- if(FAIL == (*region = H5Scopy(sid1)))
+ if(FAIL == (*region = H5Scombine_select(sid1, H5S_SELECT_AND, sid2)))
HGOTO_ERROR_FF(ret, "Unable to AND 2 dataspace selections");
}
@@ -581,9 +580,8 @@ H5VL__iod_apply_query(hid_t file_id, hid_t rcxt_id, hid_t qid, hid_t vcpl_id,
*result = result1 + result2 + 1;
if(sid1!=FAIL && sid2!=FAIL) {
- /* MSC - OR the selections when API is available */
-
- *region = H5Scopy(sid2);
+ if(FAIL == (*region = H5Scombine_select(sid1, H5S_SELECT_OR, sid2)))
+ HGOTO_ERROR_FF(ret, "Unable to AND 2 dataspace selections");
}
else if(sid1!=FAIL)
*region = H5Scopy(sid1);
@@ -969,7 +967,7 @@ H5VL__iod_get_elmt_region(iod_handle_t coh, iod_obj_id_t dset_id, iod_trans_id_t
HGOTO_ERROR_FF(FAIL, "can't allocate read buffer");
/* read the data selection from IOD. */
- if(H5VL__iod_server_final_io(dset_oh, space_id, elmt_size, FALSE,
+ if(H5VL__iod_server_final_io(coh, dset_oh, space_id, elmt_size, FALSE,
buf, buf_size, (uint64_t)0, 0, rtid) < 0)
HGOTO_ERROR_FF(FAIL, "can't read from array object");
@@ -1032,7 +1030,10 @@ H5VL__iod_get_query_data_cb(void *elem, hid_t type_id, unsigned ndim,
if (result) {
hsize_t count[H5S_MAX_RANK], i;
#if 0
- fprintf(stderr, "(%d) Element |%d| matches query\n", my_rank_g, *((int *) elem));
+ fprintf(stderr, "(%d) Element [", my_rank_g);
+ for(i=0; i<ndim; i++)
+ fprintf(stderr, "%zu, ",point[i]);
+ fprintf(stderr, "] Matches Query. Value = %d\n", *((int *) elem));
#endif
udata->num_elmts ++;