summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-03-05 16:10:55 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-03-05 16:10:55 (GMT)
commit57e225053cfceeb006424bb02aab2bed3894b3a9 (patch)
treefaf5b24e362f79ade916307d8ae9c6e537a8d45b
parent1b6f1e9018940d819d011182daa9f5bca7932921 (diff)
downloadhdf5-57e225053cfceeb006424bb02aab2bed3894b3a9.zip
hdf5-57e225053cfceeb006424bb02aab2bed3894b3a9.tar.gz
hdf5-57e225053cfceeb006424bb02aab2bed3894b3a9.tar.bz2
[svn-r24761] Add H5Dcreate_anon_ff implementation.
-rw-r--r--examples/h5ff_client_dset.c3
-rw-r--r--examples/h5ff_client_links.c4
-rw-r--r--examples/h5ff_client_obj.c11
-rw-r--r--src/H5FF.c90
-rw-r--r--src/H5FFpublic.h2
-rw-r--r--src/H5VLiod.c10
-rw-r--r--src/H5VLiod_dset.c42
7 files changed, 143 insertions, 19 deletions
diff --git a/examples/h5ff_client_dset.c b/examples/h5ff_client_dset.c
index 207ab90..694e14a 100644
--- a/examples/h5ff_client_dset.c
+++ b/examples/h5ff_client_dset.c
@@ -205,6 +205,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ assert(status == H5ES_STATUS_SUCCEED);
/* bcast the token sizes and the tokens */
MPI_Ibcast(&token_size1, sizeof(size_t), MPI_BYTE, 0, MPI_COMM_WORLD, &mpi_reqs[0]);
@@ -294,6 +295,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ assert(status == H5ES_STATUS_SUCCEED);
}
/* Barrier to make sure all processes are done writing so Process
@@ -324,6 +326,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
printf("%d events in event stack. H5ESwait_all Completion status = %d\n", num_events, status);
H5ESclear(e_stack);
+ assert(status == H5ES_STATUS_SUCCEED);
/* Tell other procs that container version 1 is acquired */
version = 1;
diff --git a/examples/h5ff_client_links.c b/examples/h5ff_client_links.c
index 45f7d5a..a643cda 100644
--- a/examples/h5ff_client_links.c
+++ b/examples/h5ff_client_links.c
@@ -123,6 +123,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ assert(status == H5ES_STATUS_SUCCEED);
/* Close transaction object. Local op */
ret = H5TRclose(tid1);
@@ -180,6 +181,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ assert(status == H5ES_STATUS_SUCCEED);
/* Close transaction object. Local op */
ret = H5TRclose(tid2);
@@ -204,6 +206,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ assert(status == H5ES_STATUS_SUCCEED);
/* Leader tells other procs that container version 2 is acquired */
MPI_Bcast(&version, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD);
@@ -285,6 +288,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ assert(status == H5ES_STATUS_SUCCEED);
assert(0 == ret);
diff --git a/examples/h5ff_client_obj.c b/examples/h5ff_client_obj.c
index e902f4f..9051751 100644
--- a/examples/h5ff_client_obj.c
+++ b/examples/h5ff_client_obj.c
@@ -93,6 +93,7 @@ int main(int argc, char **argv) {
started. */
if(0 == my_rank) {
hid_t rid_temp;
+ hid_t anon_did;
/* create transaction object */
tid1 = H5TRcreate(file_id, rid1, (uint64_t)1);
@@ -117,6 +118,13 @@ int main(int argc, char **argv) {
H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT, tid1, e_stack);
assert(map >= 0);
+ anon_did = H5Dcreate_anon_ff(file_id, dtid, sid, H5P_DEFAULT, H5P_DEFAULT,
+ tid1, e_stack);
+ assert(anon_did > 0);
+
+ ret = H5Dclose_ff(anon_did, e_stack);
+ assert(0 == ret);
+
ret = H5TRfinish(tid1, H5P_DEFAULT, &rid_temp, e_stack);
assert(0 == ret);
@@ -125,6 +133,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ assert(status == H5ES_STATUS_SUCCEED);
/* Close transaction object. Local op */
ret = H5TRclose(tid1);
@@ -165,6 +174,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ assert(status == H5ES_STATUS_SUCCEED);
if(0 == my_rank) {
/* Close transaction object. Local op */
@@ -269,6 +279,7 @@ int main(int argc, char **argv) {
H5ESwait_all(e_stack, &status);
H5ESclear(e_stack);
printf("%d events in event stack. Completion status = %d\n", num_events, status);
+ assert(status == H5ES_STATUS_SUCCEED);
/* closing the container also acts as a wait all on all pending requests
on the container. */
diff --git a/src/H5FF.c b/src/H5FF.c
index a4a99e8..e86dd27 100644
--- a/src/H5FF.c
+++ b/src/H5FF.c
@@ -624,6 +624,94 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Dcreate_anon_ff
+ *
+ * Purpose: Asynchronous wrapper around H5Dcreate_anon().
+ *
+ * Return: Success: The placeholder ID for a new dataset. When
+ * the asynchronous operation completes, this
+ * ID will transparently be modified to be a
+ * "normal" ID.
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, March 20, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Dcreate_anon_ff(hid_t file_id, hid_t type_id, hid_t space_id,
+ hid_t dcpl_id, hid_t dapl_id, hid_t trans_id, hid_t estack_id)
+{
+ void *dset = NULL; /* dset token from VOL plugin */
+ void *obj = NULL; /* object token of file_id */
+ H5VL_t *vol_plugin; /* VOL plugin information */
+ hid_t dxpl_id = H5P_DATASET_XFER_DEFAULT; /* transfer property list to pass to the VOL plugin */
+ H5VL_loc_params_t loc_params;
+ H5P_genplist_t *plist; /* Property list pointer */
+ hid_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+
+ /* Get correct property list */
+ if(H5P_DEFAULT == dcpl_id)
+ dcpl_id = H5P_DATASET_CREATE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID")
+
+ /* Get correct property list */
+ if(H5P_DEFAULT == dapl_id)
+ dapl_id = H5P_DATASET_ACCESS_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list")
+
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* set creation properties */
+ if(H5P_set(plist, H5VL_DSET_TYPE_ID, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for datatype id")
+ if(H5P_set(plist, H5VL_DSET_SPACE_ID, &space_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for space id")
+
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(file_id);
+
+ /* store the transaction ID in the dxpl */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ if(H5P_set(plist, H5VL_TRANS_ID, &trans_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for trans_id")
+
+ /* get the file object */
+ if(NULL == (obj = (void *)H5VL_get_object(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* get the plugin pointer */
+ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
+
+ /* Create the dataset through the VOL */
+ if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin, NULL, dcpl_id, dapl_id,
+ dxpl_id, estack_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
+
+ /* Get an atom for the dataset */
+ if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle")
+
+done:
+ if (ret_value < 0 && dset)
+ if(H5VL_dataset_close(dset, vol_plugin, H5AC_dxpl_id, estack_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Dcreate_anon_ff() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Dopen_ff
*
* Purpose: Asynchronous wrapper around H5Dopen().
@@ -680,7 +768,7 @@ H5Dopen_ff(hid_t loc_id, const char *name, hid_t dapl_id, hid_t rcxt_id, hid_t e
if(H5P_set(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for rcxt_id")
- /* Create the dataset through the VOL */
+ /* Open the dataset through the VOL */
if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin, name,
dapl_id, dxpl_id, estack_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to open dataset")
diff --git a/src/H5FFpublic.h b/src/H5FFpublic.h
index 49ce425..c77e219 100644
--- a/src/H5FFpublic.h
+++ b/src/H5FFpublic.h
@@ -89,6 +89,8 @@ H5_DLL herr_t H5Gclose_ff(hid_t group_id, hid_t estack_id);
H5_DLL hid_t H5Dcreate_ff(hid_t loc_id, const char *name, hid_t type_id,
hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id,
hid_t trans_id, hid_t estack_id);
+H5_DLL hid_t H5Dcreate_anon_ff(hid_t file_id, hid_t type_id, hid_t space_id,
+ hid_t plist_id, hid_t dapl_id, hid_t trans_id, hid_t estack_id);
H5_DLL hid_t H5Dopen_ff(hid_t loc_id, const char *name, hid_t dapl_id,
hid_t rcxt_id, hid_t estack_id);
H5_DLL herr_t H5Dwrite_ff(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
diff --git a/src/H5VLiod.c b/src/H5VLiod.c
index 1067d1c..1d1cb8e 100644
--- a/src/H5VLiod.c
+++ b/src/H5VLiod.c
@@ -2912,7 +2912,7 @@ H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t UNUSED loc_params,
/* setup the local dataset struct */
/* store the entire path of the dataset locally */
- if(obj->obj_name) {
+ if(name && obj->obj_name) {
size_t obj_name_len = HDstrlen(obj->obj_name);
size_t name_len = HDstrlen(name);
@@ -2939,8 +2939,12 @@ H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t UNUSED loc_params,
dset->common.file->nopen_objs ++;
#if H5VL_IOD_DEBUG
- printf("Dataset Create %s IOD ID %"PRIu64", axe id %"PRIu64"\n",
- name, input.dset_id, g_axe_id);
+ if(name)
+ printf("Dataset Create %s IOD ID %"PRIu64", axe id %"PRIu64"\n",
+ name, input.dset_id, g_axe_id);
+ else
+ printf("Anon Dataset Create IOD ID %"PRIu64", axe id %"PRIu64"\n",
+ input.dset_id, g_axe_id);
#endif
if(H5VL__iod_create_and_forward(H5VL_DSET_CREATE_ID, HG_DSET_CREATE,
diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c
index 6b6205d..c778562 100644
--- a/src/H5VLiod_dset.c
+++ b/src/H5VLiod_dset.c
@@ -133,7 +133,7 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
iod_handle_t mdkv_oh;
iod_obj_id_t cur_id;
const char *name = input->name; /* name of dset including path to create */
- char *last_comp; /* the name of the dataset obtained from the last component in the path */
+ char *last_comp = NULL; /* the name of the dataset obtained from the last component in the path */
iod_array_struct_t array; /* IOD array struct describing the dataset's dimensions */
scratch_pad sp;
iod_ret_t ret = 0;
@@ -147,7 +147,10 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
FUNC_ENTER_NOAPI_NOINIT
#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start dataset create %s at %"PRIu64"\n", name, loc_handle.wr_oh.cookie);
+ if(name)
+ fprintf(stderr, "Start dataset create %s at %"PRIu64"\n", name, loc_handle.wr_oh.cookie);
+ else
+ fprintf(stderr, "Start anon dataset create at %"PRIu64"\n", loc_handle.wr_oh.cookie);
#endif
if(H5P_DEFAULT == input->dcpl_id)
@@ -158,12 +161,20 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
if(H5Pget_ocpl_enable_checksum(dcpl_id, &enable_checksum) < 0)
HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks");
- /* the traversal will retrieve the location where the dataset needs
- to be created. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE,
- cs_scope, &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+ if(name) {
+ /* the traversal will retrieve the location where the dataset needs
+ to be created. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE,
+ cs_scope, &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+ }
+ else {
+ /* this is an anon dataset.. no link information */
+ cur_oh.rd_oh.cookie = loc_handle.rd_oh.cookie;
+ cur_oh.wr_oh.cookie = loc_handle.wr_oh.cookie;
+ cur_id = loc_id;
+ }
#if H5VL_IOD_DEBUG
fprintf(stderr, "Creating Dataset ID %"PRIx64" ",dset_id);
@@ -216,8 +227,8 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
array.chunk_dims = NULL;
#if H5VL_IOD_DEBUG
- fprintf(stderr, "now creating the dataset %s cellsize %d num dimensions %d\n",
- last_comp, array.cell_size, array.num_dims);
+ fprintf(stderr, "now creating the dataset with cellsize %d num dimensions %d\n",
+ array.cell_size, array.num_dims);
#endif
/* create the dataset */
@@ -303,11 +314,12 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
step --;
- /* add link in parent group to current object */
- if(H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp,
- H5L_TYPE_HARD, &dset_id, cs_scope, NULL, NULL) < 0)
- HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
-
+ /* If dataset is not anonymous, add link in parent group to current object */
+ if(name) {
+ if(H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp,
+ H5L_TYPE_HARD, &dset_id, cs_scope, NULL, NULL) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+ }
output.iod_oh.rd_oh.cookie = dset_oh.rd_oh.cookie;
output.iod_oh.wr_oh.cookie = dset_oh.wr_oh.cookie;