diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-03-17 04:24:23 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-03-17 04:24:23 (GMT) |
commit | c935bf8ab465d7934d1a0f626674a80b714f1692 (patch) | |
tree | 3fec24001f747874f1fd1fce1144ec2bc192810d | |
parent | 40d77a12306e98ce6a783414b971a383dcfb2475 (diff) | |
download | hdf5-c935bf8ab465d7934d1a0f626674a80b714f1692.zip hdf5-c935bf8ab465d7934d1a0f626674a80b714f1692.tar.gz hdf5-c935bf8ab465d7934d1a0f626674a80b714f1692.tar.bz2 |
[svn-r29461] - add function H5Oget_addr_ff to retrieve IOD id.
- test new function and H5Oopen_by_addr_ff
-rw-r--r-- | examples/h5ff_client_obj.c | 31 | ||||
-rw-r--r-- | src/H5FF_obj.c | 99 | ||||
-rw-r--r-- | src/H5FFpublic.h | 1 |
3 files changed, 127 insertions, 4 deletions
diff --git a/examples/h5ff_client_obj.c b/examples/h5ff_client_obj.c index 95dd6f6..522ec2a 100644 --- a/examples/h5ff_client_obj.c +++ b/examples/h5ff_client_obj.c @@ -34,11 +34,13 @@ int main(int argc, char **argv) { char file_name[50];
hid_t file_id;
hid_t gid;
- hid_t did, map;
+ hid_t did, did31, map;
hid_t sid, dtid;
hid_t tid1, tid2, rid1, rid2;
hid_t fapl_id, dxpl_id;
hid_t e_stack;
+ H5O_ff_info_t oinfo;
+ haddr_ff_t dset_addr;
htri_t exists = -1;
const unsigned int nelem=60;
@@ -110,7 +112,7 @@ int main(int argc, char **argv) { if(0 == my_rank) {
hid_t rid_temp;
hid_t anon_did;
- hid_t gid2,gid3,gid11,did11,did21,did31,map111;
+ hid_t gid2,gid3,gid11,did11,did21,map111;
version = 1;
rid1 = H5RCacquire(file_id, &version, H5P_DEFAULT, H5_EVENT_STACK_NULL);
assert(1 == version);
@@ -143,8 +145,13 @@ int main(int argc, char **argv) { H5P_DEFAULT, tid1, e_stack);
assert(did21 >= 0);
did31 = H5Dcreate_ff(gid3, "D3", dtid, sid, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT, tid1, e_stack);
+ H5P_DEFAULT, tid1, H5_EVENT_STACK_NULL);
assert(did31 >= 0);
+ ret = H5Oget_addr_ff(did31, &dset_addr);
+ assert(0 == ret);
+ fprintf(stderr,
+ "DATASET %s addr: %"PRIx64"\n", "D3", dset_addr);
+
map111 = H5Mcreate_ff(gid11, "MAP1", H5T_STD_I32LE, H5T_STD_I32LE,
H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT, tid1, e_stack);
assert(map111 >= 0);
@@ -237,6 +244,9 @@ int main(int argc, char **argv) { MPI_Bcast(&version, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD);
assert(3 == version);
+ /* Process 0 bcasts dset31 address to others */
+ MPI_Bcast(&dset_addr, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD);
+
/* other processes just create a read context object; no need to
acquire it */
if(0 != my_rank) {
@@ -244,6 +254,20 @@ int main(int argc, char **argv) { assert(rid2 > 0);
}
+ fprintf(stderr, "H5Open_by_addr_ff OID: %"PRIx64"\n", dset_addr);
+ did31 = H5Oopen_by_addr_ff(file_id, dset_addr, rid2);
+ assert(did31 >= 0);
+
+ {
+ hid_t sid_temp;
+
+ sid_temp = H5Dget_space(did31);
+ assert(H5Sget_simple_extent_npoints(sid) == H5Sget_simple_extent_npoints(sid_temp));
+ H5Sclose(sid_temp);
+ }
+
+ assert(H5Dclose_ff(did31, e_stack) == 0);
+
gid = H5Oopen_ff(file_id, "G1", H5P_DEFAULT, rid2);
assert(gid);
dtid = H5Oopen_ff(file_id, "DT1", H5P_DEFAULT, rid2);
@@ -256,7 +280,6 @@ int main(int argc, char **argv) { {
ssize_t ret_size = 0;
char *comment = NULL;
- H5O_ff_info_t oinfo;
ret = H5Oget_comment_ff(gid, NULL, 0, &ret_size, rid2, H5_EVENT_STACK_NULL);
assert(ret == 0);
diff --git a/src/H5FF_obj.c b/src/H5FF_obj.c index bb0c17d..882f7aa 100644 --- a/src/H5FF_obj.c +++ b/src/H5FF_obj.c @@ -167,6 +167,105 @@ done: } /* end H5Oopen_by_addr_ff() */ /*------------------------------------------------------------------------- + * Function: H5Oget_addr_ff + * + * Purpose: Retrieves the IOD id that has been allocated to a dataset. + * + * Return: Success: Non-negative with the link value in BUF. + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March 2016 + * + *------------------------------------------------------------------------- + */ +herr_t H5Oget_addr_ff(hid_t object_id, haddr_ff_t *addr) +{ + H5VL_object_t *obj = NULL; /* object token of loc_id */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + switch(H5I_get_type(object_id)) { + case H5I_GROUP: + { + H5VL_iod_group_t *vol_obj = NULL; + + if(NULL == (obj = (H5VL_object_t *)H5I_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid object ID"); + + vol_obj = (H5VL_iod_group_t *)obj->vol_obj; + + *addr = vol_obj->remote_group.iod_id; + break; + } + case H5I_DATASET: + { + H5VL_iod_dset_t *vol_obj = NULL; + + if(NULL == (obj = (H5VL_object_t *)H5I_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid object ID"); + + vol_obj = (H5VL_iod_dset_t *)obj->vol_obj; + + *addr = vol_obj->remote_dset.iod_id; + break; + } + case H5I_MAP: + { + H5VL_iod_map_t *vol_obj = NULL; + + if(NULL == (obj = (H5VL_object_t *)H5I_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid object ID"); + + vol_obj = (H5VL_iod_map_t *)obj->vol_obj; + + *addr = vol_obj->remote_map.iod_id; + break; + } + case H5I_DATATYPE: + { + H5T_t *dt = NULL; + + if(NULL == (dt = (H5T_t *)H5I_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid datatype ID"); + + if (NULL != dt->vol_obj) { + H5VL_iod_dtype_t *vol_obj = (H5VL_iod_dtype_t *)dt->vol_obj; + + *addr = vol_obj->remote_dtype.iod_id; + } + break; + } + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_VOL: + case H5I_ES: + case H5I_RC: + case H5I_TR: + case H5I_QUERY: + case H5I_VIEW: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)") + break; + } /* end switch */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_addr_ff() */ + +/*------------------------------------------------------------------------- * Function: H5Oget_token * * Purpose: This function retrieves a token representing an object in diff --git a/src/H5FFpublic.h b/src/H5FFpublic.h index adc372e..f7b1891 100644 --- a/src/H5FFpublic.h +++ b/src/H5FFpublic.h @@ -208,6 +208,7 @@ H5_DLL herr_t H5Oget_info_ff(hid_t object_id, H5O_ff_info_t *object_info, H5_DLL herr_t H5Oget_info_by_name_ff(hid_t loc_id, const char *object_name, H5O_ff_info_t *object_info, hid_t lapl_id, hid_t rcxt_id, hid_t estack_id); +H5_DLL herr_t H5Oget_addr_ff(hid_t object_id, haddr_ff_t *addr); H5_DLL herr_t H5Ovisit_ff(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_ff_t op, void *op_data, hid_t rcxt_id, hid_t estack_id); H5_DLL herr_t H5Ovisit_by_name_ff(hid_t loc_id, const char *obj_name, |