summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-06-18 21:34:28 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-06-18 21:34:28 (GMT)
commit730ca41e9a48de89679391301c4a28cdf4bd1c43 (patch)
treecdc66c1957f1f1cb67794c21bc2f8bcc3762bfa7
parent4edeaf0c13c0bfee62c68b0c547719badb17a909 (diff)
downloadhdf5-730ca41e9a48de89679391301c4a28cdf4bd1c43.zip
hdf5-730ca41e9a48de89679391301c4a28cdf4bd1c43.tar.gz
hdf5-730ca41e9a48de89679391301c4a28cdf4bd1c43.tar.bz2
[svn-r25325] - fix bugs in analysis shipping
- move ship_analysis to after fclose in example
-rw-r--r--examples/h5ff_client_adv_analysis.c17
-rw-r--r--src/H5VLiod_analysis.c24
2 files changed, 25 insertions, 16 deletions
diff --git a/examples/h5ff_client_adv_analysis.c b/examples/h5ff_client_adv_analysis.c
index 8e7edca..05bc09d 100644
--- a/examples/h5ff_client_adv_analysis.c
+++ b/examples/h5ff_client_adv_analysis.c
@@ -153,8 +153,8 @@ init_data(size_t ntuples, struct analysis_data *data)
data->temperature = (double *) malloc(sizeof(double) * ncomponents * ntuples);
for (i = 0; i < ntuples; i++) {
for (j = 0; j < ncomponents; j++) {
- data->temperature[ncomponents * i + j] =
- (double) (((hsize_t) my_rank) * ntuples + i);
+ data->temperature[ncomponents * i + j] = i;
+ //(double) (((hsize_t) my_rank) * ntuples + i);
}
}
}
@@ -334,20 +334,19 @@ main(int argc, char **argv)
MPI_Barrier(MPI_COMM_WORLD);
free_data(&data);
-
- if(0 == my_rank) {
- ship_analysis(file_name);
- }
-
- MPI_Barrier(MPI_COMM_WORLD);
-
ret = H5ESclose(estack_id);
assert(ret == 0);
/* Close the file. */
ret = H5Fclose_ff(file_id, 1, H5_EVENT_STACK_NULL);
assert(0 == ret);
+ MPI_Barrier(MPI_COMM_WORLD);
+ if(0 == my_rank) {
+ ship_analysis(file_name);
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD);
EFF_finalize();
MPI_Finalize();
diff --git a/src/H5VLiod_analysis.c b/src/H5VLiod_analysis.c
index 35666a3..62a919b 100644
--- a/src/H5VLiod_analysis.c
+++ b/src/H5VLiod_analysis.c
@@ -905,24 +905,24 @@ H5VL__iod_farm_work(iod_obj_map_t *obj_map, iod_handle_t *cohs,
size_t *split_num_elmts;
hid_t split_type_id = FAIL;
hg_request_t *hg_reqs = NULL;
- uint32_t u, i;
+ uint32_t u, i, processed = 0;
unsigned int num_targets = num_ions_g;//obj_map->u_map.array_map.n_range;
coords_t coords;
analysis_farm_in_t farm_input;
analysis_farm_out_t *farm_output = NULL;
/* function shipper requests */
- if(NULL == (hg_reqs = (hg_request_t *) malloc(sizeof(hg_request_t) * num_targets)))
+ if(NULL == (hg_reqs = (hg_request_t *)calloc(num_targets, sizeof(hg_request_t))))
HGOTO_ERROR_FF(FAIL, "can't allocate HG requests");
- if(NULL == (farm_output = (analysis_farm_out_t *) malloc
- (sizeof(analysis_farm_out_t) * num_targets)))
+ if(NULL == (farm_output = (analysis_farm_out_t *)calloc
+ (num_targets, sizeof(analysis_farm_out_t))))
HGOTO_ERROR_FF(FAIL, "can't allocate HG requests");
- if(NULL == (split_data = (void **) malloc(sizeof(void *) * num_targets)))
+ if(NULL == (split_data = (void **)calloc(num_targets, sizeof(void *))))
HGOTO_ERROR_FF(FAIL, "can't allocate array for split data");
- if(NULL == (split_num_elmts = (size_t *) malloc(sizeof(size_t) * num_targets)))
+ if(NULL == (split_num_elmts = (size_t *)calloc(num_targets, sizeof(size_t))))
HGOTO_ERROR_FF(FAIL, "can't allocate array for num elmts");
farm_input.obj_id = obj_map->oid;
@@ -935,9 +935,13 @@ H5VL__iod_farm_work(iod_obj_map_t *obj_map, iod_handle_t *cohs,
#if 1
/* Farm work to the IONs and combine the result */
for(i=0 ; i<num_ions_g ; i++) {
- hid_t space_id;
+ hid_t space_id = FAIL;
hbool_t first_space = TRUE;
+ /* no more ranges to process */
+ if(obj_map->u_map.array_map.n_range == processed)
+ break;
+
/* 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;
@@ -964,9 +968,15 @@ H5VL__iod_farm_work(iod_obj_map_t *obj_map, iod_handle_t *cohs,
if(H5Sclose(space_layout) < 0)
HGOTO_ERROR_FF(FAIL, "cannot close region");
+
+ processed ++;
}
}
+ /* no data is local to this ION */
+ if(space_id == FAIL)
+ continue;
+
if(H5Smodify_select(space_id, H5S_SELECT_AND, region) < 0)
HGOTO_ERROR_FF(FAIL, "Unable to AND 2 dataspace selections");