From cf07aa6803a70f52f6a178219097e9f9e6ee1a51 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Sun, 21 Jun 2015 16:45:01 -0500 Subject: [svn-r27261] apply metadata enhancement patch that was based on the mdc 3 branch. --- src/H5A.c | 178 +++++---- src/H5AC.c | 76 +++- src/H5ACprivate.h | 3 + src/H5C.c | 975 ++++++++++++++++++++++++++++++++++++++++++++++---- src/H5Cpkg.h | 269 +++++++++++++- src/H5Cprivate.h | 6 + src/H5D.c | 41 +-- src/H5Dchunk.c | 22 ++ src/H5Ddeprec.c | 3 +- src/H5F.c | 30 +- src/H5FDmpio.c | 81 ++--- src/H5Fint.c | 8 + src/H5Fmpi.c | 29 ++ src/H5Fpkg.h | 3 + src/H5Fprivate.h | 1 + src/H5G.c | 67 ++-- src/H5L.c | 164 +++++---- src/H5Lexternal.c | 7 +- src/H5O.c | 95 ++--- src/H5Pdxpl.c | 14 + src/H5Pencdec.c | 2 +- src/H5Pfapl.c | 177 +++++++++ src/H5Pint.c | 72 +++- src/H5Plapl.c | 16 +- src/H5Ppkg.h | 2 + src/H5Pprivate.h | 11 + src/H5Ppublic.h | 8 + src/H5Tcommit.c | 35 +- src/Makefile.in | 2 +- testpar/t_cache.c | 311 +++++++++++++++- testpar/t_mdset.c | 1 + testpar/t_shapesame.c | 2 + testpar/testphdf5.c | 2 + 33 files changed, 2304 insertions(+), 409 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 4afdefe..888993b 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -229,12 +229,13 @@ H5A_term_interface(void) /* ARGSUSED */ hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, - hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id) + hid_t acpl_id, hid_t aapl_id) { H5A_t *attr = NULL; /* Attribute created */ H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -254,8 +255,13 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") - /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Go do the real work for attaching the attribute to the object */ + if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -304,7 +310,7 @@ done: /* ARGSUSED */ hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, - hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, + hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -315,6 +321,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ + hid_t dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -342,13 +349,25 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, obj_loc.path = &obj_path; H5G_loc_reset(&obj_loc); + dxpl_id = H5AC_ind_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -385,10 +404,11 @@ done: H5Aclose or resource leaks will develop. --------------------------------------------------------------------------*/ hid_t -H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) +H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -402,8 +422,13 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Read in attribute from object header */ - if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name) /* Finish initializing attribute */ @@ -447,10 +472,11 @@ done: --------------------------------------------------------------------------*/ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, - hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id) + hid_t aapl_id, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -471,8 +497,13 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Register the attribute and get an ID for it */ @@ -515,10 +546,11 @@ done: --------------------------------------------------------------------------*/ hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id) + H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id) { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -542,8 +574,13 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Open the attribute in the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -831,6 +868,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -848,14 +886,13 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the length of the name */ @@ -969,6 +1006,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -985,14 +1023,13 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -1028,6 +1065,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1047,14 +1085,13 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -1131,6 +1168,7 @@ herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, const char *new_attr_name, hid_t lapl_id) { + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by the library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1146,11 +1184,10 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") if(!new_attr_name || !*new_attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { @@ -1160,7 +1197,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call private attribute rename routine */ - if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, H5AC_dxpl_id) < 0) + if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1305,6 +1342,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5A_attr_iter_op_t attr_op; /* Attribute operator */ hsize_t start_idx; /* Index of attribute to start iterating at */ hsize_t last_attr; /* Index of last attribute examined */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1322,11 +1360,10 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1334,12 +1371,12 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Open the object */ - if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Build attribute operator info */ @@ -1348,7 +1385,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Call attribute iteration routine */ last_attr = start_idx = (idx ? *idx : 0); - if((ret_value = H5O_attr_iterate(obj_loc_id, H5AC_ind_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) + if((ret_value = H5O_attr_iterate(obj_loc_id, dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Set the last attribute information */ @@ -1433,6 +1470,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1447,11 +1485,11 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + dxpl_id = H5AC_ind_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1459,12 +1497,17 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Delete the attribute from the location */ - if(H5O_attr_remove(obj_loc.oloc, attr_name, H5AC_dxpl_id) < 0) + if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1509,6 +1552,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1525,11 +1569,11 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + dxpl_id = H5AC_ind_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1537,12 +1581,17 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Delete the attribute from the location */ - if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, H5AC_dxpl_id) < 0) + if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1648,6 +1697,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ + hid_t dxpl_id; /* dxpl used by library */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1662,13 +1712,13 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") - if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id)) < 0) + dxpl_id = H5AC_ind_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5AC.c b/src/H5AC.c index c6b0b47..446e58c 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -149,16 +149,17 @@ static herr_t H5AC__run_sync_point(H5F_t *f, hid_t dxpl_id, int sync_point_op); /*****************************/ /* Default dataset transfer property list for metadata I/O calls */ -/* (Collective set, "block before metadata write" set and "library internal" set) */ +/* (Collective set) */ /* (Global variable definition, declaration is in H5ACprivate.h also) */ hid_t H5AC_dxpl_id = (-1); /* Dataset transfer property list for independent metadata I/O calls */ -/* (just "library internal" set - i.e. independent transfer mode) */ /* (Global variable definition, declaration is in H5ACprivate.h also) */ H5P_genplist_t *H5AC_ind_dxpl_g = NULL; hid_t H5AC_ind_dxpl_id = (-1); +hid_t H5AC_coll_write_coll_read_dxpl_id=(-1); +hid_t H5AC_ind_write_coll_read_dxpl_id=(-1); /*******************/ /* Local Variables */ @@ -251,6 +252,7 @@ H5AC_init_interface(void) #ifdef H5_HAVE_PARALLEL H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ unsigned coll_meta_write; /* "collective metadata write" property value */ + H5P_coll_md_read_flag_t coll_meta_read; #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -267,6 +269,7 @@ H5AC_init_interface(void) /* Get the property list object */ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + HDassert(xfer_plist); /* Insert 'collective metadata write' property */ coll_meta_write = 1; @@ -287,12 +290,53 @@ H5AC_init_interface(void) if(H5P_insert(H5AC_ind_dxpl_g, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") + + /* Get an ID for H5AC_coll_write_coll_read_dxpl_id */ + if((H5AC_coll_write_coll_read_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_coll_write_coll_read_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + + /* Insert 'collective metadata write' property */ + coll_meta_write = 1; + if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") + + /* set 'collective metadata read' property */ + coll_meta_read = H5P_USER_TRUE; + if(H5P_set(xfer_plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag") + + + /* Get an ID for H5AC_ind_write_coll_read_dxpl_id */ + if((H5AC_ind_write_coll_read_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_ind_write_coll_read_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + + /* Insert 'collective metadata write' property */ + coll_meta_write = 0; + if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") + /* set 'collective metadata read' property */ + coll_meta_read = H5P_USER_TRUE; + if(H5P_set(xfer_plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag") + #else /* H5_HAVE_PARALLEL */ /* Sanity check */ HDassert(H5P_LST_DATASET_XFER_ID_g!=(-1)); H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT; H5AC_ind_dxpl_id = H5P_DATASET_XFER_DEFAULT; + H5AC_coll_write_coll_read_dxpl_id = H5P_DATASET_XFER_DEFAULT; + H5AC_ind_write_coll_read_dxpl_id = H5P_DATASET_XFER_DEFAULT; /* Get the property list objects for the IDs */ if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id))) @@ -328,17 +372,23 @@ H5AC_term_interface(void) if(H5_interface_initialize_g) { #ifdef H5_HAVE_PARALLEL - if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0) { + if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0 || + H5AC_coll_write_coll_read_dxpl_id > 0 || + H5AC_ind_write_coll_read_dxpl_id > 0) { /* Indicate more work to do */ n = 1; /* H5I */ /* Close H5AC dxpl */ - if(H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0) + if(H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0 || + H5I_dec_ref(H5AC_coll_write_coll_read_dxpl_id) < 0 || + H5I_dec_ref(H5AC_ind_write_coll_read_dxpl_id) < 0) H5E_clear_stack(NULL); /*ignore error*/ else { /* Reset static IDs */ H5AC_dxpl_id = (-1); H5AC_ind_dxpl_id = (-1); + H5AC_coll_write_coll_read_dxpl_id = (-1); + H5AC_ind_write_coll_read_dxpl_id = (-1); /* Reset interface initialization flag */ H5_interface_initialize_g = 0; @@ -351,6 +401,8 @@ H5AC_term_interface(void) H5AC_ind_dxpl_id = (-1); #ifdef H5_HAVE_PARALLEL } /* end else */ + H5AC_coll_write_coll_read_dxpl_id = (-1); + H5AC_ind_write_coll_read_dxpl_id = (-1); #endif /* H5_HAVE_PARALLEL */ /* Reset interface initialization flag */ @@ -564,6 +616,10 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL + /* destroying the cache, so clear all collective entries */ + if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + aux_ptr = (struct H5AC_aux_t *)(f->shared->cache->aux_ptr); if(aux_ptr) /* Sanity check */ @@ -702,6 +758,10 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id) #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL + /* flushing the cache, so clear all collective entries */ + if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */ if(H5AC__flush_entries(f, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") @@ -4276,6 +4336,14 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu aux_ptr->rename_dirty_bytes_updates); #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ + /* clear collective access flag on half of the entries in the + cache and mark them as independent in case they need to be + evicted later. All ranks are guranteed to mark the same entires + since we don't modify the order of the collectively accessed + entries except through collective access. */ + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + switch(aux_ptr->metadata_write_strategy) { case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: switch(sync_point_op) { diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 584ce9d..7a5a4d9 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -196,6 +196,9 @@ extern hid_t H5AC_dxpl_id; H5_DLLVAR H5P_genplist_t *H5AC_ind_dxpl_g; H5_DLLVAR hid_t H5AC_ind_dxpl_id; +H5_DLLVAR hid_t H5AC_coll_write_coll_read_dxpl_id; +H5_DLLVAR hid_t H5AC_ind_write_coll_read_dxpl_id; + /* Default cache configuration. */ diff --git a/src/H5C.c b/src/H5C.c index fc4e8a5..05b4299 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -109,6 +109,19 @@ H5FL_DEFINE_STATIC(H5C_t); +#ifdef H5_HAVE_PARALLEL +typedef struct H5C_collective_write_t { + size_t length; + hbool_t free_buf; + void *buf; + haddr_t offset; +} H5C_collective_write_t; +static herr_t H5C_collective_write(H5F_t *f, + hid_t dxpl_id, + H5SL_t *collective_write_list); +static herr_t H5C_collective_write_free(void *_item, void *key, void *op_data); +#endif /* H5_HAVE_PARALLEL */ + /* * Private file-scope function declarations: */ @@ -144,8 +157,9 @@ static herr_t H5C_flush_single_entry(const H5F_t * f, hid_t dxpl_id, haddr_t addr, unsigned flags, - hbool_t del_entry_from_slist_on_destroy, - int64_t *entry_size_change_ptr); + hbool_t del_entry_from_slist_on_destroy, + int64_t *entry_size_change_ptr, + H5SL_t * collective_write_list); static herr_t H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, @@ -153,6 +167,9 @@ static herr_t H5C_flush_invalidate_cache(const H5F_t * f, static void * H5C_load_entry(H5F_t * f, hid_t dxpl_id, +#ifdef H5_HAVE_PARALLEL + hbool_t coll_access, +#endif /* H5_HAVE_PARALLEL */ const H5C_class_t * type, haddr_t addr, void * udata); @@ -178,6 +195,9 @@ static herr_t H5C_flush_marked_entries(H5F_t * f, hid_t dxpl_id, H5C_t * cache_ptr); +static herr_t H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, + hid_t dxpl_id, int64_t *entry_size_change_ptr); + #if H5C_DO_TAGGING_SANITY_CHECKS static herr_t H5C_verify_tag(int id, haddr_t tag); #endif @@ -529,6 +549,7 @@ H5C_apply_candidate_list(H5F_t * f, H5C_cache_entry_t * entry_ptr = NULL; H5C_cache_entry_t * flush_ptr = NULL; H5C_cache_entry_t * delayed_ptr = NULL; + H5SL_t * collective_write_list = NULL; #if H5C_DO_SANITY_CHECKS haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ @@ -561,6 +582,10 @@ H5C_apply_candidate_list(H5F_t * f, HDfprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ + /* Create skip list of entries for collective write */ + if(NULL == (collective_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") + n = num_candidates / mpi_size; m = num_candidates % mpi_size; HDassert(n >= 0); @@ -665,6 +690,17 @@ H5C_apply_candidate_list(H5F_t * f, entries_to_clear++; entry_ptr->clear_on_unprotect = TRUE; } /* end else */ + + /* Entries marked as collectively accessed and are in the + candidate list to clear from the cache have to be + removed from the coll list. This is OK since the + candidate list is collective and uniform across all + ranks. */ + if(TRUE == entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + cache_ptr->num_coll_entries --; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } } /* end else */ } /* end for */ @@ -746,6 +782,7 @@ H5C_apply_candidate_list(H5F_t * f, clear_ptr->addr, H5C__FLUSH_CLEAR_ONLY_FLAG, TRUE, + NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") } /* end if */ @@ -796,7 +833,8 @@ H5C_apply_candidate_list(H5F_t * f, flush_ptr->addr, H5C__NO_FLAGS_SET, TRUE, - NULL) < 0) + NULL, + collective_write_list) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.") if ( ( cache_ptr->entries_removed_counter > 1 ) || @@ -956,11 +994,12 @@ H5C_apply_candidate_list(H5F_t * f, #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ if(H5C_flush_single_entry(f, - dxpl_id, - clear_ptr->addr, - H5C__FLUSH_CLEAR_ONLY_FLAG, - TRUE, - NULL) < 0) + dxpl_id, + clear_ptr->addr, + H5C__FLUSH_CLEAR_ONLY_FLAG, + TRUE, + NULL, + NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") } /* end else-if */ @@ -977,11 +1016,12 @@ H5C_apply_candidate_list(H5F_t * f, #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ if(H5C_flush_single_entry(f, - dxpl_id, - flush_ptr->addr, - H5C__NO_FLAGS_SET, - TRUE, - NULL) < 0) + dxpl_id, + flush_ptr->addr, + H5C__NO_FLAGS_SET, + TRUE, + NULL, + collective_write_list) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") } /* end else-if */ } /* end if */ @@ -1015,26 +1055,41 @@ H5C_apply_candidate_list(H5F_t * f, if (delayed_ptr) { if (delayed_ptr->clear_on_unprotect) { + if(H5C_flush_single_entry(f, + dxpl_id, + delayed_ptr->addr, + H5C__FLUSH_CLEAR_ONLY_FLAG, + TRUE, + NULL, + NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "Can't flush entry collectively.") entry_ptr->clear_on_unprotect = FALSE; entries_cleared++; } else if (delayed_ptr->flush_immediately) { + if(H5C_flush_single_entry(f, + dxpl_id, + delayed_ptr->addr, + H5C__NO_FLAGS_SET, + TRUE, + NULL, + collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "Can't flush entry collectively.") entry_ptr->flush_immediately = FALSE; entries_flushed++; } /* end if */ - if(H5C_flush_single_entry(f, - dxpl_id, - delayed_ptr->addr, - H5C__NO_FLAGS_SET, - TRUE, - NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "Can't flush entry collectively.") - entries_flushed_collectively++; entries_flushed_or_cleared_last++; } /* end if */ + /* Write collective list */ + if(H5C_collective_write(f, + dxpl_id, + collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't write metadata collectively") + /* ====================================================================== * * Finished flushing everything. * * ====================================================================== */ @@ -1054,6 +1109,10 @@ done: if(candidate_assignment_table != NULL) candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table); + if(collective_write_list) + if(H5SL_destroy(collective_write_list, H5C_collective_write_free, NULL) < 0) + HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list") + FUNC_LEAVE_NOAPI(ret_value) } /* H5C_apply_candidate_list() */ #endif /* H5_HAVE_PARALLEL */ @@ -1396,6 +1455,14 @@ H5C_create(size_t max_cache_size, cache_ptr->LRU_head_ptr = NULL; cache_ptr->LRU_tail_ptr = NULL; +#ifdef H5_HAVE_PARALLEL + cache_ptr->coll_list_len = 0; + cache_ptr->coll_list_size = (size_t)0; + cache_ptr->coll_head_ptr = NULL; + cache_ptr->coll_tail_ptr = NULL; + cache_ptr->num_coll_entries = 0; +#endif /* H5_HAVE_PARALLEL */ + cache_ptr->cLRU_list_len = 0; cache_ptr->cLRU_list_size = (size_t)0; cache_ptr->cLRU_head_ptr = NULL; @@ -1831,7 +1898,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, entry_size = entry_ptr->size; #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - if(H5C_flush_single_entry(f, dxpl_id, entry_ptr->addr, flush_flags, TRUE, NULL) < 0) + if(H5C_flush_single_entry(f, dxpl_id, entry_ptr->addr, flush_flags, TRUE, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_flush_single_entry() failed.") #if H5C_DO_SANITY_CHECKS @@ -2157,11 +2224,12 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) entry_size_change = 0; #endif /* H5C_DO_SANITY_CHECKS */ status = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - flags, - FALSE, - entry_size_change_ptr); + dxpl_id, + entry_ptr->addr, + flags, + FALSE, + entry_size_change_ptr, + NULL); if ( status < 0 ) { /* This shouldn't happen -- if it does, @@ -2217,11 +2285,12 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) entry_size_change = 0; #endif /* H5C_DO_SANITY_CHECKS */ status = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - flags, - FALSE, - entry_size_change_ptr); + dxpl_id, + entry_ptr->addr, + flags, + FALSE, + entry_size_change_ptr, + NULL); if ( status < 0 ) { /* This shouldn't happen -- if it does, @@ -2915,7 +2984,9 @@ H5C_insert_entry(H5F_t * f, hbool_t insert_pinned; hbool_t flush_last; #ifdef H5_HAVE_PARALLEL + hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ hbool_t flush_collectively; + H5P_genplist_t * dxpl; /* dataset transfer property list */ #endif /* H5_HAVE_PARALLEL */ hbool_t set_flush_marker; hbool_t write_permitted = TRUE; @@ -3050,6 +3121,9 @@ H5C_insert_entry(H5F_t * f, entry_ptr->aux_next = NULL; entry_ptr->aux_prev = NULL; + entry_ptr->coll_next = NULL; + entry_ptr->coll_prev = NULL; + H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) if ( ( cache_ptr->flash_size_increase_possible ) && @@ -3180,6 +3254,50 @@ H5C_insert_entry(H5F_t * f, H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) +#ifdef H5_HAVE_PARALLEL + /* Get the dataset transfer property list */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE); + + if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read) { + H5P_coll_md_read_flag_t prop_value; + + /* get the property value */ + if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't get collective metadata access flag") + + coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE); + } + //fprintf(stderr, "COLLACCESS = %d.. FILE property = %d\n", coll_access, f->coll_md_read); + } + + entry_ptr->coll_access = coll_access; + if(coll_access) { + //fprintf(stderr, "NEW (%llu, %s)\n", addr, entry_ptr->type->name); + cache_ptr->num_coll_entries ++; + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL) + + /* Make sure the size of the collective entries in the cache remain in check */ + if(H5P_USER_TRUE == f->coll_md_read) { + if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) { + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + } + } + else { + if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) { + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + } + } + + } + entry_ptr->ind_access_while_coll = FALSE; +#endif + done: #if H5C_DO_EXTREME_SANITY_CHECKS @@ -3359,6 +3477,12 @@ H5C_mark_entries_as_clean(H5F_t * f, * scan the LRU list shortly, and clear all those entries * not currently protected. */ + if(TRUE == entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + cache_ptr->num_coll_entries --; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } + entry_ptr->clear_on_unprotect = TRUE; #if H5C_DO_SANITY_CHECKS if ( entry_ptr->is_protected ) { @@ -3424,6 +3548,7 @@ H5C_mark_entries_as_clean(H5F_t * f, clear_ptr->addr, H5C__FLUSH_CLEAR_ONLY_FLAG, TRUE, + NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") @@ -3459,6 +3584,7 @@ H5C_mark_entries_as_clean(H5F_t * f, clear_ptr->addr, H5C__FLUSH_CLEAR_ONLY_FLAG, TRUE, + NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") @@ -3853,6 +3979,14 @@ H5C_resize_entry(void *thing, size_t new_size) (entry_ptr->size), (new_size)) } /* end if */ +#ifdef H5_HAVE_PARALLEL + if(entry_ptr->coll_access) { + H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->coll_list_len), \ + (cache_ptr->coll_list_size), \ + (entry_ptr->size), (new_size)) + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + /* update the hash table */ H5C__UPDATE_INDEX_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\ (new_size), (entry_ptr), (was_clean)); @@ -4080,14 +4214,15 @@ H5C_protect(H5F_t * f, hbool_t flush_last; #ifdef H5_HAVE_PARALLEL hbool_t flush_collectively; + hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ #endif /* H5_HAVE_PARALLEL */ hbool_t write_permitted; herr_t result; size_t empty_space; void * thing; H5C_cache_entry_t * entry_ptr; - haddr_t tag = HADDR_UNDEF; - H5P_genplist_t *dxpl; /* dataset transfer property list */ + haddr_t tag = HADDR_UNDEF; + H5P_genplist_t * dxpl; /* dataset transfer property list */ void * ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -4108,7 +4243,7 @@ H5C_protect(H5F_t * f, ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ "an extreme sanity check failed on entry.\n"); } #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -4119,15 +4254,101 @@ H5C_protect(H5F_t * f, flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); #endif /* H5_HAVE_PARALLEL */ + /* Get the dataset transfer property list */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); + +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE); + + if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read) { + H5P_coll_md_read_flag_t prop_value; + + /* get the property value */ + if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "Can't get collective metadata access flag") + + coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE); + } + //fprintf(stderr, "COLLACCESS = %d.. FILE property = %d\n", coll_access, f->coll_md_read); + } +#endif /* H5_HAVE_PARALLEL */ + /* first check to see if the target is in cache */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL) if ( entry_ptr != NULL ) { - /* Check for trying to load the wrong type of entry from an address */ if(entry_ptr->type != type) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type") + /* if this is a collective metadata read, the entry is not + marked as collective, and is clean, it is possible that + other processes will not have it in its cache and will + expect a bcast of the entry from process 0. So process 0 + will bcast the entry to all other ranks. Ranks that do have + the entry in their cache still have to participate in the + bcast. */ +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && + !(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { + MPI_Comm comm; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ + int buf_size; + + if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") + + if(entry_ptr->image_ptr == NULL) { + int mpi_rank; + size_t image_size; + + if((mpi_rank = H5F_mpi_get_rank(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") + + if ( entry_ptr->compressed ) + image_size = entry_ptr->compressed_size; + else + image_size = entry_ptr->size; + + HDassert(image_size > 0); + + entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE); + + if (NULL == entry_ptr->image_ptr) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, \ + "memory allocation failed for on disk image buffer") + } +#if H5C_DO_MEMORY_SANITY_CHECKS + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, + H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + if(0 == mpi_rank) { + if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "Can't get Image") + } + } + + HDassert(entry_ptr->image_ptr); + + H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, + MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + + entry_ptr->coll_access = TRUE; + cache_ptr->num_coll_entries ++; + + //fprintf(stderr, "ONLY INSERT (%llu, %s)\n", addr, entry_ptr->type->name); + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } + else if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && entry_ptr->coll_access) { + //fprintf(stderr, "UPDATE (%llu, %s)\n", addr, entry_ptr->type->name); + H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } +#endif /* H5_HAVE_PARALLEL */ + #if H5C_DO_TAGGING_SANITY_CHECKS /* The entry is already in the cache, but make sure that the tag value being passed in via dxpl is still legal. This will ensure that had @@ -4135,10 +4356,6 @@ H5C_protect(H5F_t * f, and it would have received a legal tag value after getting loaded from disk. */ - /* Get the dataset transfer property list */ - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); - /* Get the tag from the DXPL */ if( (H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0 ) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to query property value"); @@ -4162,7 +4379,11 @@ H5C_protect(H5F_t * f, hit = FALSE; - thing = H5C_load_entry(f, dxpl_id, type, addr, udata); + thing = H5C_load_entry(f, dxpl_id, +#ifdef H5_HAVE_PARALLEL + coll_access, +#endif /* H5_HAVE_PARALLEL */ + type, addr, udata); if ( thing == NULL ) { @@ -4171,6 +4392,17 @@ H5C_protect(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if(entry_ptr->coll_access) { + cache_ptr->num_coll_entries ++; + //fprintf(stderr, "LOAD and INSERT (%llu, %s)\n", addr, entry_ptr->type->name); + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } + } + //fprintf(stderr, "LOADED (%llu, %s) - %d\n", addr, entry_ptr->type->name, coll_access); +#endif /* H5_HAVE_PARALLEL */ + /* Apply tag to newly protected entry */ if(H5C_tag_entry(cache_ptr, entry_ptr, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag metadata entry") @@ -4453,6 +4685,29 @@ H5C_protect(H5F_t * f, } } +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + /* Make sure the size of the collective entries in the cache remain in check */ + if( TRUE == coll_access) { + if(H5P_USER_TRUE == f->coll_md_read) { + //fprintf(stderr, "COLL entries size = %zu, MAX = %zu\n", cache_ptr->coll_list_size, cache_ptr->max_cache_size); + if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) { + //fprintf(stderr, "COLL entries at 80.. CLEARING\n"); + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") + } + } + else { + if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) { + //fprintf(stderr, "COLL entries at 40.. CLEARING\n"); + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") + } + } + } + } +#endif /* H5_HAVE_PARALLEL */ + done: #if H5C_DO_EXTREME_SANITY_CHECKS @@ -4460,7 +4715,7 @@ done: ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ "an extreme sanity check failed on exit.\n"); } #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -6138,6 +6393,7 @@ H5C_unprotect(H5F_t * f, addr, flush_flags, TRUE, + NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't flush.") @@ -6179,6 +6435,7 @@ H5C_unprotect(H5F_t * f, addr, H5C__FLUSH_CLEAR_ONLY_FLAG, TRUE, + NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear.") @@ -7518,6 +7775,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, entry_ptr->addr, H5C__NO_FLAGS_SET, FALSE, + NULL, NULL); if ( ( cache_ptr->entries_removed_counter > 1 ) || @@ -7534,6 +7792,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, entry_ptr->addr, H5C__FLUSH_INVALIDATE_FLAG, TRUE, + NULL, NULL); } @@ -7625,6 +7884,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, entry_ptr->addr, H5C__FLUSH_INVALIDATE_FLAG, TRUE, + NULL, NULL); if ( result < 0 ) { @@ -8404,7 +8664,8 @@ H5C_flush_invalidate_cache(const H5F_t * f, entry_ptr->addr, H5C__NO_FLAGS_SET, FALSE, - entry_size_change_ptr); + entry_size_change_ptr, + NULL); if ( status < 0 ) { /* This shouldn't happen -- if it does, we @@ -8462,11 +8723,12 @@ H5C_flush_invalidate_cache(const H5F_t * f, #endif /* H5C_DO_SANITY_CHECKS */ status = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG), - TRUE, - entry_size_change_ptr); + dxpl_id, + entry_ptr->addr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG), + TRUE, + entry_size_change_ptr, + NULL); if ( status < 0 ) { /* This shouldn't happen -- if it does, we @@ -8604,11 +8866,12 @@ H5C_flush_invalidate_cache(const H5F_t * f, entry_was_dirty = entry_ptr->is_dirty; status = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG), - TRUE, - NULL); + dxpl_id, + entry_ptr->addr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG), + TRUE, + NULL, + NULL); if ( status < 0 ) { @@ -8820,7 +9083,8 @@ H5C_flush_single_entry(const H5F_t * f, haddr_t addr, unsigned flags, hbool_t del_entry_from_slist_on_destroy, - int64_t * entry_size_change_ptr) + int64_t * entry_size_change_ptr, + H5SL_t * collective_write_list) { H5C_t * cache_ptr = f->shared->cache; hbool_t destroy; /* external flag */ @@ -8866,6 +9130,8 @@ H5C_flush_single_entry(const H5F_t * f, /* attempt to find the target entry in the hash table */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + HDassert(FALSE == entry_ptr->coll_access); + /* we will write the entry to disk if it exists, is dirty, and if the * clear only flag is not set. */ @@ -8948,7 +9214,7 @@ H5C_flush_single_entry(const H5F_t * f, unsigned coll_meta; /* Collective metadata write flag */ /* Get the dataset transfer property list */ - if(NULL == (dxpl = H5I_object(dxpl_id))) + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Get the collective metadata write property */ @@ -9301,6 +9567,25 @@ H5C_flush_single_entry(const H5F_t * f, else image_size = entry_ptr->size; +#ifdef H5_HAVE_PARALLEL + if(collective_write_list) { + H5C_collective_write_t *item = NULL; + + if(NULL == (item = (H5C_collective_write_t *)H5MM_malloc(sizeof(H5C_collective_write_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate skip list item") + + item->length = image_size; + item->free_buf = FALSE; + item->buf = entry_ptr->image_ptr; + item->offset = entry_ptr->addr; + + if(H5SL_insert(collective_write_list, item, &item->offset) < 0) { + H5MM_free(item); + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to insert skip list item") + } /* end if */ + } /* end if */ + else +#endif /* H5_HAVE_PARALLEL */ if ( ( H5F_block_write(f, entry_ptr->type->mem_type, entry_ptr->addr, image_size, dxpl_id, @@ -9644,6 +9929,9 @@ done: static void * H5C_load_entry(H5F_t * f, hid_t dxpl_id, +#ifdef H5_HAVE_PARALLEL + hbool_t coll_access, +#endif /* H5_HAVE_PARALLEL */ const H5C_class_t * type, haddr_t addr, void * udata) @@ -9662,6 +9950,11 @@ H5C_load_entry(H5F_t * f, H5C_cache_entry_t * entry; /* Alias for thing loaded, as cache entry */ size_t len; /* Size of image in file */ unsigned u; /* Local index variable */ +#ifdef H5_HAVE_PARALLEL + int mpi_rank; /* MPI process rank */ + MPI_Comm comm; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ +#endif /* H5_HAVE_PARALLEL */ void * ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -9808,11 +10101,39 @@ H5C_load_entry(H5F_t * f, HDmemcpy(((uint8_t *)image) + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if((mpi_rank = H5F_mpi_get_rank(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") + if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") + } +#endif /* H5_HAVE_PARALLEL */ + /* Get the on-disk entry image */ - if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) + if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) { +#ifdef H5_HAVE_PARALLEL + if(!coll_access || 0 == mpi_rank) { +#endif /* H5_HAVE_PARALLEL */ + if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0) HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") +#ifdef H5_HAVE_PARALLEL + } + /* if the collective metadata read optimization is turned on, + bcast the metadata read from process 0 to all ranks in the file + communicator */ + if(coll_access) { + int buf_size; + + H5_CHECKED_ASSIGN(buf_size, int, len, size_t); + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + } +#endif /* H5_HAVE_PARALLEL */ + } + /* Deserialize the on-disk image into the native memory form */ if(NULL == (thing = type->deserialize(image, len, udata, &dirty))) HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image") @@ -9920,21 +10241,32 @@ H5C_load_entry(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, \ "free_icr callback failed") +#ifdef H5_HAVE_PARALLEL + if(!coll_access || 0 == mpi_rank) { +#endif /* H5_HAVE_PARALLEL */ /* Go get the on-disk image again */ if(H5F_block_read(f, type->mem_type, addr, new_len, dxpl_id, image) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't read image") - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, \ - "Can't read image") +#ifdef H5_HAVE_PARALLEL + } + /* if the collective metadata read optimization is turned on, + bcast the metadata read from process 0 to all ranks in the file + communicator */ + if(coll_access) { + int buf_size; + + H5_CHECKED_ASSIGN(buf_size, int, new_len, size_t); + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + } +#endif /* H5_HAVE_PARALLEL */ - /* Deserialize on-disk image into native memory - * form again - */ + /* Deserialize on-disk image into native memory form again */ if(NULL == (thing = type->deserialize(image, new_len, udata, &dirty))) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, \ - "Can't deserialize image") + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image") #ifndef NDEBUG { @@ -10019,6 +10351,8 @@ H5C_load_entry(H5F_t * f, #ifdef H5_HAVE_PARALLEL entry->clear_on_unprotect = FALSE; entry->flush_immediately = FALSE; + entry->coll_access = coll_access; + entry->ind_access_while_coll = FALSE; #endif /* H5_HAVE_PARALLEL */ entry->flush_in_progress = FALSE; entry->destroy_in_progress = FALSE; @@ -10037,6 +10371,9 @@ H5C_load_entry(H5F_t * f, entry->aux_next = NULL; entry->aux_prev = NULL; + entry->coll_next = NULL; + entry->coll_prev = NULL; + H5C__RESET_CACHE_ENTRY_STATS(entry); ret_value = thing; @@ -10230,32 +10567,48 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; + if(TRUE == entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + cache_ptr->num_coll_entries --; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } + result = H5C_flush_single_entry(f, dxpl_id, entry_ptr->addr, H5C__NO_FLAGS_SET, FALSE, + NULL, NULL); - if ( ( cache_ptr->entries_removed_counter > 1 ) || ( cache_ptr->last_entry_removed_ptr == prev_ptr ) ) restart_scan = TRUE; - } else if ( (cache_ptr->index_size + space_needed) - > - cache_ptr->max_cache_size ) { + } else if ( (cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size +#ifdef H5_HAVE_PARALLEL + && !(entry_ptr->coll_access) +#endif /* H5_HAVE_PARALLEL */ + ) { #if H5C_COLLECT_CACHE_STATS cache_ptr->entries_scanned_to_make_space++; #endif /* H5C_COLLECT_CACHE_STATS */ + if(TRUE == entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + cache_ptr->num_coll_entries --; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } + result = H5C_flush_single_entry(f, dxpl_id, entry_ptr->addr, H5C__FLUSH_INVALIDATE_FLAG, TRUE, + NULL, NULL); + } else { /* We have enough space so don't flush clean entry. @@ -10404,18 +10757,25 @@ H5C_make_space_in_cache(H5F_t * f, prev_ptr = entry_ptr->aux_prev; - result = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - H5C__FLUSH_INVALIDATE_FLAG, - TRUE, - NULL); +#ifdef H5_HAVE_PARALLEL + if(!(entry_ptr->coll_access)) { +#endif /* H5_HAVE_PARALLEL */ + result = H5C_flush_single_entry(f, + dxpl_id, + entry_ptr->addr, + H5C__FLUSH_INVALIDATE_FLAG, + TRUE, + NULL, + NULL); - if ( result < 0 ) { + if ( result < 0 ) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unable to flush entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unable to flush entry") + } +#ifdef H5_HAVE_PARALLEL } +#endif /* H5_HAVE_PARALLEL */ /* we are scanning the clean LRU, so the serialize function * will not be called on any entry -- thus there is no @@ -11305,6 +11665,222 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_flush_marked_entries */ +#ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * + * Function: H5C_clear_coll_entries + * + * Purpose: + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mohamad Chaarawi + * April, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_clear_coll_entries(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5C_t * cache_ptr, + hbool_t partial) +{ + int32_t list_len, coll_entries_cleared = 0, coll_dirty_entries=0; + H5C_cache_entry_t * entry_ptr = NULL; + H5C_cache_entry_t * prev_ptr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + //fprintf(stderr, "List len = %d, NUM coll entries = %d\n", cache_ptr->coll_list_len, cache_ptr->num_coll_entries); + entry_ptr = cache_ptr->coll_tail_ptr; + list_len = cache_ptr->coll_list_len; + while(entry_ptr && (coll_entries_cleared < (partial ? list_len/2 : list_len))) { + prev_ptr = entry_ptr->coll_prev; + + HDassert(entry_ptr->coll_access); + + if(entry_ptr->is_dirty && partial && 0) { + coll_dirty_entries ++; + //fprintf(stderr, "%d: %llu Coll entry is Dirty\n", mpi_rank, entry_ptr->addr); + } + else { + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + coll_entries_cleared ++; + //fprintf(stderr, "Cleared %llu Coll entries Cleaned = %d\n", entry_ptr->addr, coll_entries_cleared); + } + entry_ptr = prev_ptr; + } + + //fprintf(stderr, "NUM COLL entries = %d, CLEARED %d, Dirty %d\n", + //cache_ptr->num_coll_entries, coll_entries_cleared, coll_dirty_entries); + + cache_ptr->num_coll_entries -= coll_entries_cleared; + //fprintf(stderr, "NUM COLL entries = %d, NUM COLL dirty entries = %d\n", cache_ptr->num_coll_entries, coll_dirty_entries); + HDassert(cache_ptr->coll_list_len == cache_ptr->num_coll_entries); + //HDassert(0 == coll_dirty_entries - cache_ptr->num_coll_entries); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_clear_coll_entries */ + +static herr_t +H5C_collective_write(H5F_t *f, + hid_t dxpl_id, + H5SL_t *collective_write_list) +{ + H5P_genplist_t *plist = NULL; + H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE; + H5FD_mpio_xfer_t orig_xfer_mode = -1; + H5SL_node_t *node; + H5C_collective_write_t *item; + int count; + void *base_buf; + int *length_array = NULL; + MPI_Aint *buf_array = NULL; + MPI_Aint *offset_array = NULL; + MPI_Datatype btype; + MPI_Datatype ftype; + hbool_t btype_created = FALSE; + hbool_t ftype_created = FALSE; + int mpi_code; + int i; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + count = (int)H5SL_count(collective_write_list); + + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + + if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &orig_xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") + + if(count > 0) { + if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") + + /* Allocate arrays */ + if(NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective write table length array") + if(NULL == (buf_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective buf table length array") + if(NULL == (offset_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective offset table length array") + + /* Fill arrays */ + node = H5SL_first(collective_write_list); + HDassert(node); + if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node))) + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + + length_array[0] = (int)item->length; + base_buf = item->buf; + buf_array[0] = (MPI_Aint)0; + offset_array[0] = (MPI_Aint)item->offset; + + node = H5SL_next(node); + i = 1; + while(node) { + if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node))) + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + + length_array[i] = (int)item->length; + buf_array[i] = (MPI_Aint)item->buf - (MPI_Aint)base_buf; + offset_array[i] = (MPI_Aint)item->offset; + node = H5SL_next(node); + i++; + } /* end while */ + + /* Create memory mpi type */ + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) + btype_created = TRUE; + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + + /* Create file mpi type */ + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) + ftype_created = TRUE; + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + + /* Pass buf type, file type to the file driver. */ + if(H5FD_mpi_setup_collective(dxpl_id, &btype, &ftype) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O properties") + + /* Write data */ + if(H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, (size_t)1, dxpl_id, base_buf) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to write entries collectively") + } /* end if */ + else { + MPI_Status mpi_stat; + MPI_File mpi_fh_p; + MPI_File mpi_fh; + + if(H5F_get_mpi_handle(f, (MPI_File **)&mpi_fh_p) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle") + mpi_fh = *(MPI_File*)mpi_fh_p; + + /* just to match up with the 1st MPI_File_set_view from H5FD_mpio_write() */ + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, + MPI_BYTE, "native", MPI_INFO_NULL))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) + + /* just to match up with MPI_File_write_at_all from H5FD_mpio_write() */ + HDmemset(&mpi_stat, 0, sizeof(MPI_Status)); + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, + MPI_BYTE, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) + + /* just to match up with the 2nd MPI_File_set_view (reset) in H5FD_mpio_write() */ + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, + MPI_BYTE, "native", MPI_INFO_NULL))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) + } /* end else */ + +done: + /* Free arrays */ + length_array = (int *)H5MM_xfree(length_array); + buf_array = (MPI_Aint *)H5MM_xfree(buf_array); + offset_array = (MPI_Aint *)H5MM_xfree(offset_array); + + /* Free MPI Types */ + if(btype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + if(ftype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + + /* Reset dxpl */ + if(orig_xfer_mode != H5FD_MPIO_COLLECTIVE) { + HDassert(plist); + if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &orig_xfer_mode) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5C_collective_write() */ + +static herr_t +H5C_collective_write_free(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) +{ + H5C_collective_write_t *item = (H5C_collective_write_t *)_item; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(item); + + if(item->free_buf) + item->buf = H5MM_xfree(item->buf); + /*!FIXME change to use free list for items */ + H5MM_free(item); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5C_double_collective_table() */ +#endif /* H5_HAVE_PARALLEL */ + #if H5C_DO_TAGGING_SANITY_CHECKS /*------------------------------------------------------------------------- @@ -11424,3 +12000,246 @@ H5C_retag_copied_metadata(H5C_t * cache_ptr, haddr_t metadata_tag) FUNC_LEAVE_NOAPI_VOID } /* H5C_retag_copied_metadata */ +static herr_t +H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, + hid_t dxpl_id, int64_t *entry_size_change_ptr) +{ + haddr_t new_addr = HADDR_UNDEF; + haddr_t old_addr = HADDR_UNDEF; + size_t new_len = 0; + size_t new_compressed_len = 0; + unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(!entry_ptr->image_up_to_date); + + /* reset cache_ptr->slist_changed so we can detect slist + * modifications in the pre_serialize call. + */ + cache_ptr->slist_changed = FALSE; + + /* make note of the entry's current address */ + old_addr = entry_ptr->addr; + + /* Call client's pre-serialize callback, if there's one */ + if ( ( entry_ptr->type->pre_serialize != NULL ) && + ( (entry_ptr->type->pre_serialize)(f, dxpl_id, + (void *)entry_ptr, + entry_ptr->addr, + entry_ptr->size, + entry_ptr->compressed_size, + &new_addr, &new_len, + &new_compressed_len, + &serialize_flags) < 0 ) ) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unable to pre-serialize entry"); + } + + /* set cache_ptr->slist_change_in_pre_serialize if the + * slist was modified. + */ + if ( cache_ptr->slist_changed ) + cache_ptr->slist_change_in_pre_serialize = TRUE; + + /* Check for any flags set in the pre-serialize callback */ + if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) { + /* Check for unexpected flags from serialize callback */ + if ( serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | + H5C__SERIALIZE_MOVED_FLAG | + H5C__SERIALIZE_COMPRESSED_FLAG)) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unknown serialize flag(s)"); + } + +#ifdef H5_HAVE_PARALLEL + if ( cache_ptr->aux_ptr != NULL ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "resize/move in serialize occured in parallel case."); +#endif + + /* Resize the buffer if required */ + if ( ( ( ! entry_ptr->compressed ) && + ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) ) || + ( ( entry_ptr->compressed ) && + ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) ) ) { + size_t new_image_size; + + if ( entry_ptr->compressed ) + new_image_size = new_compressed_len; + else + new_image_size = new_len; + + HDassert(new_image_size > 0); + + /* Release the current image */ + if ( entry_ptr->image_ptr ) { + entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + } + + /* Allocate a new image buffer */ + entry_ptr->image_ptr = + H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE); + + if ( NULL == entry_ptr->image_ptr ) + { + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, \ + "memory allocation failed for on disk image buffer"); + } + +#if H5C_DO_MEMORY_SANITY_CHECKS + + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, + H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE); + +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + + } /* end if */ + + /* If required, update the entry and the cache data structures + * for a resize. + */ + if ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) { + + H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, \ + entry_ptr, new_len); + + /* update the hash table for the size change*/ + H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, \ + entry_ptr->size, \ + new_len, entry_ptr, \ + !(entry_ptr->is_dirty)); + + /* The entry can't be protected since we are + * in the process of flushing it. Thus we must + * update the replacement policy data + * structures for the size change. The macro + * deals with the pinned case. + */ + H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); + + /* as we haven't updated the cache data structures for + * for the flush or flush destroy yet, the entry should + * be in the slist. Thus update it for the size change. + */ + HDassert(entry_ptr->in_slist); + H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ + new_len); + + /* if defined, update *entry_size_change_ptr for the + * change in entry size. + */ + if ( entry_size_change_ptr != NULL ) + { + *entry_size_change_ptr = (int64_t)new_len; + *entry_size_change_ptr -= (int64_t)(entry_ptr->size); + } + + /* finally, update the entry for its new size */ + entry_ptr->size = new_len; + } /* end if */ + + /* If required, udate the entry and the cache data structures + * for a move + */ + if(serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { +#if H5C_DO_SANITY_CHECKS + int64_t saved_slist_len_increase; + int64_t saved_slist_size_increase; +#endif /* H5C_DO_SANITY_CHECKS */ + + H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr); + + if ( entry_ptr->addr == old_addr ) { + /* we must update cache data structures for the + * change in address. + */ + + /* delete the entry from the hash table and the slist */ + H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr); + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr); + + /* update the entry for its new address */ + entry_ptr->addr = new_addr; + + /* and then reinsert in the index and slist */ + H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); + +#if H5C_DO_SANITY_CHECKS + /* save cache_ptr->slist_len_increase and + * cache_ptr->slist_size_increase before the + * reinsertion into the slist, and restore + * them afterwards to avoid skewing our sanity + * checking. + */ + saved_slist_len_increase = cache_ptr->slist_len_increase; + saved_slist_size_increase = cache_ptr->slist_size_increase; +#endif /* H5C_DO_SANITY_CHECKS */ + + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + +#if H5C_DO_SANITY_CHECKS + cache_ptr->slist_len_increase = saved_slist_len_increase; + cache_ptr->slist_size_increase = saved_slist_size_increase; +#endif /* H5C_DO_SANITY_CHECKS */ + } + else { + HDassert(entry_ptr->addr == new_addr); + } + } /* end if */ + + if ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) { + /* just save the new compressed entry size in + * entry_ptr->compressed_size. We don't need to + * do more, as compressed size is only used for I/O. + */ + HDassert(entry_ptr->compressed); + entry_ptr->compressed_size = new_compressed_len; + } + } /* end if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) */ + + /* Serialize object into buffer */ + { + size_t image_len; + + if ( entry_ptr->compressed ) + image_len = entry_ptr->compressed_size; + else + image_len = entry_ptr->size; + + /* reset cache_ptr->slist_changed so we can detect slist + * modifications in the serialize call. + */ + cache_ptr->slist_changed = FALSE; + + + if ( entry_ptr->type->serialize(f, entry_ptr->image_ptr, + image_len, + (void *)entry_ptr) < 0) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unable to serialize entry"); + } + + /* set cache_ptr->slist_change_in_serialize if the + * slist was modified. + */ + if ( cache_ptr->slist_changed ) + cache_ptr->slist_change_in_pre_serialize = TRUE; + +#if H5C_DO_MEMORY_SANITY_CHECKS + + HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + + image_len, + H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE)); + +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + + entry_ptr->image_up_to_date = TRUE; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__generate_image */ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 988dfff..8fd3e43 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -955,7 +955,7 @@ if ( ( (cache_ptr) == NULL ) || \ } #define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ + entry_ptr, was_clean) \ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len <= 0 ) || \ ( (cache_ptr)->index_size <= 0 ) || \ @@ -1125,7 +1125,7 @@ if ( ( (cache_ptr)->index_size != \ H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \ } -#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ +#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ { \ int k; \ int depth = 0; \ @@ -2351,7 +2351,16 @@ if ( ( (cache_ptr)->index_size != \ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ HDassert( (entry_ptr)->size > 0 ); \ HDassert( new_size > 0 ); \ - \ + \ + if ( (entry_ptr)->coll_access ) { \ + \ + H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (entry_ptr)->size, \ + (new_size)); \ + \ + } \ + \ if ( (entry_ptr)->is_pinned ) { \ \ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \ @@ -2701,6 +2710,252 @@ if ( ( (cache_ptr)->index_size != \ #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ +#ifdef H5_HAVE_PARALLEL + +#if H5C_DO_SANITY_CHECKS +#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ +if ( ( (hd_ptr) == NULL ) || \ + ( (tail_ptr) == NULL ) || \ + ( (entry_ptr) == NULL ) || \ + ( (len) <= 0 ) || \ + ( (Size) < (entry_ptr)->size ) || \ + ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \ + ( ( (entry_ptr)->coll_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \ + ( ( (entry_ptr)->coll_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \ + ( ( (len) == 1 ) && \ + ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \ + ( (entry_ptr)->coll_next == NULL ) && \ + ( (entry_ptr)->coll_prev == NULL ) && \ + ( (Size) == (entry_ptr)->size ) \ + ) \ + ) \ + ) \ + ) { \ + HDassert(0 && "coll DLL pre remove SC failed"); \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "coll DLL pre remove SC failed") \ +} + +#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ +if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ + ( (head_ptr) != (tail_ptr) ) \ + ) || \ + ( (len) < 0 ) || \ + ( (Size) < 0 ) || \ + ( ( (len) == 1 ) && \ + ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ + ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ + ) \ + ) || \ + ( ( (len) >= 1 ) && \ + ( ( (head_ptr) == NULL ) || ( (head_ptr)->coll_prev != NULL ) || \ + ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ + ) \ + ) \ + ) { \ + HDassert(0 && "COLL DLL sanity check failed"); \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL sanity check failed") \ +} + +#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ +if ( ( (entry_ptr) == NULL ) || \ + ( (entry_ptr)->coll_next != NULL ) || \ + ( (entry_ptr)->coll_prev != NULL ) || \ + ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ + ( (hd_ptr) != (tail_ptr) ) \ + ) || \ + ( (len) < 0 ) || \ + ( ( (len) == 1 ) && \ + ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ + ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \ + ) \ + ) || \ + ( ( (len) >= 1 ) && \ + ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->coll_prev != NULL ) || \ + ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ + ) \ + ) \ + ) { \ + HDassert(0 && "COLL DLL pre insert SC failed"); \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL pre insert SC failed") \ +} + +#else /* H5C_DO_SANITY_CHECKS */ + +#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) +#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) +#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) + +#endif /* H5C_DO_SANITY_CHECKS */ + + +#define H5C__COLL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ +{ \ + H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (tail_ptr)->coll_next = (entry_ptr); \ + (entry_ptr)->coll_prev = (tail_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__COLL_DLL_APPEND() */ + +#define H5C__COLL_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ +{ \ + H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)\ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (head_ptr)->coll_prev = (entry_ptr); \ + (entry_ptr)->coll_next = (head_ptr); \ + (head_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__COLL_DLL_PREPEND() */ + +#define H5C__COLL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ +{ \ + H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)\ + { \ + if ( (head_ptr) == (entry_ptr) ) \ + { \ + (head_ptr) = (entry_ptr)->coll_next; \ + if ( (head_ptr) != NULL ) \ + { \ + (head_ptr)->coll_prev = NULL; \ + } \ + } \ + else \ + { \ + (entry_ptr)->coll_prev->coll_next = (entry_ptr)->coll_next; \ + } \ + if ( (tail_ptr) == (entry_ptr) ) \ + { \ + (tail_ptr) = (entry_ptr)->coll_prev; \ + if ( (tail_ptr) != NULL ) \ + { \ + (tail_ptr)->coll_next = NULL; \ + } \ + } \ + else \ + { \ + (entry_ptr)->coll_next->coll_prev = (entry_ptr)->coll_prev; \ + } \ + entry_ptr->coll_next = NULL; \ + entry_ptr->coll_prev = NULL; \ + (len)--; \ + (Size) -= entry_ptr->size; \ + } \ +} /* H5C__COLL_DLL_REMOVE() */ + + +/*------------------------------------------------------------------------- + * + * Macro: H5C__INSERT_IN_COLL_LIST + * + * Purpose: Insert entry into collective entries list + * + * Return: N/A + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ + +#define H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + \ + /* insert the entry at the head of the list. */ \ + \ + H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ + \ +} /* H5C__INSERT_IN_COLL_LIST */ + + +/*------------------------------------------------------------------------- + * + * Macro: H5C__REMOVE_FROM_COLL_LIST + * + * Purpose: Remove entry from collective entries list + * + * Return: N/A + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ + +#define H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + \ + /* remove the entry from the list. */ \ + \ + H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ + \ +} /* H5C__REMOVE_FROM_COLL_LIST */ + + +/*------------------------------------------------------------------------- + * + * Macro: H5C__MOVE_TO_TOP_IN_COLL_LIST + * + * Purpose: Update entry position in collective entries list + * + * Return: N/A + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ + +#define H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + \ + /* Remove entry and insert at the head of the list. */ \ + H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ + \ + H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ + \ +} /* H5C__MOVE_TO_TOP_IN_COLL_LIST */ +#endif /* H5_HAVE_PARALLEL */ + /****************************/ /* Package Private Typedefs */ @@ -3658,6 +3913,14 @@ struct H5C_t { H5C_cache_entry_t * dLRU_head_ptr; H5C_cache_entry_t * dLRU_tail_ptr; +#ifdef H5_HAVE_PARALLEL + int32_t coll_list_len; + size_t coll_list_size; + H5C_cache_entry_t * coll_head_ptr; + H5C_cache_entry_t * coll_tail_ptr; + int32_t num_coll_entries; /* MSC - used only for debugging - should remove usage*/ +#endif /* H5_HAVE_PARALLEL */ + /* Fields for automatic cache size adjustment */ hbool_t size_increase_possible; hbool_t flash_size_increase_possible; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index a9ffb70..00644b1 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1532,6 +1532,8 @@ typedef struct H5C_cache_entry_t { hbool_t flush_me_collectively; hbool_t clear_on_unprotect; hbool_t flush_immediately; + hbool_t coll_access; + hbool_t ind_access_while_coll; #endif /* H5_HAVE_PARALLEL */ hbool_t flush_in_progress; hbool_t destroy_in_progress; @@ -1552,6 +1554,8 @@ typedef struct H5C_cache_entry_t { struct H5C_cache_entry_t * prev; struct H5C_cache_entry_t * aux_next; struct H5C_cache_entry_t * aux_prev; + struct H5C_cache_entry_t * coll_next; + struct H5C_cache_entry_t * coll_prev; #if H5C_COLLECT_CACHE_ENTRY_STATS /* cache entry stats fields */ @@ -1918,6 +1922,8 @@ H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id, int mpi_rank, int mpi_size); H5_DLL herr_t H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr); H5_DLL herr_t H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr); +H5_DLL herr_t H5C_clear_coll_entries(H5F_t * f, hid_t dxpl_id, + H5C_t * cache_ptr, hbool_t partial); #endif /* H5_HAVE_PARALLEL */ #ifndef NDEBUG /* debugging functions */ diff --git a/src/H5D.c b/src/H5D.c index f06ec9b..6acec6a 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -154,6 +154,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -182,15 +183,12 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, 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") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") @@ -246,6 +244,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -264,15 +263,12 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, 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") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* build and open the new dataset */ - if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ @@ -289,7 +285,7 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset") /* Decrement refcount on dataset's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -341,12 +337,9 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* 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") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up dataset location to fill in */ dset_loc.oloc = &oloc; @@ -383,7 +376,6 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't free location") } /* end else */ } /* end if */ - FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -979,10 +971,13 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Private function */ - if(H5D__set_extent(dset, size, H5AC_dxpl_id) < 0) + if(H5D__set_extent(dset, size, H5AC_coll_write_coll_read_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extend dataset") done: FUNC_LEAVE_API(ret_value) } /* end H5Dset_extent() */ + +/* LocalWords: buf + */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index af5123c..ca7bda5 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -45,6 +45,7 @@ /****************/ #define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ /***********/ @@ -56,6 +57,7 @@ #endif /* H5_HAVE_PARALLEL */ #include "H5Dpkg.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File functions */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -2497,6 +2499,9 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, /* Check for cached information */ if(!H5D__chunk_cinfo_cache_found(&dset->shared->cache.chunk.last, udata)) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ +#ifdef H5_HAVE_PARALLEL + H5P_coll_md_read_flag_t temp_flag; /* temp flag to hold the coll metadata read setting */ +#endif /* H5_HAVE_PARALLEL */ /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -2505,10 +2510,27 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, idx_info.layout = &dset->shared->layout.u.chunk; idx_info.storage = &dset->shared->layout.storage.u.chunk; +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) { + /* disable collective metadata read for chunk indexes + as it is highly unlikely that users would read the + same chunks from all processes. MSC - might turn on + for root node? */ + temp_flag = idx_info.f->coll_md_read; + idx_info.f->coll_md_read = H5P_FORCE_FALSE; + } +#endif /* H5_HAVE_PARALLEL */ + /* Go get the chunk information */ if((dset->shared->layout.storage.u.chunk.ops->get_addr)(&idx_info, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) { + idx_info.f->coll_md_read = temp_flag; + } +#endif /* H5_HAVE_PARALLEL */ + /* Cache the information retrieved */ H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, udata); } /* end if */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 3da6b95..dd02907 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -189,7 +189,8 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Build and open the new dataset */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, + dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ diff --git a/src/H5F.c b/src/H5F.c index d3b9fc8..f5b8e25 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -477,7 +477,8 @@ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t ret_value; /*return value */ + hid_t dxpl_id; /*dxpl used by library */ + hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); @@ -501,12 +502,10 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") - /* Check the file access property list */ - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* * Adjust bit flags by turning on the creation bit and making sure that @@ -520,7 +519,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* * Create a new file or truncate an existing file. */ - if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file */ @@ -583,7 +582,8 @@ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t ret_value; /*return value */ + hid_t dxpl_id; /*dxpl used by library */ + hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -595,14 +595,14 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if((flags & ~H5F_ACC_PUBLIC_FLAGS) || (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the file */ - if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") /* Get an atom for the file */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 5f36d2a..366a247 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1499,7 +1499,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had #endif /* Only look for MPI views for raw data transfers */ - if(type==H5FD_MEM_DRAW) { + if(type == H5FD_MEM_DRAW) { H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ /* Obtain the data transfer properties */ @@ -1765,6 +1765,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, int size_i; hbool_t use_view_this_time = FALSE; H5P_genplist_t *plist = NULL; /* Property list pointer */ + H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -1795,57 +1796,42 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, fprintf(stdout, "in H5FD_mpio_write mpi_off=%ld size_i=%d\n", (long)mpi_off, size_i); #endif - if(type == H5FD_MEM_DRAW) { - H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ - - /* Obtain the data transfer properties */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + /* Obtain the data transfer properties */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - /* get the transfer mode from the dxpl */ - if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") - /* - * Set up for a fancy xfer using complex types, or single byte block. We - * wouldn't need to rely on the use_view field if MPI semantics allowed - * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which - * could mean "use MPI_BYTE" by convention). - */ - if(xfer_mode == H5FD_MPIO_COLLECTIVE) { - MPI_Datatype file_type; + /* + * Set up for a fancy xfer using complex types, or single byte block. We + * wouldn't need to rely on the use_view field if MPI semantics allowed + * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which + * could mean "use MPI_BYTE" by convention). + */ + if(xfer_mode == H5FD_MPIO_COLLECTIVE) { + MPI_Datatype file_type; - /* Remember that views are used */ - use_view_this_time = TRUE; + /* Remember that views are used */ + use_view_this_time = TRUE; - /* prepare for a full-blown xfer using btype, ftype, and disp */ - if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") + /* prepare for a full-blown xfer using btype, ftype, and disp */ + if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") + if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - /* - * Set the file view when we are using MPI derived types - */ - if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) + /* + * Set the file view when we are using MPI derived types + */ + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) - /* When using types, use the address as the displacement for - * MPI_File_set_view and reset the address for the read to zero - */ - mpi_off = 0; - } /* end if */ - } /* end if */ - else { -#if 0 /* JRM -- 3/23/10 */ /* this is no longer always the case */ - /* Only one process can do the actual metadata write */ - if(file->mpi_rank != H5_PAR_META_WRITE) -#ifdef LATER - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't write metadata from non-zero rank") -#else /* LATER */ - HGOTO_DONE(SUCCEED) /* skip the actual write */ -#endif /* LATER */ -#endif /* JRM */ + /* When using types, use the address as the displacement for + * MPI_File_set_view and reset the address for the read to zero + */ + mpi_off = 0; } /* end if */ /* Write the data. */ @@ -1856,6 +1842,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); #endif + /* Get the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); /* get the transfer mode from the dxpl */ @@ -1871,6 +1858,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) } /* end if */ else { + if(type != H5FD_MEM_DRAW) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Metadata Coll opt property should be collective at this point") #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: doing MPI independent IO\n"); diff --git a/src/H5Fint.c b/src/H5Fint.c index 0e77349..0cf60b3 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -198,6 +198,10 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) efc_size = H5F_efc_max_nfiles(f->shared->efc); if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size") +#ifdef H5_HAVE_PARALLEL + if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") +#endif /* H5_HAVE_PARALLEL */ /* * Since we're resetting the driver ID and info, close them if they @@ -664,6 +668,10 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t if(efc_size > 0) if(NULL == (f->shared->efc = H5F_efc_create(efc_size))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't create external file cache") +#ifdef H5_HAVE_PARALLEL + if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata read flag") +#endif /* H5_HAVE_PARALLEL */ /* Get the VFD values to cache */ f->shared->maxaddr = H5FD_get_maxaddr(lf); diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 39b8dfa..9f7d316 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -77,6 +77,35 @@ #ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * Function: H5F_get_mpi_handle + * + * Purpose: Retrieves MPI File handle. + * + * Return: Success: The size (positive) + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle) +{ + herr_t ret_value = SUCCEED; + hid_t fapl = -1; + + FUNC_ENTER_NOAPI(FAIL) + + assert(f && f->shared); + + /* Dispatch to driver */ + if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl, (void **)f_handle)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_get_mpi_handle() */ + /*------------------------------------------------------------------------- * Function: H5F_mpi_get_rank diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 175fa88..63708b8 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -311,6 +311,9 @@ struct H5F_t { hbool_t closing; /* File is in the process of being closed */ struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ +#ifdef H5_HAVE_PARALLEL + H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ +#endif /* H5_HAVE_PARALLEL */ }; diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 36d7429..160740a 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -682,6 +682,7 @@ H5_DLL herr_t H5F_super_dirty(H5F_t *f); /* Parallel I/O (i.e. MPI) related routines */ #ifdef H5_HAVE_PARALLEL +H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f); H5_DLL int H5F_mpi_get_size(const H5F_t *f); diff --git a/src/H5G.c b/src/H5G.c index 8fd65b8..abf64e8 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -277,6 +277,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, { H5G_loc_t loc; /* Location to create group */ H5G_t *grp = NULL; /* New group created */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -302,15 +303,12 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -365,6 +363,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) H5G_loc_t loc; H5G_t *grp = NULL; H5G_obj_create_t gcrt_info; /* Information for group creation */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -381,12 +380,9 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; @@ -394,7 +390,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -409,7 +405,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object location of group") /* Decrement refcount on group's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -444,6 +440,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -455,15 +452,12 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the group */ - if((grp = H5G__open_name(&loc, name, gapl_id, H5AC_ind_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, gapl_id, dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the group */ @@ -677,6 +671,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -689,11 +684,10 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -701,12 +695,12 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_loc_reset(&grp_loc); /* Find the group object */ - if(H5G_loc_find(&loc, name, &grp_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, name, &grp_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -740,6 +734,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -757,11 +752,10 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -769,12 +763,13 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&grp_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &grp_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &grp_loc/*out*/, + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: diff --git a/src/H5L.c b/src/H5L.c index 73d363e..d443b56 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -315,6 +315,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -343,9 +344,13 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, else if(dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Move the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -373,6 +378,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -401,9 +407,13 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, else if(dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Copy the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -434,6 +444,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; /* Group location for new link */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -449,8 +460,12 @@ H5Lcreate_soft(const char *link_target, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create the link */ - if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -480,6 +495,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, { H5G_loc_t cur_loc, *cur_loc_p; H5G_loc_t new_loc, *new_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -510,9 +526,13 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, - lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -549,6 +569,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -563,8 +584,12 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create external link */ - if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -593,6 +618,7 @@ herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Group's location */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -604,8 +630,12 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Unlink */ - if(H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_delete(&loc, name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -638,6 +668,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group's location */ H5L_trav_rmbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -652,11 +683,10 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for unlink operation */ udata.idx_type = idx_type; @@ -665,7 +695,8 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, udata.dxpl_id = H5AC_dxpl_id; /* Traverse the group hierarchy to remove the link */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_delete_by_idx_cb, &udata, lapl_id, H5AC_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, + H5L_delete_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") done: @@ -697,6 +728,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Group location for location to query */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -707,14 +739,13 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link value */ - if(H5L_get_val(&loc, name, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_val(&loc, name, buf, size, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value for '%s'", name) done: @@ -747,6 +778,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5G_loc_t loc; /* Group location for location to query */ H5L_trav_gvbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -762,22 +794,22 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for retrieving information */ udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.buf = buf; udata.size = size; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, + &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") @@ -803,6 +835,7 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value; FUNC_ENTER_API(FAIL) @@ -813,14 +846,13 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ - if((ret_value = H5L_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5L_exists(&loc, name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -847,6 +879,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -857,14 +890,13 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link information */ - if(H5L_get_info(&loc, name, linfo, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_info(&loc, name, linfo, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -893,6 +925,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group location for group to query */ H5L_trav_gibi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -908,21 +941,21 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.linfo = linfo; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, + H5L_get_info_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") @@ -1082,6 +1115,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Location of group */ H5L_trav_gnbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1097,23 +1131,23 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.name = name; udata.size = size; udata.name_len = -1; /* Traverse the group hierarchy to locate the link to get name of */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, + H5L_get_name_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") /* Set the return value */ @@ -1179,7 +1213,8 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, + op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1221,6 +1256,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1236,11 +1272,10 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up iteration beginning/end info */ idx = (idx_p == NULL ? 0 : *idx_p); @@ -1251,7 +1286,8 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, + op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1353,6 +1389,7 @@ herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) { + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1368,14 +1405,13 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") done: diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index ae13e6b..78ac6f5 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -553,6 +553,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, size_t file_name_len; /* Length of file name string */ size_t norm_obj_name_len; /* Length of normalized object name string */ uint8_t *p; /* Pointer into external link buffer */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -587,8 +588,12 @@ H5Lcreate_external(const char *file_name, const char *obj_name, p += file_name_len; HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create an external link */ - if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: diff --git a/src/H5O.c b/src/H5O.c index d0ace29..b89636b 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -282,6 +282,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = FAIL; @@ -297,11 +298,10 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -309,12 +309,12 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -426,6 +426,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, { H5G_loc_t new_loc; H5G_loc_t obj_loc; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -448,8 +449,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Link to the object */ - if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -556,6 +561,7 @@ htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location info */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -566,14 +572,13 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check if the object exists */ - if((ret_value = H5G_loc_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_exists(&loc, name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -635,6 +640,7 @@ herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -647,14 +653,13 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's information */ - if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") done: @@ -685,6 +690,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -702,11 +708,10 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -714,7 +719,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; @@ -792,6 +797,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -802,14 +808,13 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, name, comment, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_set_comment(&loc, name, comment, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") done: @@ -876,6 +881,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -886,14 +892,13 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") done: @@ -995,6 +1000,7 @@ herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1010,14 +1016,13 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal object visitation routine */ - if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") done: @@ -1346,7 +1351,7 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index b5bc720..acd30c8 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -168,6 +168,12 @@ #define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE sizeof(uint32_t) #define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF 0 +/* Definition for reading metadata collectively */ +#define H5D_XFER_COLL_MD_READ_SIZE sizeof(H5P_coll_md_read_flag_t) +#define H5D_XFER_COLL_MD_READ_DEF H5P_USER_FALSE +#define H5D_XFER_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t +#define H5D_XFER_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t + /******************/ /* Local Typedefs */ /******************/ @@ -271,6 +277,7 @@ static const hbool_t H5D_def_direct_chunk_flag_g = H5D_XFER_DIRECT_CHUNK_WRITE_F static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF; /* Default value for the filters of direct chunk write */ static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */ static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */ +static const H5P_coll_md_read_flag_t H5D_def_coll_md_read_g = H5D_XFER_COLL_MD_READ_DEF; /* Default setting for the collective metedata read flag */ /*------------------------------------------------------------------------- @@ -465,6 +472,13 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the metadata collective read flag */ + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5D_XFER_COLL_MD_READ_SIZE, + &H5D_def_coll_md_read_g, + NULL, NULL, NULL, H5D_XFER_COLL_MD_READ_ENC, H5D_XFER_COLL_MD_READ_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index bd0a260..bb9f3be 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -793,7 +793,7 @@ H5P__decode(const void *buf) HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "property decoding routine failed, property: '%s'", name) } /* end if */ else - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s', name") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s'", name) /* Set the value for the property */ if(H5P_set(plist, name, value_buf) < 0) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 6b3d4ac..de5f8bf 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -170,6 +170,12 @@ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF 524288 #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t +/* Definition of collective metadata read mode flag */ +#define H5F_ACS_COLL_MD_READ_FLAG_SIZE sizeof(H5P_coll_md_read_flag_t) +#define H5F_ACS_COLL_MD_READ_FLAG_DEF H5P_USER_FALSE +#define H5F_ACS_COLL_MD_READ_FLAG_ENC H5P__encode_coll_md_read_flag_t +#define H5F_ACS_COLL_MD_READ_FLAG_DEC H5P__decode_coll_md_read_flag_t + /******************/ /* Local Typedefs */ @@ -261,6 +267,7 @@ static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */ static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ +static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ /*------------------------------------------------------------------------- @@ -422,6 +429,13 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the metadata collective read flag */ + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, + &H5F_def_coll_md_read_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_facc_reg_prop() */ @@ -3083,3 +3097,166 @@ done: FUNC_LEAVE_API(ret_value) } + +/*------------------------------------------------------------------------- + * Function: H5P__encode_coll_md_read_flag_t + * + * Purpose: Generic encoding callback routine for 'coll_md_read_flag' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) +{ + const H5P_coll_md_read_flag_t *coll_md_read_flag = (const H5P_coll_md_read_flag_t *)value; + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(coll_md_read_flag); + HDassert(size); + + if(NULL != *pp) { + /* Encode the value */ + HDmemcpy(*pp, coll_md_read_flag, sizeof(H5P_coll_md_read_flag_t)); + *pp += sizeof(H5P_coll_md_read_flag_t); + } /* end if */ + + /* Set size needed for encoding */ + *size += sizeof(H5P_coll_md_read_flag_t); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_coll_md_read_flag_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_coll_md_read_flag_t + * + * Purpose: Generic decoding callback routine for 'coll_md_read_flag' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) +{ + H5P_coll_md_read_flag_t *coll_md_read_flag = (H5P_coll_md_read_flag_t *)_value; /* File close degree */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(coll_md_read_flag); + + /* Decode file close degree */ + *coll_md_read_flag = (H5P_coll_md_read_flag_t)*(*pp); + *pp += sizeof(H5P_coll_md_read_flag_t); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__decode_coll_md_read_flag_t() */ + +#ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * Function: H5Pset_coll_metadata_read + * + * Purpose: Tell the library whether the metadata read operations will + * be done collectively (1) or not (0). Default is independent. With + * collective mode, the library will optimize access to metdata + * operations on the file. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", plist_id, is_collective); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + + /* set property to either TRUE if > 0, or FALSE otherwise */ + if(is_collective > 0) + is_collective = TRUE; + else + is_collective = FALSE; + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set values */ + if(H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pset_coll_metadata_read */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_coll_metadata_read + * + * Purpose: Gets information about collective metadata read mode. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective) +{ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*b", plist_id, is_collective); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + + /* Get value */ + if(is_collective) { + H5P_coll_md_read_flag_t internal_flag; /* property setting. we need to convert to either TRUE or FALSE */ + H5P_genplist_t *plist; /* Property list pointer */ + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &internal_flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag") + + if(internal_flag < 0) + *is_collective = FALSE; + else + *is_collective = (hbool_t)internal_flag; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pget_coll_metadata_read */ +#endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Pint.c b/src/H5Pint.c index e25b686..50a9b2e 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -32,6 +32,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ @@ -124,6 +125,8 @@ hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL; H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL; hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL; H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL; +hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = FAIL; +H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g = NULL; hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL; H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL; hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL; @@ -148,6 +151,7 @@ hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL; hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL; hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL; hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL; +hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = FAIL; hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL; hid_t H5P_LST_LINK_CREATE_ID_g = FAIL; hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL; @@ -171,6 +175,26 @@ const H5P_libclass_t H5P_CLS_ROOT[1] = {{ NULL /* Class close callback info */ }}; +/* Attribute access property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_AACC[1] = {{ + "attribute access", /* Class name for debugging */ + H5P_TYPE_ATTRIBUTE_ACCESS, /* Class type */ + + &H5P_CLS_LINK_ACCESS_g, /* Parent class */ + &H5P_CLS_ATTRIBUTE_ACCESS_g, /* Pointer to class */ + &H5P_CLS_ATTRIBUTE_ACCESS_ID_g, /* Pointer to class ID */ + &H5P_LST_ATTRIBUTE_ACCESS_ID_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + /* Group access property list class library initialization object */ /* (move to proper source code file when used for real) */ const H5P_libclass_t H5P_CLS_GACC[1] = {{ @@ -282,6 +306,7 @@ static H5P_libclass_t const * const init_class[] = { H5P_CLS_TCRT, /* Datatype creation */ H5P_CLS_TACC, /* Datatype access */ H5P_CLS_ACRT, /* Attribute creation */ + H5P_CLS_AACC, /* Attribute access */ H5P_CLS_LCRT /* Link creation */ }; @@ -544,6 +569,7 @@ H5P_term_interface(void) H5P_LST_DATATYPE_CREATE_ID_g = H5P_LST_DATATYPE_ACCESS_ID_g = H5P_LST_ATTRIBUTE_CREATE_ID_g = + H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5P_LST_OBJECT_COPY_ID_g = H5P_LST_LINK_CREATE_ID_g = H5P_LST_LINK_ACCESS_ID_g = @@ -570,6 +596,7 @@ H5P_term_interface(void) H5P_CLS_DATATYPE_ACCESS_g = H5P_CLS_STRING_CREATE_g = H5P_CLS_ATTRIBUTE_CREATE_g = + H5P_CLS_ATTRIBUTE_ACCESS_g = H5P_CLS_OBJECT_COPY_g = H5P_CLS_LINK_CREATE_g = H5P_CLS_LINK_ACCESS_g = @@ -588,6 +615,7 @@ H5P_term_interface(void) H5P_CLS_DATATYPE_ACCESS_ID_g = H5P_CLS_STRING_CREATE_ID_g = H5P_CLS_ATTRIBUTE_CREATE_ID_g = + H5P_CLS_ATTRIBUTE_ACCESS_ID_g = H5P_CLS_OBJECT_COPY_ID_g = H5P_CLS_LINK_CREATE_ID_g = H5P_CLS_LINK_ACCESS_ID_g = @@ -1180,7 +1208,7 @@ H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name) /* Check if the property has been deleted from list */ if(H5SL_search(plist->del,name) != NULL) { - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "property deleted from skip list") } /* end if */ else { /* Get the property data from the skip list */ @@ -5015,7 +5043,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDcompile_assert(H5P_TYPE_LINK_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); + HDcompile_assert(H5P_TYPE_ATTRIBUTE_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS); /* Check arguments */ @@ -5078,6 +5106,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type) class_id = H5P_CLS_ATTRIBUTE_CREATE_ID_g; break; + case H5P_TYPE_ATTRIBUTE_ACCESS: + class_id = H5P_CLS_ATTRIBUTE_ACCESS_ID_g; + break; + case H5P_TYPE_OBJECT_COPY: class_id = H5P_CLS_OBJECT_COPY_ID_g; break; @@ -5165,3 +5197,39 @@ H5P_get_class(const H5P_genplist_t *plist) FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ +herr_t +H5P_verify_and_set_dxpl(hid_t *acspl_id, hid_t pclass_id, hid_t default_id, hid_t *dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(acspl_id); + + /* Check the access property list */ + if(H5P_DEFAULT == *acspl_id) + *acspl_id = default_id; + + if(TRUE != H5P_isa_class(*acspl_id, pclass_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Not the required access property list") + + if(dxpl_id) { + H5P_coll_md_read_flag_t is_collective; + H5P_genplist_t *plist; /* Property list pointer */ + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(*acspl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag") + + if(TRUE == is_collective && *dxpl_id == H5AC_dxpl_id) + *dxpl_id = H5AC_coll_write_coll_read_dxpl_id; + else if(TRUE == is_collective && *dxpl_id == H5AC_ind_dxpl_id) + *dxpl_id = H5AC_ind_write_coll_read_dxpl_id; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_verify_and_set_dxpl */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index e3b3c4f..ed81acb 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -82,6 +82,11 @@ #define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t) #define H5L_ACS_ELINK_CB_DEF {NULL,NULL} +/* Definition for reading metadata collectively */ +#define H5L_ACS_COLL_MD_READ_SIZE sizeof(H5P_coll_md_read_flag_t) +#define H5L_ACS_COLL_MD_READ_DEF H5P_USER_FALSE +#define H5L_ACS_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t +#define H5L_ACS_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t /******************/ /* Local Typedefs */ @@ -154,7 +159,7 @@ static const char *H5L_def_elink_prefix_g = H5L_ACS_ELINK_PREFIX_DEF; /* Default static const hid_t H5L_def_fapl_id_g = H5L_ACS_ELINK_FAPL_DEF; /* Default fapl for external link access */ static const unsigned H5L_def_elink_flags_g = H5L_ACS_ELINK_FLAGS_DEF; /* Default file access flags for external link traversal */ static const H5L_elink_cb_t H5L_def_elink_cb_g = H5L_ACS_ELINK_CB_DEF; /* Default external link traversal callback */ - +static const H5P_coll_md_read_flag_t H5L_def_coll_md_read_g = H5L_ACS_COLL_MD_READ_DEF; /* Default setting for the collective metedata read flag */ /*------------------------------------------------------------------------- @@ -210,6 +215,13 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the metadata collective read flag */ + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, + &H5L_def_coll_md_read_g, + NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_lacc_reg_prop() */ @@ -1172,5 +1184,3 @@ H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data) done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_elink_cb() */ - - diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 2942a4d..1bf4465 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -221,6 +221,8 @@ H5_DLL herr_t H5P__decode_unsigned(const void **_pp, void *value); H5_DLL herr_t H5P__decode_uint8_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_hbool_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_double(const void **_pp, void *value); +H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value); /* Private OCPL routines */ H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter, diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 7233818..81e1f40 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -46,6 +46,14 @@ /* Library Private Typedefs */ /****************************/ +#define H5_COLL_MD_READ_FLAG_NAME "collective_metadata_read" + +typedef enum H5P_coll_md_read_flag_t { + H5P_FORCE_FALSE = -1, + H5P_USER_FALSE = 0, + H5P_USER_TRUE = 1 +} H5P_coll_md_read_flag_t; + /* Forward declarations (for prototypes & type definitions) */ struct H5O_fill_t; struct H5T_t; @@ -73,6 +81,7 @@ typedef enum H5P_plist_type_t { H5P_TYPE_OBJECT_COPY = 15, H5P_TYPE_LINK_CREATE = 16, H5P_TYPE_LINK_ACCESS = 17, + H5P_TYPE_ATTRIBUTE_ACCESS = 18, H5P_TYPE_MAX_TYPE } H5P_plist_type_t; @@ -94,6 +103,7 @@ H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g; +H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_OBJECT_COPY_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_ACCESS_g; @@ -162,5 +172,6 @@ H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist, H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const struct H5T_t *type, void *value, hid_t dxpl_id); +H5_DLL herr_t H5P_verify_and_set_dxpl(hid_t *acspl_id, hid_t pclass_id, hid_t default_id, hid_t *dxpl_id); #endif /* _H5Pprivate_H */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index f56692c..84fa243 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -66,6 +66,7 @@ #define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g) #define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g) #define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g) #define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g) @@ -84,6 +85,7 @@ #define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g) #define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g) #define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g) #define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g) @@ -189,6 +191,7 @@ H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_STRING_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g; +H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g; @@ -206,6 +209,7 @@ H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g; +H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g; @@ -348,6 +352,10 @@ H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); +#ifdef H5_HAVE_PARALLEL +H5_DLL herr_t H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective); +H5_DLL herr_t H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective); +#endif /* H5_HAVE_PARALLEL */ /* Dataset creation property list (DCPL) routines */ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout); diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 024cc83..7508dbb 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -124,6 +124,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, { H5G_loc_t loc; /* Location to create datatype */ H5T_t *type; /* Datatype for ID */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -151,15 +152,12 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ - if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, H5AC_dxpl_id) < 0) + if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: @@ -273,6 +271,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Group location for location */ H5T_t *type = NULL; /* Datatype created */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -291,15 +290,12 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ - if(H5T__commit(loc.oloc->file, type, tcpl_id, H5AC_dxpl_id) < 0) + if(H5T__commit(loc.oloc->file, type, tcpl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Release the datatype's object header */ @@ -311,7 +307,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get object location of committed datatype") /* Decrement refcount on committed datatype's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -570,12 +566,9 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up datatype location to fill in */ type_loc.oloc = &oloc; diff --git a/src/Makefile.in b/src/Makefile.in index f546f2f..6dcba84 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -723,7 +723,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 212 +LT_VERS_REVISION = 211 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 18140ad..eb73fc3 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7145,6 +7145,269 @@ trace_file_check(int metadata_write_strategy) /***************************************************************************** * + * Function: smoke_check_6() + * + * Purpose: Sixth smoke check for the parallel cache. + * + * Use random reads to vary the loads on the diffferent + * processors. Also force different cache size adjustments. + * + * In this test, load process 0 heavily, and the other + * processes lightly. + * + * Return: Success: TRUE + * + * Failure: FALSE + * + * Programmer: JRM -- 1/13/06 + * + *****************************************************************************/ +static hbool_t +smoke_check_6(int metadata_write_strategy) +{ + hbool_t success = TRUE; + int i; + int max_nerrors; + int min_count; + int max_count; + int min_idx; + int max_idx; + hid_t fid = -1; + H5F_t * file_ptr = NULL; + H5C_t * cache_ptr = NULL; + struct mssg_t mssg; + + switch ( metadata_write_strategy ) { + + case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: + if ( world_mpi_rank == 0 ) { + TESTING("smoke check #6 -- process 0 only md write strategy"); + } + break; + + case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: + if ( world_mpi_rank == 0 ) { + TESTING("smoke check #6 -- distributed md write strategy"); + } + break; + + default: + if ( world_mpi_rank == 0 ) { + TESTING("smoke check #6 -- unknown md write strategy"); + } + break; + } + + nerrors = 0; + init_data(); + reset_stats(); + + if ( world_mpi_rank == world_server_mpi_rank ) { + + if ( ! server_main() ) { + + /* some error occured in the server -- report failure */ + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: server_main() failed.\n", + world_mpi_rank, FUNC); + } + } + } + else /* run the clients */ + { + int temp; + + if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr, + metadata_write_strategy) ) { + + nerrors++; + fid = -1; + cache_ptr = NULL; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", + world_mpi_rank, FUNC); + } + } + + min_count = 100 / ((file_mpi_rank + 1) * (file_mpi_rank + 1)); + max_count = min_count + 50; + + temp = virt_num_data_entries; + virt_num_data_entries = NUM_DATA_ENTRIES; + + /* insert the first half collectively */ + file_ptr->coll_md_read = H5P_USER_TRUE; + for ( i = 0; i < virt_num_data_entries/2; i++ ) + { + struct datum * entry_ptr; + entry_ptr = &(data[i]); + + insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET); + + if(TRUE != entry_ptr->header.coll_access) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Entry inserted not marked as collective.\n", + world_mpi_rank, FUNC); + } + } + + /* Make sure coll entries do not cross the 80% threshold */ + HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + } + + /* insert the other half independently */ + file_ptr->coll_md_read = H5P_USER_FALSE; + for ( i = virt_num_data_entries/2; i < virt_num_data_entries; i++ ) + { + struct datum * entry_ptr; + entry_ptr = &(data[i]); + + insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET); + + if(FALSE != entry_ptr->header.coll_access) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Entry inserted indepedently marked as collective.\n", + world_mpi_rank, FUNC); + } + } + + /* Make sure coll entries do not cross the 80% threshold */ + HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + } + + /* flush the file */ + if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", + world_mpi_rank, FUNC); + } + } + + /* Protect the first half of the entries collectively */ + file_ptr->coll_md_read = H5P_USER_TRUE; + for ( i = 0; i < (virt_num_data_entries / 2); i++ ) + { + struct datum * entry_ptr; + entry_ptr = &(data[i]); + + lock_entry(file_ptr, i); + + if(TRUE != entry_ptr->header.coll_access) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Entry protected not marked as collective.\n", + world_mpi_rank, FUNC); + } + } + + /* Make sure coll entries do not cross the 80% threshold */ + HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + } + + /* protect the other half independently */ + file_ptr->coll_md_read = H5P_USER_FALSE; + for ( i = virt_num_data_entries/2; i < virt_num_data_entries; i++ ) + { + struct datum * entry_ptr; + entry_ptr = &(data[i]); + + lock_entry(file_ptr, i); + + if(FALSE != entry_ptr->header.coll_access) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Entry inserted indepedently marked as collective.\n", + world_mpi_rank, FUNC); + } + } + + /* Make sure coll entries do not cross the 80% threshold */ + HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + } + + for ( i = 0; i < (virt_num_data_entries); i++ ) + { + unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET); + } + + if ( fid >= 0 ) { + + if ( ! take_down_cache(fid) ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", + world_mpi_rank, FUNC); + } + } + } + + /* verify that all instances of datum are back where the started + * and are clean. + */ + + for ( i = 0; i < NUM_DATA_ENTRIES; i++ ) + { + HDassert( data_index[i] == i ); + HDassert( ! (data[i].dirty) ); + } + + /* compose the done message */ + mssg.req = DONE_REQ_CODE; + mssg.src = world_mpi_rank; + mssg.dest = world_server_mpi_rank; + mssg.mssg_num = -1; /* set by send function */ + mssg.base_addr = 0; /* not used */ + mssg.len = 0; /* not used */ + mssg.ver = 0; /* not used */ + mssg.count = 0; /* not used */ + mssg.magic = MSSG_MAGIC; + + if ( success ) { + + + success = send_mssg(&mssg, FALSE); + + if ( ! success ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", + world_mpi_rank, FUNC); + } + } + } + virt_num_data_entries = temp; + } + + max_nerrors = get_max_nerrors(); + + if ( world_mpi_rank == 0 ) { + + if ( max_nerrors == 0 ) { + + PASSED(); + + } else { + + failures++; + H5_FAILED(); + } + } + + success = ( ( success ) && ( max_nerrors == 0 ) ); + + return(success); + +} /* smoke_check_6() */ + + +/***************************************************************************** + * * Function: main() * * Purpose: Main function for the parallel cache test. @@ -7250,6 +7513,15 @@ main(int argc, char **argv) } } + if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + world_mpi_rank, FUNC); + } + } + /* fix the file names */ for ( u = 0; u < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++u ) { @@ -7294,6 +7566,14 @@ main(int argc, char **argv) world_mpi_rank, FUNC); } } + if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + world_mpi_rank, FUNC); + } + } } setup_rand(); @@ -7315,6 +7595,7 @@ main(int argc, char **argv) #if 1 server_smoke_check(); #endif + #if 1 smoke_check_1(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_1(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7323,6 +7604,18 @@ main(int argc, char **argv) smoke_check_2(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_2(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif + /* MSC - smoke check 3 and 4 do independent reads, so we disable + the collective metadata read property here */ + if ( world_mpi_rank != world_server_mpi_rank ) { + if ( H5Pset_coll_metadata_read(fapl, 0) < 0 ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + world_mpi_rank, FUNC); + } + } + } #if 1 smoke_check_3(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_3(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7331,10 +7624,27 @@ main(int argc, char **argv) smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif + /* re-enable the collective metadata read property */ + if ( world_mpi_rank != world_server_mpi_rank ) { + if ( H5Pset_coll_metadata_read(fapl, 0) < 0 ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + world_mpi_rank, FUNC); + } + } + } #if 1 smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif + +#if 1 + smoke_check_6(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); + smoke_check_6(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); +#endif + #if 1 trace_file_check(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); trace_file_check(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7368,4 +7678,3 @@ finish: /* cannot just return (failures) because exit code is limited to 1byte */ return(failures != 0); } - diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index f294b93..f718f5b 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -888,6 +888,7 @@ void independent_group_read(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); + H5Pset_coll_metadata_read(plist, 0); fid = H5Fopen(filename, H5F_ACC_RDONLY, plist); H5Pclose(plist); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 9088470..24e88b0 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4948,6 +4948,8 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); + ret = H5Pset_coll_metadata_read(ret_pl, 1); + VRFY((ret >= 0), ""); return(ret_pl); } diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index c3da73f..e2615b0 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -272,6 +272,8 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); + ret = H5Pset_coll_metadata_read(ret_pl, 1); + VRFY((ret >= 0), ""); return(ret_pl); } -- cgit v0.12 From f56008e0fe0c6bce99205911d05dd4396baf6952 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 22 Jun 2015 10:54:43 -0500 Subject: [svn-r27264] some cleanups. --- src/H5AC.c | 6 +++--- src/H5C.c | 48 +++++++++++++----------------------------------- src/H5Cpkg.h | 7 ------- src/H5Cprivate.h | 3 +-- testpar/t_cache.c | 7 +------ 5 files changed, 18 insertions(+), 53 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 446e58c..aa35ed8 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -617,7 +617,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL /* destroying the cache, so clear all collective entries */ - if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0) + if(H5C_clear_coll_entries(f->shared->cache, 0) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") aux_ptr = (struct H5AC_aux_t *)(f->shared->cache->aux_ptr); @@ -759,7 +759,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL /* flushing the cache, so clear all collective entries */ - if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0) + if(H5C_clear_coll_entries(f->shared->cache, 0) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */ @@ -4341,7 +4341,7 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu evicted later. All ranks are guranteed to mark the same entires since we don't modify the order of the collectively accessed entries except through collective access. */ - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, TRUE) < 0) + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") switch(aux_ptr->metadata_write_strategy) { diff --git a/src/H5C.c b/src/H5C.c index 05b4299..4c83f22 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -698,7 +698,6 @@ H5C_apply_candidate_list(H5F_t * f, ranks. */ if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - cache_ptr->num_coll_entries --; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } } /* end else */ @@ -1460,7 +1459,6 @@ H5C_create(size_t max_cache_size, cache_ptr->coll_list_size = (size_t)0; cache_ptr->coll_head_ptr = NULL; cache_ptr->coll_tail_ptr = NULL; - cache_ptr->num_coll_entries = 0; #endif /* H5_HAVE_PARALLEL */ cache_ptr->cLRU_list_len = 0; @@ -3277,19 +3275,18 @@ H5C_insert_entry(H5F_t * f, entry_ptr->coll_access = coll_access; if(coll_access) { //fprintf(stderr, "NEW (%llu, %s)\n", addr, entry_ptr->type->name); - cache_ptr->num_coll_entries ++; H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL) /* Make sure the size of the collective entries in the cache remain in check */ if(H5P_USER_TRUE == f->coll_md_read) { if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) { - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") } } else { if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) { - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") } } @@ -3479,7 +3476,6 @@ H5C_mark_entries_as_clean(H5F_t * f, */ if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - cache_ptr->num_coll_entries --; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } @@ -4338,7 +4334,6 @@ H5C_protect(H5F_t * f, HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) entry_ptr->coll_access = TRUE; - cache_ptr->num_coll_entries ++; //fprintf(stderr, "ONLY INSERT (%llu, %s)\n", addr, entry_ptr->type->name); H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) @@ -4395,7 +4390,6 @@ H5C_protect(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { if(entry_ptr->coll_access) { - cache_ptr->num_coll_entries ++; //fprintf(stderr, "LOAD and INSERT (%llu, %s)\n", addr, entry_ptr->type->name); H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) } @@ -4693,14 +4687,14 @@ H5C_protect(H5F_t * f, //fprintf(stderr, "COLL entries size = %zu, MAX = %zu\n", cache_ptr->coll_list_size, cache_ptr->max_cache_size); if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) { //fprintf(stderr, "COLL entries at 80.. CLEARING\n"); - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") } } else { if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) { //fprintf(stderr, "COLL entries at 40.. CLEARING\n"); - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") } } @@ -10569,7 +10563,6 @@ H5C_make_space_in_cache(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - cache_ptr->num_coll_entries --; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } @@ -10596,7 +10589,6 @@ H5C_make_space_in_cache(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - cache_ptr->num_coll_entries --; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } @@ -11671,7 +11663,8 @@ done: * * Function: H5C_clear_coll_entries * - * Purpose: + * Purpose: Clear half or the entire list of collective entries and + * mark them as independent. * * Return: FAIL if error is detected, SUCCEED otherwise. * @@ -11681,45 +11674,30 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_clear_coll_entries(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5C_t * cache_ptr, - hbool_t partial) +H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial) { - int32_t list_len, coll_entries_cleared = 0, coll_dirty_entries=0; + int32_t list_len, coll_entries_cleared = 0; H5C_cache_entry_t * entry_ptr = NULL; H5C_cache_entry_t * prev_ptr; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - //fprintf(stderr, "List len = %d, NUM coll entries = %d\n", cache_ptr->coll_list_len, cache_ptr->num_coll_entries); entry_ptr = cache_ptr->coll_tail_ptr; list_len = cache_ptr->coll_list_len; + while(entry_ptr && (coll_entries_cleared < (partial ? list_len/2 : list_len))) { prev_ptr = entry_ptr->coll_prev; HDassert(entry_ptr->coll_access); - if(entry_ptr->is_dirty && partial && 0) { - coll_dirty_entries ++; - //fprintf(stderr, "%d: %llu Coll entry is Dirty\n", mpi_rank, entry_ptr->addr); - } - else { - entry_ptr->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - coll_entries_cleared ++; - //fprintf(stderr, "Cleared %llu Coll entries Cleaned = %d\n", entry_ptr->addr, coll_entries_cleared); - } + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + coll_entries_cleared ++; + entry_ptr = prev_ptr; } - //fprintf(stderr, "NUM COLL entries = %d, CLEARED %d, Dirty %d\n", - //cache_ptr->num_coll_entries, coll_entries_cleared, coll_dirty_entries); - - cache_ptr->num_coll_entries -= coll_entries_cleared; - //fprintf(stderr, "NUM COLL entries = %d, NUM COLL dirty entries = %d\n", cache_ptr->num_coll_entries, coll_dirty_entries); - HDassert(cache_ptr->coll_list_len == cache_ptr->num_coll_entries); - //HDassert(0 == coll_dirty_entries - cache_ptr->num_coll_entries); - done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_clear_coll_entries */ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 8fd3e43..3e15bca 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -2833,9 +2833,7 @@ if ( ( (entry_ptr) == NULL ) || \ { \ (head_ptr) = (entry_ptr)->coll_next; \ if ( (head_ptr) != NULL ) \ - { \ (head_ptr)->coll_prev = NULL; \ - } \ } \ else \ { \ @@ -2845,14 +2843,10 @@ if ( ( (entry_ptr) == NULL ) || \ { \ (tail_ptr) = (entry_ptr)->coll_prev; \ if ( (tail_ptr) != NULL ) \ - { \ (tail_ptr)->coll_next = NULL; \ - } \ } \ else \ - { \ (entry_ptr)->coll_next->coll_prev = (entry_ptr)->coll_prev; \ - } \ entry_ptr->coll_next = NULL; \ entry_ptr->coll_prev = NULL; \ (len)--; \ @@ -3918,7 +3912,6 @@ struct H5C_t { size_t coll_list_size; H5C_cache_entry_t * coll_head_ptr; H5C_cache_entry_t * coll_tail_ptr; - int32_t num_coll_entries; /* MSC - used only for debugging - should remove usage*/ #endif /* H5_HAVE_PARALLEL */ /* Fields for automatic cache size adjustment */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 00644b1..9e29a7f 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1922,8 +1922,7 @@ H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id, int mpi_rank, int mpi_size); H5_DLL herr_t H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr); H5_DLL herr_t H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr); -H5_DLL herr_t H5C_clear_coll_entries(H5F_t * f, hid_t dxpl_id, - H5C_t * cache_ptr, hbool_t partial); +H5_DLL herr_t H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial); #endif /* H5_HAVE_PARALLEL */ #ifndef NDEBUG /* debugging functions */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index eb73fc3..8bbc33c 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -501,6 +501,7 @@ static hbool_t smoke_check_2(int metadata_write_strategy); static hbool_t smoke_check_3(int metadata_write_strategy); static hbool_t smoke_check_4(int metadata_write_strategy); static hbool_t smoke_check_5(int metadata_write_strategy); +static hbool_t smoke_check_6(int metadata_write_strategy); static hbool_t trace_file_check(int metadata_write_strategy); @@ -7149,12 +7150,6 @@ trace_file_check(int metadata_write_strategy) * * Purpose: Sixth smoke check for the parallel cache. * - * Use random reads to vary the loads on the diffferent - * processors. Also force different cache size adjustments. - * - * In this test, load process 0 heavily, and the other - * processes lightly. - * * Return: Success: TRUE * * Failure: FALSE -- cgit v0.12 From e8dc2c232da25eb914ea41303bd15fe81e45564f Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 25 Aug 2015 08:37:28 -0500 Subject: [svn-r27573] fix serial build. --- src/H5C.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/H5C.c b/src/H5C.c index 08c2b9a..528a142 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -7756,7 +7756,9 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ else destroy_entry = destroy; +#ifdef H5_HAVE_PARALLEL HDassert(FALSE == entry_ptr->coll_access); +#endif /* we will write the entry to disk if it exists, is dirty, and if the * clear only flag is not set. @@ -9023,10 +9025,12 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; +#ifdef H5_HAVE_PARALLEL if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } +#endif if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") @@ -9045,10 +9049,12 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr->entries_scanned_to_make_space++; #endif /* H5C_COLLECT_CACHE_STATS */ +#ifdef H5_HAVE_PARALLEL if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } +#endif if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") -- cgit v0.12 From 0286bb12de563c6aeb1b9d0c5be4afe717305477 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 25 Aug 2015 10:55:57 -0500 Subject: [svn-r27576] - mark the entry as indepndent when expunged. - disable the metadata coll hint for smoke checks 1 & 2. --- src/H5C.c | 6 ++++++ testpar/t_cache.c | 24 ++---------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/H5C.c b/src/H5C.c index 528a142..b26bd93 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -966,6 +966,12 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected.") if(entry_ptr->is_pinned) HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned.") +#ifdef H5_HAVE_PARALLEL + if(entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } +#endif /* H5_HAVE_PARALLEL */ /* If we get this far, call H5C__flush_single_entry() with the * H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG. diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 8072215..191cd87 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7561,14 +7561,6 @@ main(int argc, char **argv) world_mpi_rank, FUNC); } } - if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { - - nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", - world_mpi_rank, FUNC); - } - } } setup_rand(); @@ -7599,18 +7591,6 @@ main(int argc, char **argv) smoke_check_2(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_2(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif - /* MSC - smoke check 3 and 4 do independent reads, so we disable - the collective metadata read property here */ - if ( world_mpi_rank != world_server_mpi_rank ) { - if ( H5Pset_coll_metadata_read(fapl, 0) < 0 ) { - - nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", - world_mpi_rank, FUNC); - } - } - } #if 1 smoke_check_3(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_3(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7619,9 +7599,9 @@ main(int argc, char **argv) smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif - /* re-enable the collective metadata read property */ + /* enable the collective metadata read property */ if ( world_mpi_rank != world_server_mpi_rank ) { - if ( H5Pset_coll_metadata_read(fapl, 0) < 0 ) { + if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { nerrors++; if ( verbose ) { -- cgit v0.12 From 2824e6bef0f9ea6550845f75ad4580349eafb822 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 14 Dec 2015 14:53:31 -0500 Subject: [svn-r28649] - add new API to toggle collective metadata write. - set default to FALSE - fix some bugs. --- src/H5Cmpio.c | 26 ++++++++++------ src/H5Fint.c | 2 ++ src/H5Fpkg.h | 3 +- src/H5Fprivate.h | 1 + src/H5Pfapl.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Ppublic.h | 2 ++ testpar/t_cache.c | 19 +++--------- testpar/t_dset.c | 2 +- testpar/t_shapesame.c | 4 ++- testpar/testphdf5.c | 4 ++- 10 files changed, 119 insertions(+), 28 deletions(-) diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 604a991..0d75ac1 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -257,9 +257,11 @@ H5C_apply_candidate_list(H5F_t * f, HDfprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - /* Create skip list of entries for collective write */ - if(NULL == (collective_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") + if(f->coll_md_write) { + /* Create skip list of entries for collective write */ + if(NULL == (collective_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") + } n = num_candidates / mpi_size; m = num_candidates % mpi_size; @@ -711,30 +713,34 @@ H5C_apply_candidate_list(H5F_t * f, if (delayed_ptr) { if (delayed_ptr->clear_on_unprotect) { - if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, + if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.") + entry_ptr->clear_on_unprotect = FALSE; entries_cleared++; } else if (delayed_ptr->flush_immediately) { if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.") + entry_ptr->flush_immediately = FALSE; entries_flushed++; } /* end if */ - entries_flushed_collectively++; entries_flushed_or_cleared_last++; } /* end if */ - /* Write collective list */ - if(H5C_collective_write(f, - dxpl_id, - collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't write metadata collectively") + if(f->coll_md_write) { + HDassert(collective_write_list); + /* Write collective list */ + if(H5C_collective_write(f, + dxpl_id, + collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't write metadata collectively") + } /* ====================================================================== * * Finished flushing everything. * * ====================================================================== */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 33db083..4e44bcb 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -639,6 +639,8 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t #ifdef H5_HAVE_PARALLEL if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata read flag") + if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata write flag") #endif /* H5_HAVE_PARALLEL */ /* Get the VFD values to cache */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 4fda863..55e322b 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -312,7 +312,8 @@ struct H5F_t { struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ #ifdef H5_HAVE_PARALLEL - H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ + H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ + hbool_t coll_md_write; /* Do all metadata writes collectively */ #endif /* H5_HAVE_PARALLEL */ }; diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 8c0e608..2d61a4c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -454,6 +454,7 @@ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME "core_write_tracking_flag" /* Whether or not core VFD backing store write tracking is enabled */ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */ +#define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */ /* ======================== File Mount properties ====================*/ #define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 7e1e0ee..9cc8fc7 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -183,6 +183,11 @@ #define H5F_ACS_COLL_MD_READ_FLAG_DEF H5P_USER_FALSE #define H5F_ACS_COLL_MD_READ_FLAG_ENC H5P__encode_coll_md_read_flag_t #define H5F_ACS_COLL_MD_READ_FLAG_DEC H5P__decode_coll_md_read_flag_t +/* Definition of collective metadata write mode flag */ +#define H5F_ACS_COLL_MD_WRITE_FLAG_SIZE sizeof(hbool_t) +#define H5F_ACS_COLL_MD_WRITE_FLAG_DEF FALSE +#define H5F_ACS_COLL_MD_WRITE_FLAG_ENC H5P__encode_hbool_t +#define H5F_ACS_COLL_MD_WRITE_FLAG_DEC H5P__decode_hbool_t /******************/ @@ -287,6 +292,7 @@ static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMA static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ +static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */ @@ -451,6 +457,13 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the metadata collective write flag */ + if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, + &H5F_def_coll_md_write_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_reg_prop() */ @@ -3651,4 +3664,75 @@ H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective) done: FUNC_LEAVE_API(ret_value) } /* H5Pget_coll_metadata_read */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_coll_metadata_write + * + * Purpose: Tell the library whether the metadata write operations will + * be done collectively (1) or not (0). Default is collective. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", plist_id, is_collective); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set values */ + if(H5P_set(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &is_collective) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata write flag") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pset_coll_metadata_write */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_coll_metadata_write + * + * Purpose: Gets information about collective metadata write mode. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*b", plist_id, is_collective); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, is_collective) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get collective metadata write flag") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pget_coll_metadata_write */ + #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 6a1dbad..a0a684f 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -354,6 +354,8 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective); +H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective); +H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective); #endif /* H5_HAVE_PARALLEL */ /* Dataset creation property list (DCPL) routines */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index e91ee4e..5b6b44f 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7508,15 +7508,6 @@ main(int argc, char **argv) } } - if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { - - nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", - world_mpi_rank, FUNC); - } - } - /* fix the file names */ for ( u = 0; u < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++u ) { @@ -7561,6 +7552,7 @@ main(int argc, char **argv) world_mpi_rank, FUNC); } } + } setup_rand(); @@ -7599,6 +7591,10 @@ main(int argc, char **argv) smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif +#if 1 + smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); + smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); +#endif /* enable the collective metadata read property */ if ( world_mpi_rank != world_server_mpi_rank ) { if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { @@ -7611,11 +7607,6 @@ main(int argc, char **argv) } } #if 1 - smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); - smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); -#endif - -#if 1 smoke_check_6(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_6(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif diff --git a/testpar/t_dset.c b/testpar/t_dset.c index ae022fb..2e1005c 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -457,7 +457,7 @@ dataset_readInd(void) VRFY((acc_tpl >= 0), ""); /* open the file collectively */ - fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl); + fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl); VRFY((fid >= 0), ""); /* Release file-access template */ diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 5152408..1b856d0 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4948,7 +4948,9 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, 1); + ret = H5Pset_coll_metadata_read(ret_pl, true); + VRFY((ret >= 0), ""); + ret = H5Pset_coll_metadata_write(ret_pl, true); VRFY((ret >= 0), ""); return(ret_pl); } diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index b652ef4..7ab479d 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -272,7 +272,9 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, 1); + ret = H5Pset_coll_metadata_read(ret_pl, true); + VRFY((ret >= 0), ""); + ret = H5Pset_coll_metadata_write(ret_pl, true); VRFY((ret >= 0), ""); return(ret_pl); } -- cgit v0.12 From 06547eb4dd55c637f6c9ceaef75fadeff38bc5e2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 13 Jan 2016 23:30:50 -0500 Subject: [svn-r28895] Description: Minor code tweaks and cleanups during review. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5comittest not required on this branch) --- src/H5A.c | 3 +- src/H5AC.c | 3 +- src/H5C.c | 235 +++++++++++++++++------------------------------------- src/H5Cpkg.h | 4 +- src/H5D.c | 3 - src/H5F.c | 6 +- src/H5Fpublic.h | 22 +++-- testpar/t_cache.c | 3 +- 8 files changed, 94 insertions(+), 185 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index ea95fdd..56f6307 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1733,7 +1733,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ - hid_t dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1749,7 +1749,6 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - dxpl_id = H5AC_ind_dxpl_id; /* Verify access property list and get correct dxpl */ if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") diff --git a/src/H5AC.c b/src/H5AC.c index 39de07e..7388195 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -191,9 +191,8 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") /* Get the property list object */ - if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) + if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - HDassert(xfer_plist); /* Insert 'collective metadata write' property */ coll_meta_write = 1; diff --git a/src/H5C.c b/src/H5C.c index 8536ab0..8c80ce7 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -461,8 +461,6 @@ H5C_create(size_t max_cache_size, HDassert( max_type_id < H5C__MAX_NUM_TYPE_IDS ); HDassert( type_name_table_ptr ); - HDassert( ( write_permitted == TRUE ) || ( write_permitted == FALSE ) ); - for ( i = 0; i <= max_type_id; i++ ) { HDassert( (type_name_table_ptr)[i] ); @@ -988,7 +986,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, if(entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* If we get this far, call H5C__flush_single_entry() with the @@ -2013,11 +2011,8 @@ H5C_insert_entry(H5F_t * f, #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed just before done.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* If the entry's type has a 'notify' callback send a 'after insertion' @@ -2040,18 +2035,15 @@ H5C_insert_entry(H5F_t * f, if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read) { H5P_coll_md_read_flag_t prop_value; - /* get the property value */ + /* Get the property value */ if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't get collective metadata access flag") - coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE); - } - //fprintf(stderr, "COLLACCESS = %d.. FILE property = %d\n", coll_access, f->coll_md_read); - } + } /* end if */ + } /* end if */ entry_ptr->coll_access = coll_access; if(coll_access) { - //fprintf(stderr, "NEW (%llu, %s)\n", addr, entry_ptr->type->name); H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL) /* Make sure the size of the collective entries in the cache remain in check */ @@ -2059,33 +2051,27 @@ H5C_insert_entry(H5F_t * f, if(cache_ptr->max_cache_size*80 < cache_ptr->coll_list_size*100) { if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") - } - } + } /* end if */ + } /* end if */ else { if(cache_ptr->max_cache_size*40 < cache_ptr->coll_list_size*100) { if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") - } - } - - } + } /* end if */ + } /* end else */ + } /* end if */ entry_ptr->ind_access_while_coll = FALSE; #endif done: - #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on exit.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_insert_entry() */ @@ -2725,11 +2711,9 @@ H5C_protect(H5F_t * f, /* get the property value */ if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "Can't get collective metadata access flag") - coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE); - } - //fprintf(stderr, "COLLACCESS = %d.. FILE property = %d\n", coll_access, f->coll_md_read); - } + } /* end if */ + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* first check to see if the target is in cache */ @@ -2752,12 +2736,12 @@ H5C_protect(H5F_t * f, bcast. */ #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && - !(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { + !(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { MPI_Comm comm; /* File MPI Communicator */ int mpi_code; /* MPI error code */ int buf_size; - if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) + if(MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f))) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") if(entry_ptr->image_ptr == NULL) { @@ -2767,45 +2751,36 @@ H5C_protect(H5F_t * f, if((mpi_rank = H5F_mpi_get_rank(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") - if ( entry_ptr->compressed ) + if(entry_ptr->compressed) image_size = entry_ptr->compressed_size; else image_size = entry_ptr->size; - HDassert(image_size > 0); - entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE); - - if (NULL == entry_ptr->image_ptr) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, \ - "memory allocation failed for on disk image buffer") - } + if(NULL == (entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - if(0 == mpi_rank) { + if(0 == mpi_rank) if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "Can't get Image") - } - } + } /* end if */ HDassert(entry_ptr->image_ptr); H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); - if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, - MPI_BYTE, 0, comm))) + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm))) HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) entry_ptr->coll_access = TRUE; - //fprintf(stderr, "ONLY INSERT (%llu, %s)\n", addr, entry_ptr->type->name); H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } + } /* end if */ else if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && entry_ptr->coll_access) { - //fprintf(stderr, "UPDATE (%llu, %s)\n", addr, entry_ptr->type->name); H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } + } /* end else-if */ #endif /* H5_HAVE_PARALLEL */ #if H5C_DO_TAGGING_SANITY_CHECKS @@ -2854,13 +2829,8 @@ H5C_protect(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; entry_ptr->ring = ring; #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { - if(entry_ptr->coll_access) { - //fprintf(stderr, "LOAD and INSERT (%llu, %s)\n", addr, entry_ptr->type->name); - H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } - } - //fprintf(stderr, "LOADED (%llu, %s) - %d\n", addr, entry_ptr->type->name, coll_access); + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && entry_ptr->coll_access) + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) #endif /* H5_HAVE_PARALLEL */ /* Apply tag to newly protected entry */ @@ -3102,24 +3072,19 @@ H5C_protect(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { /* Make sure the size of the collective entries in the cache remain in check */ - if( TRUE == coll_access) { + if(TRUE == coll_access) { if(H5P_USER_TRUE == f->coll_md_read) { - //fprintf(stderr, "COLL entries size = %zu, MAX = %zu\n", cache_ptr->coll_list_size, cache_ptr->max_cache_size); - if(cache_ptr->max_cache_size*80 < cache_ptr->coll_list_size*100) { - //fprintf(stderr, "COLL entries at 80.. CLEARING\n"); + if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") - } - } + } /* end if */ else { - if(cache_ptr->max_cache_size*40 < cache_ptr->coll_list_size*100) { - //fprintf(stderr, "COLL entries at 40.. CLEARING\n"); + if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") - } - } - } - } + } /* end else */ + } /* end if */ + } /* end if */ #endif /* H5_HAVE_PARALLEL */ done: @@ -3127,11 +3092,8 @@ done: #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ - "an extreme sanity check failed on exit.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -3470,23 +3432,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_set_evictions_enabled(H5C_t *cache_ptr, - hbool_t evictions_enabled) +H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { - + if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") - } - - if ( ( evictions_enabled != TRUE ) && ( evictions_enabled != FALSE ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Bad evictions_enabled on entry.") - } /* There is no fundamental reason why we should not permit * evictions to be disabled while automatic resize is enabled. @@ -3494,20 +3447,15 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr, * want to, and allowing it would greatly complicate testing * the feature. Hence the following: */ - if ( ( evictions_enabled != TRUE ) && - ( ( cache_ptr->resize_ctl.incr_mode != H5C_incr__off ) || - ( cache_ptr->resize_ctl.decr_mode != H5C_decr__off ) ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Can't disable evictions when auto resize enabled.") - } + if((evictions_enabled != TRUE) && + ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) || + (cache_ptr->resize_ctl.decr_mode != H5C_decr__off))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled.") cache_ptr->evictions_enabled = evictions_enabled; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_set_evictions_enabled() */ @@ -4870,27 +4818,14 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( (tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0 ) { - if ( ( config_ptr->set_initial_size != TRUE ) && - ( config_ptr->set_initial_size != FALSE ) ) { + if(config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "set_initial_size must be either TRUE or FALSE"); - } + if(config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small") - if ( config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big"); - } - - if ( config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small"); - } - - if ( config_ptr->min_size > config_ptr->max_size ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size"); - } + if(config_ptr->min_size > config_ptr->max_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size") if ( ( config_ptr->set_initial_size ) && ( ( config_ptr->initial_size < config_ptr->min_size ) || @@ -4929,25 +4864,12 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( config_ptr->incr_mode == H5C_incr__threshold ) { - if ( ( config_ptr->lower_hr_threshold < (double)0.0f ) || - ( config_ptr->lower_hr_threshold > (double)1.0f ) ) { + if((config_ptr->lower_hr_threshold < (double)0.0f) || + (config_ptr->lower_hr_threshold > (double)1.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "lower_hr_threshold must be in the range [0.0, 1.0]") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "lower_hr_threshold must be in the range [0.0, 1.0]"); - } - - if ( config_ptr->increment < (double)1.0f ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "increment must be greater than or equal to 1.0"); - } - - if ( ( config_ptr->apply_max_increment != TRUE ) && - ( config_ptr->apply_max_increment != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_max_increment must be either TRUE or FALSE"); - } + if(config_ptr->increment < (double)1.0f) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0") /* no need to check max_increment, as it is a size_t, * and thus must be non-negative. @@ -5025,26 +4947,13 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, "epochs_before_eviction must be positive"); } - if ( config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "epochs_before_eviction too big"); - } - - if ( ( config_ptr->apply_empty_reserve != TRUE ) && - ( config_ptr->apply_empty_reserve != FALSE ) ) { + if(config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_empty_reserve must be either TRUE or FALSE"); - } - - if ( ( config_ptr->apply_empty_reserve ) && - ( ( config_ptr->empty_reserve > (double)1.0f ) || - ( config_ptr->empty_reserve < (double)0.0f ) ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "empty_reserve must be in the interval [0.0, 1.0]"); - } + if((config_ptr->apply_empty_reserve) && + ((config_ptr->empty_reserve > (double)1.0f) || + (config_ptr->empty_reserve < (double)0.0f))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]") /* no need to check max_decrement as it is a size_t * and thus must be non-negative. @@ -8666,20 +8575,20 @@ H5C_load_entry(H5F_t * f, HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* Get the on-disk entry image */ - if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) { + if(0 == (type->flags & H5C__CLASS_SKIP_READS)) { #ifdef H5_HAVE_PARALLEL if(!coll_access || 0 == mpi_rank) { #endif /* H5_HAVE_PARALLEL */ - if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") + if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") #ifdef H5_HAVE_PARALLEL - } + } /* end if */ /* if the collective metadata read optimization is turned on, bcast the metadata read from process 0 to all ranks in the file communicator */ @@ -8689,9 +8598,9 @@ H5C_load_entry(H5F_t * f, H5_CHECKED_ASSIGN(buf_size, int, len, size_t); if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ - } + } /* end if */ /* Deserialize the on-disk image into the native memory form */ if(NULL == (thing = type->deserialize(image, len, udata, &dirty))) @@ -8813,7 +8722,7 @@ H5C_load_entry(H5F_t * f, H5_CHECKED_ASSIGN(buf_size, int, new_len, size_t); if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* Deserialize on-disk image into native memory form again */ @@ -9125,7 +9034,7 @@ H5C_make_space_in_cache(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ #endif if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, NULL, NULL) < 0) @@ -9149,7 +9058,7 @@ H5C_make_space_in_cache(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ #endif if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) @@ -9291,10 +9200,10 @@ H5C_make_space_in_cache(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(!(entry_ptr->coll_access)) { #endif /* H5_HAVE_PARALLEL */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") #ifdef H5_HAVE_PARALLEL - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* we are scanning the clean LRU, so the serialize function diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 33d4abc..2f4d137 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -999,7 +999,7 @@ if ( ( (cache_ptr) == NULL ) || \ } #define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ + entry_ptr, was_clean) \ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len <= 0 ) || \ ( (cache_ptr)->index_size <= 0 ) || \ @@ -1242,7 +1242,7 @@ if ( ( (cache_ptr)->index_size != \ H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \ } -#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ +#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ { \ int k; \ int depth = 0; \ diff --git a/src/H5D.c b/src/H5D.c index 3bb20fb..9f2be83 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -917,6 +917,3 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Dset_extent() */ - -/* LocalWords: buf - */ diff --git a/src/H5F.c b/src/H5F.c index 22e9467..988462c 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -447,7 +447,7 @@ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t dxpl_id; /*dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /*dxpl used by library */ hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) @@ -472,7 +472,6 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") @@ -552,7 +551,7 @@ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t dxpl_id; /*dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /*dxpl used by library */ hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) @@ -566,7 +565,6 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index aa6cc2a..122f711 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -32,6 +32,14 @@ #define H5CHECK #endif /* _H5private_H */ +/* When this header is included from a private HDF5 header, don't make calls to H5open() */ +#undef H5OPEN +#ifndef _H5private_H +#define H5OPEN H5open(), +#else /* _H5private_H */ +#define H5OPEN +#endif /* _H5private_H */ + /* * These are the bits that can be passed to the `flags' argument of * H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine @@ -44,16 +52,16 @@ * Note that H5F_ACC_DEBUG is deprecated (nonfuncational) but retained as a * symbol for backward compatibility. */ -#define H5F_ACC_RDONLY (H5CHECK 0x0000u) /*absence of rdwr => rd-only */ -#define H5F_ACC_RDWR (H5CHECK 0x0001u) /*open for read and write */ -#define H5F_ACC_TRUNC (H5CHECK 0x0002u) /*overwrite existing files */ -#define H5F_ACC_EXCL (H5CHECK 0x0004u) /*fail if file already exists*/ +#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /*absence of rdwr => rd-only */ +#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */ +#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */ +#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /*fail if file already exists*/ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ -#define H5F_ACC_CREAT (H5CHECK 0x0010u) /*create non-existing files */ +#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /*create non-existing files */ /* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the * parent file. */ -#define H5F_ACC_DEFAULT (H5CHECK 0xffffu) /*ignore setting on lapl */ +#define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /*ignore setting on lapl */ /* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */ #define H5F_OBJ_FILE (0x0001u) /* File objects */ @@ -223,7 +231,7 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ -#define H5F_ACC_DEBUG (H5CHECK 0x0000u) /*print debug info (deprecated)*/ +#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/ /* Typedefs */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 5b6b44f..4c2d40e 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7552,7 +7552,6 @@ main(int argc, char **argv) world_mpi_rank, FUNC); } } - } setup_rand(); @@ -7574,7 +7573,6 @@ main(int argc, char **argv) #if 1 server_smoke_check(); #endif - #if 1 smoke_check_1(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_1(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7644,3 +7642,4 @@ finish: /* cannot just return (failures) because exit code is limited to 1byte */ return(failures != 0); } + -- cgit v0.12 From b10dd41aef81062d8792da89301756bfec996ff0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 15 Jan 2016 18:06:25 -0500 Subject: [svn-r28915] Description: Review revisions on the way to the trunk. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5A.c | 82 ++++++++++++++++++++++++-------------------------- src/H5AC.c | 14 ++++----- src/H5ACprivate.h | 2 +- src/H5C.c | 2 +- src/H5D.c | 12 ++++---- src/H5F.c | 8 ++--- src/H5G.c | 20 ++++++------- src/H5L.c | 86 ++++++++++++++++++++++++++--------------------------- src/H5Lexternal.c | 4 +-- src/H5O.c | 32 ++++++++++---------- src/H5Pfapl.c | 89 +++++++++++++++++++++++++++++++++++++++---------------- src/H5Pint.c | 68 ++++++++++++++++++++++++++++-------------- src/H5Ppkg.h | 27 ----------------- src/H5Pprivate.h | 44 ++++++++++++++++++++++----- src/H5Tcommit.c | 12 ++++---- 15 files changed, 278 insertions(+), 224 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 56f6307..e478610 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -273,9 +273,8 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Go do the real work for attaching the attribute to the object */ if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, dxpl_id))) @@ -365,22 +364,20 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, obj_loc.path = &obj_path; H5G_loc_reset(&obj_loc); - dxpl_id = H5AC_ind_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Find the object's location */ if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) @@ -439,9 +436,8 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Read in attribute from object header */ if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, dxpl_id))) @@ -514,9 +510,8 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) @@ -591,9 +586,8 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute in the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -924,8 +918,8 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -1061,8 +1055,8 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) @@ -1123,8 +1117,8 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -1222,8 +1216,8 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { @@ -1398,8 +1392,8 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1522,10 +1516,10 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - dxpl_id = H5AC_ind_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1537,10 +1531,10 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Delete the attribute from the location */ if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) @@ -1606,10 +1600,10 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - dxpl_id = H5AC_ind_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1621,10 +1615,10 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Delete the attribute from the location */ if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) @@ -1750,8 +1744,8 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") diff --git a/src/H5AC.c b/src/H5AC.c index 7388195..371bd01 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -91,8 +91,8 @@ hid_t H5AC_dxpl_id = (-1); H5P_genplist_t *H5AC_ind_dxpl_g = NULL; hid_t H5AC_ind_dxpl_id = (-1); -hid_t H5AC_coll_write_coll_read_dxpl_id=(-1); -hid_t H5AC_ind_write_coll_read_dxpl_id=(-1); +hid_t H5AC_coll_write_coll_read_dxpl_id = (-1); +hid_t H5AC_ind_write_coll_read_dxpl_id = (-1); /*******************/ /* Local Variables */ @@ -175,7 +175,7 @@ H5AC__init_package(void) { #ifdef H5_HAVE_PARALLEL H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ - unsigned coll_meta_write; /* "collective metadata write" property value */ + hbool_t coll_meta_write; /* "collective metadata write" property value */ H5P_coll_md_read_flag_t coll_meta_read; #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -195,7 +195,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ - coll_meta_write = 1; + coll_meta_write = TRUE; if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") @@ -209,7 +209,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ - coll_meta_write = 0; + coll_meta_write = FALSE; if(H5P_insert(H5AC_ind_dxpl_g, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") @@ -223,7 +223,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ - coll_meta_write = 1; + coll_meta_write = TRUE; if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") @@ -243,7 +243,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ - coll_meta_write = 0; + coll_meta_write = FALSE; if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index bd23fea..50e7ab1 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -186,7 +186,7 @@ typedef H5C_t H5AC_t; #ifdef H5_HAVE_PARALLEL /* Definitions for "collective metadata write" property */ #define H5AC_COLLECTIVE_META_WRITE_NAME "H5AC_collective_metadata_write" -#define H5AC_COLLECTIVE_META_WRITE_SIZE sizeof(unsigned) +#define H5AC_COLLECTIVE_META_WRITE_SIZE sizeof(hbool_t) #define H5AC_COLLECTIVE_META_WRITE_DEF 0 #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5C.c b/src/H5C.c index 8c80ce7..929e721 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -7828,7 +7828,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ */ if(!clear_only && entry_ptr->is_dirty && H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { H5P_genplist_t *dxpl; /* Dataset transfer property list */ - unsigned coll_meta; /* Collective metadata write flag */ + hbool_t coll_meta; /* Collective metadata write flag */ /* Get the dataset transfer property list */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) diff --git a/src/H5D.c b/src/H5D.c index 9f2be83..528d341 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -139,8 +139,8 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new dataset & get its ID */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, dxpl_id))) @@ -219,8 +219,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* build and open the new dataset */ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, dxpl_id))) @@ -288,8 +288,8 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id, dxpl_id))) diff --git a/src/H5F.c b/src/H5F.c index 988462c..cd35182 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -473,8 +473,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* * Adjust bit flags by turning on the creation bit and making sure that @@ -566,8 +566,8 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the file */ if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) diff --git a/src/H5G.c b/src/H5G.c index 6a9342c..8798a82 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -317,8 +317,8 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new group & get its ID */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, dxpl_id))) @@ -394,8 +394,8 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; @@ -466,8 +466,8 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the group */ if((grp = H5G__open_name(&loc, name, gapl_id, dxpl_id)) == NULL) @@ -604,8 +604,8 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -672,8 +672,8 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; diff --git a/src/H5L.c b/src/H5L.c index 9e0e277..23eb395 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -357,6 +357,10 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; @@ -365,10 +369,6 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, else if(dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; - /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Move the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id, lapl_id, dxpl_id) < 0) @@ -420,6 +420,10 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; @@ -428,10 +432,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, else if(dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; - /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Copy the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id, lapl_id, dxpl_id) < 0) @@ -482,8 +482,8 @@ H5Lcreate_soft(const char *link_target, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the link */ if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, dxpl_id) < 0) @@ -537,6 +537,10 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up current & new location pointers */ cur_loc_p = &cur_loc; new_loc_p = &new_loc; @@ -547,10 +551,6 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") - /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id, lapl_id, dxpl_id) < 0) @@ -606,8 +606,8 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create external link */ if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, dxpl_id) < 0) @@ -652,8 +652,8 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Unlink */ if(H5L_delete(&loc, name, lapl_id, dxpl_id) < 0) @@ -706,8 +706,8 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for unlink operation */ udata.idx_type = idx_type; @@ -762,8 +762,8 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link value */ if(H5L_get_val(&loc, name, buf, size, lapl_id, dxpl_id) < 0) @@ -817,8 +817,8 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for retrieving information */ udata.idx_type = idx_type; @@ -869,8 +869,8 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ if((ret_value = H5L__exists(&loc, name, lapl_id, dxpl_id)) < 0) @@ -913,12 +913,12 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link information */ if(H5L_get_info(&loc, name, linfo, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -964,8 +964,8 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; @@ -977,8 +977,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Traverse the group hierarchy to locate the object to get info about */ if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") - + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -1154,8 +1153,8 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; @@ -1169,7 +1168,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, /* Traverse the group hierarchy to locate the link to get name of */ if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist") /* Set the return value */ ret_value = udata.name_len; @@ -1234,8 +1233,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, - op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1295,8 +1293,8 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up iteration beginning/end info */ idx = (idx_p == NULL ? 0 : *idx_p); @@ -1309,7 +1307,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, /* Iterate over the links */ if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ if(idx_p) @@ -1428,12 +1426,12 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal group visitation routine */ if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index f029ebc..3e8be66 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -599,8 +599,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create an external link */ if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, dxpl_id) < 0) diff --git a/src/H5O.c b/src/H5O.c index 26204e5..01be3e6 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -300,8 +300,8 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -450,8 +450,8 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Link to the object */ if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, dxpl_id) < 0) @@ -574,8 +574,8 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check if the object exists */ if((ret_value = H5G_loc_exists(&loc, name, lapl_id, dxpl_id)) < 0) @@ -655,8 +655,8 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's information */ if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, dxpl_id) < 0) @@ -710,8 +710,8 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -810,8 +810,8 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, name, comment, lapl_id, dxpl_id) < 0) @@ -894,8 +894,8 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, dxpl_id)) < 0) @@ -1018,8 +1018,8 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal object visitation routine */ if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 9cc8fc7..75f9e7c 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -439,27 +439,25 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the core VFD backing store write tracking flag */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g , + if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the core VFD backing store page size */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g , + if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, - &H5F_def_coll_md_read_flag_g, + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective write flag */ - if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, - &H5F_def_coll_md_write_flag_g, + if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -3434,6 +3432,9 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * + * Programmer: Dana Robinson + * Tuesday, April 8, 2014 + * *------------------------------------------------------------------------- */ herr_t @@ -3461,7 +3462,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_core_write_tracking() */ /*------------------------------------------------------------------------- @@ -3472,6 +3473,9 @@ done: * * Return: Non-negative on success/Negative on failure * + * Programmer: Dana Robinson + * Tuesday, April 8, 2014 + * *------------------------------------------------------------------------- */ herr_t @@ -3500,7 +3504,7 @@ H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled, size_t *page_siz done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_core_write_tracking() */ /*------------------------------------------------------------------------- @@ -3512,6 +3516,7 @@ done: * Failure: Negative * * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 * *------------------------------------------------------------------------- */ @@ -3549,6 +3554,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) * Failure: Negative * * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 * *------------------------------------------------------------------------- */ @@ -3577,47 +3583,60 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) /*------------------------------------------------------------------------- * Function: H5Pset_coll_metadata_read * - * Purpose: Tell the library whether the metadata read operations will - * be done collectively (1) or not (0). Default is independent. With - * collective mode, the library will optimize access to metdata - * operations on the file. + * Purpose: Tell the library whether the metadata read operations will + * be done collectively (1) or not (0). Default is independent. + * With collective mode, the library will optimize access to + * metadata operations on the file. + * + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. * * Return: Non-negative on success/Negative on failure * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * *------------------------------------------------------------------------- */ herr_t H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective) { H5P_genplist_t *plist; /* Property list pointer */ + H5P_coll_md_read_flag_t coll_meta_read; /* Property value */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", plist_id, is_collective); /* Compare the property list's class against the other class */ + /* (Dataset, group, attribute, and named datype access property lists + * are sub-classes of link access property lists -QAK) + */ if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") /* set property to either TRUE if > 0, or FALSE otherwise */ - if(is_collective > 0) - is_collective = TRUE; + if(is_collective) + coll_meta_read = H5P_USER_TRUE; else - is_collective = FALSE; + coll_meta_read = H5P_USER_FALSE; /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set values */ - if(H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) + if(H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag") done: FUNC_LEAVE_API(ret_value) -} /* H5Pset_coll_metadata_read */ +} /* end H5Pset_coll_metadata_read() */ /*------------------------------------------------------------------------- @@ -3625,8 +3644,17 @@ done: * * Purpose: Gets information about collective metadata read mode. * + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. + * * Return: Non-negative on success/Negative on failure * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * *------------------------------------------------------------------------- */ herr_t @@ -3638,9 +3666,12 @@ H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective) H5TRACE2("e", "i*b", plist_id, is_collective); /* Compare the property list's class against the other class */ + /* (Dataset, group, attribute, and named datype access property lists + * are sub-classes of link access property lists -QAK) + */ if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") /* Get value */ @@ -3669,11 +3700,14 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_coll_metadata_write * - * Purpose: Tell the library whether the metadata write operations will - * be done collectively (1) or not (0). Default is collective. + * Purpose: Tell the library whether the metadata write operations will + * be done collectively (1) or not (0). Default is collective. * * Return: Non-negative on success/Negative on failure * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * *------------------------------------------------------------------------- */ herr_t @@ -3699,7 +3733,7 @@ H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective) done: FUNC_LEAVE_API(ret_value) -} /* H5Pset_coll_metadata_write */ +} /* end H5Pset_coll_metadata_write() */ /*------------------------------------------------------------------------- @@ -3709,6 +3743,9 @@ done: * * Return: Non-negative on success/Negative on failure * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * *------------------------------------------------------------------------- */ herr_t @@ -3733,6 +3770,6 @@ H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective) done: FUNC_LEAVE_API(ret_value) -} /* H5Pget_coll_metadata_write */ - +} /* end H5Pget_coll_metadata_write() */ #endif /* H5_HAVE_PARALLEL */ + diff --git a/src/H5Pint.c b/src/H5Pint.c index ca56f82..75b9f1e 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -274,13 +274,10 @@ const H5P_libclass_t H5P_CLS_TACC[1] = {{ /* Library property list classes defined in other code modules */ H5_DLLVAR const H5P_libclass_t H5P_CLS_OCRT[1]; /* Object creation */ H5_DLLVAR const H5P_libclass_t H5P_CLS_STRCRT[1]; /* String create */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_GCRT[1]; /* Group create */ H5_DLLVAR const H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FCRT[1]; /* File creation */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DCRT[1]; /* Dataset creation */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DXFR[1]; /* Data transfer */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FMNT[1]; /* File mount */ H5_DLLVAR const H5P_libclass_t H5P_CLS_ACRT[1]; /* Attribute creation */ @@ -5435,39 +5432,64 @@ H5P_get_class(const H5P_genplist_t *plist) FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ + +/*------------------------------------------------------------------------- + * Function: H5P_verify_apl_and_dxpl + * + * Purpose: Validate access property list and/or switch from generic + * property list to default of correct type. + * + * Also, if using internal DXPL and collective flag is set, + * switch to internal collective DXPL. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * + *------------------------------------------------------------------------- + */ herr_t -H5P_verify_and_set_dxpl(hid_t *acspl_id, hid_t pclass_id, hid_t default_id, hid_t *dxpl_id) +H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT + /* Sanity check */ HDassert(acspl_id); + HDassert(libclass); + HDassert(dxpl_id); - /* Check the access property list */ + /* Set access plist to the default property list of the appropriate class if it's the generic default */ if(H5P_DEFAULT == *acspl_id) - *acspl_id = default_id; - - if(TRUE != H5P_isa_class(*acspl_id, pclass_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Not the required access property list") + *acspl_id = *libclass->def_plist_id; + else { + H5P_coll_md_read_flag_t is_collective; /* Collective metadata read flag */ + H5P_genplist_t *plist; /* Property list pointer */ - if(dxpl_id) { - H5P_coll_md_read_flag_t is_collective; - H5P_genplist_t *plist; /* Property list pointer */ + /* Sanity check the access property list class */ + if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id)) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") - /* Get the plist structure */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(*acspl_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + /* Get the plist structure for the access property list */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) + /* Get the collective metadata read flag */ + if(H5P_peek(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag") - if(TRUE == is_collective && *dxpl_id == H5AC_dxpl_id) - *dxpl_id = H5AC_coll_write_coll_read_dxpl_id; - else if(TRUE == is_collective && *dxpl_id == H5AC_ind_dxpl_id) - *dxpl_id = H5AC_ind_write_coll_read_dxpl_id; - } + /* If collective metadata read requested and using internal DXPL, switch to internal collective DXPL */ + if(H5P_USER_TRUE == is_collective) { + if(*dxpl_id == H5AC_dxpl_id) + *dxpl_id = H5AC_coll_write_coll_read_dxpl_id; + else if(*dxpl_id == H5AC_ind_dxpl_id) + *dxpl_id = H5AC_ind_write_coll_read_dxpl_id; + } /* end if */ + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_verify_and_set_dxpl */ +} /* end H5P_verify_apl_and_dxpl() */ + diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index d10d578..3662cf9 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -115,33 +115,6 @@ struct H5P_genplist_t { H5SL_t *props; /* Skip list containing properties */ }; -/* Function pointer for library classes with properties to register */ -typedef herr_t (*H5P_init_class_op_t)(H5P_genclass_t *pclass); -typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); - -/* - * Each library property list class has a variable of this type that contains - * class variables and methods used to initialize the class. - */ -typedef struct H5P_libclass_t { - const char *name; /* Class name */ - H5P_plist_type_t type; /* Class type */ - - H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */ - H5P_genclass_t * * pclass; /* Pointer to global property list class */ - hid_t * const class_id; /* Pointer to global property list class ID */ - hid_t * const def_plist_id; /* Pointer to global default property list ID */ - H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ - - /* Class callback function pointers & info */ - H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ - void *create_data; /* Pointer to user data to pass along to create callback */ - H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ - void *copy_data; /* Pointer to user data to pass along to copy callback */ - H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ - void *close_data; /* Pointer to user data to pass along to close callback */ -} H5P_libclass_t; - /* Property list/class iterator callback function pointer */ typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index cff79a6..4e64843 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -85,6 +85,32 @@ typedef enum H5P_plist_type_t { H5P_TYPE_MAX_TYPE } H5P_plist_type_t; +/* Function pointer for library classes with properties to register */ +typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); + +/* + * Each library property list class has a variable of this type that contains + * class variables and methods used to initialize the class. + */ +typedef struct H5P_libclass_t { + const char *name; /* Class name */ + H5P_plist_type_t type; /* Class type */ + + H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */ + H5P_genclass_t * * pclass; /* Pointer to global property list class */ + hid_t * const class_id; /* Pointer to global property list class ID */ + hid_t * const def_plist_id; /* Pointer to global default property list ID */ + H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ + + /* Class callback function pointers & info */ + H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ + void *create_data; /* Pointer to user data to pass along to create callback */ + H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ + void *copy_data; /* Pointer to user data to pass along to copy callback */ + H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ + void *close_data; /* Pointer to user data to pass along to close callback */ +} H5P_libclass_t; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -109,6 +135,14 @@ H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_STRING_CREATE_g; +/* Internal property list classes */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_AACC[1]; /* Attribute access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_GACC[1]; /* Group access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_TACC[1]; /* Named datatype access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ + /******************************/ /* Library Private Prototypes */ @@ -134,6 +168,8 @@ H5_DLL herr_t H5P_remove(H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); + +/* Internal helper routines */ H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse); H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist); @@ -153,6 +189,7 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id); +H5_DLL herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id); /* Query internal fields of the property list struct */ H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist); @@ -162,18 +199,11 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist); H5_DLL htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id); H5_DLL H5P_genplist_t *H5P_object_verify(hid_t plist_id, hid_t pclass_id); -/* Private functions to "peek" at properties of a certain type */ -H5_DLL unsigned H5P_peek_unsigned(H5P_genplist_t *plist, const char *name); -H5_DLL hid_t H5P_peek_hid_t(H5P_genplist_t *plist, const char *name); -H5_DLL void *H5P_peek_voidp(H5P_genplist_t *plist, const char *name); -H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name); - /* Private DCPL routines */ H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status); H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const struct H5T_t *type, void *value, hid_t dxpl_id); -H5_DLL herr_t H5P_verify_and_set_dxpl(hid_t *acspl_id, hid_t pclass_id, hid_t default_id, hid_t *dxpl_id); #endif /* _H5Pprivate_H */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index c2833e1..51fb9d2 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -128,8 +128,8 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, dxpl_id) < 0) @@ -266,8 +266,8 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ if(H5T__commit(loc.oloc->file, type, tcpl_id, dxpl_id) < 0) @@ -542,8 +542,8 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up datatype location to fill in */ type_loc.oloc = &oloc; -- cgit v0.12 From d543f1247312741e0e33dcf6bddc5a73b842e5d0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 15 Jan 2016 18:28:25 -0500 Subject: [svn-r28919] Description: I missed changes to a couple of expected error output files with the last checkin. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- tools/h5dump/errfiles/tdset-2.err | 2 +- tools/h5dump/errfiles/tperror.err | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/h5dump/errfiles/tdset-2.err b/tools/h5dump/errfiles/tdset-2.err index 775351e..e594c1b 100644 --- a/tools/h5dump/errfiles/tdset-2.err +++ b/tools/h5dump/errfiles/tdset-2.err @@ -19,7 +19,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info - major: Symbol table + major: Links minor: Object not found #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Symbol table diff --git a/tools/h5dump/errfiles/tperror.err b/tools/h5dump/errfiles/tperror.err index 29f9e7f..b469029 100644 --- a/tools/h5dump/errfiles/tperror.err +++ b/tools/h5dump/errfiles/tperror.err @@ -19,7 +19,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info - major: Symbol table + major: Links minor: Object not found #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Symbol table -- cgit v0.12 From c8a6c6030a768952bc4161b2bf30c948b8b58723 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 10 Feb 2016 12:55:55 -0500 Subject: [svn-r29077] Description: Normalize against the trunk, in preparation for final merge. Tested on: MacOSX/64 10.11.3 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5AC.c | 5 +- src/H5ACmpio.c | 2 +- src/H5ACprivate.h | 15 +- src/H5C.c | 527 +++++++++++++++----------------------------------- src/H5Cmpio.c | 205 +++++++++++--------- src/H5Cpkg.h | 15 +- src/H5Cprivate.h | 3 +- src/H5Dchunk.c | 17 +- src/H5Ddeprec.c | 3 +- src/H5Fint.c | 30 +++ src/H5Fprivate.h | 13 ++ src/H5Fquery.c | 28 +++ src/H5Pdxpl.c | 5 +- src/H5Pint.c | 16 +- src/H5Plapl.c | 4 +- src/H5Pprivate.h | 4 +- src/H5R.c | 4 +- testpar/t_cache.c | 2 +- testpar/t_mdset.c | 2 +- testpar/t_shapesame.c | 4 +- testpar/testphdf5.c | 5 +- 21 files changed, 392 insertions(+), 517 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 12417f2..01fdb72 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -88,8 +88,6 @@ hid_t H5AC_dxpl_id; hid_t H5AC_coll_read_dxpl_id = (-1); #endif /* H5_HAVE_PARALLEL */ -/* global flag for collective API sanity checks */ - /* DXPL to be used in operations that will not result in I/O calls */ hid_t H5AC_noio_dxpl_id = (-1); @@ -216,7 +214,7 @@ H5AC__init_package(void) /* Get the property list object */ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_ind_read_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - /* set metadata dxpl type */ + /* Insert the dxpl type property */ dxpl_type = H5FD_METADATA_DXPL; if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") @@ -551,7 +549,6 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); - if(aux_ptr) /* Sanity check */ HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 353805d..db291cf 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -2067,7 +2067,7 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu /* clear collective access flag on half of the entries in the cache and mark them as independent in case they need to be - evicted later. All ranks are guranteed to mark the same entires + evicted later. All ranks are guranteed to mark the same entries since we don't modify the order of the collectively accessed entries except through collective access. */ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 7481f0a..71ddcf3 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -181,13 +181,6 @@ typedef H5C_cache_entry_t H5AC_info_t; /* Typedef for metadata cache (defined in H5Cpkg.h) */ typedef H5C_t H5AC_t; -#ifdef H5_HAVE_PARALLEL -/* Definitions for "collective metadata write" property */ -#define H5AC_COLLECTIVE_META_WRITE_NAME "H5AC_collective_metadata_write" -#define H5AC_COLLECTIVE_META_WRITE_SIZE sizeof(hbool_t) -#define H5AC_COLLECTIVE_META_WRITE_DEF 0 -#endif /* H5_HAVE_PARALLEL */ - #define H5AC_METADATA_TAG_NAME "H5AC_metadata_tag" #define H5AC_METADATA_TAG_SIZE sizeof(haddr_t) #define H5AC_METADATA_TAG_DEF H5AC__INVALID_TAG @@ -196,17 +189,17 @@ typedef H5C_t H5AC_t; /* Dataset transfer property list for metadata calls */ H5_DLLVAR hid_t H5AC_dxpl_id; -extern hid_t H5AC_ind_read_dxpl_id; +H5_DLLVAR hid_t H5AC_ind_read_dxpl_id; #ifdef H5_HAVE_PARALLEL -extern hid_t H5AC_coll_read_dxpl_id; +H5_DLLVAR hid_t H5AC_coll_read_dxpl_id; #endif /* H5_HAVE_PARALLEL */ /* DXPL to be used in operations that will not result in I/O calls */ -extern hid_t H5AC_noio_dxpl_id; +H5_DLLVAR hid_t H5AC_noio_dxpl_id; /* DXPL to be used for raw data I/O operations when one is not provided by the user (fill values in H5Dcreate) */ -extern hid_t H5AC_rawdata_dxpl_id; +H5_DLLVAR hid_t H5AC_rawdata_dxpl_id; /* Default cache configuration. */ diff --git a/src/H5C.c b/src/H5C.c index 100fbe0..37b0df2 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -93,7 +93,6 @@ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#include "H5SLprivate.h" /* Skip lists */ /****************/ @@ -182,7 +181,7 @@ static herr_t H5C_mark_tagged_entries(H5C_t * cache_ptr, static herr_t H5C_flush_marked_entries(H5F_t * f, hid_t dxpl_id); -static herr_t H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, +static herr_t H5C__generate_image(const H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, hid_t dxpl_id, int64_t *entry_size_change_ptr); #if H5C_DO_TAGGING_SANITY_CHECKS @@ -225,6 +224,9 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Declare a free list to manage the H5C_t struct */ H5FL_DEFINE_STATIC(H5C_t); +/* Declare extern free list to manage the H5C_collective_write_t struct */ +H5FL_EXTERN(H5C_collective_write_t); + /**************************************************************************** @@ -1006,7 +1008,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flush_flags, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_flush_single_entry() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't flush entry") #if H5C_DO_SANITY_CHECKS if ( entry_was_dirty ) @@ -1913,8 +1915,10 @@ H5C_insert_entry(H5F_t * f, entry_ptr->aux_next = NULL; entry_ptr->aux_prev = NULL; +#ifdef H5_HAVE_PARALLEL entry_ptr->coll_next = NULL; entry_ptr->coll_prev = NULL; +#endif /* H5_HAVE_PARALLEL */ H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) @@ -2041,19 +2045,18 @@ H5C_insert_entry(H5F_t * f, /* Make sure the size of the collective entries in the cache remain in check */ if(H5P_USER_TRUE == f->coll_md_read) { - if(cache_ptr->max_cache_size*80 < cache_ptr->coll_list_size*100) { - if(H5C_clear_coll_entries(cache_ptr, 1) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) { + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries") } /* end if */ } /* end if */ else { - if(cache_ptr->max_cache_size*40 < cache_ptr->coll_list_size*100) { - if(H5C_clear_coll_entries(cache_ptr, 1) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) { + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries") } /* end if */ } /* end else */ } /* end if */ - entry_ptr->ind_access_while_coll = FALSE; #endif done: @@ -2724,52 +2727,52 @@ H5C_protect(H5F_t * f, the entry in their cache still have to participate in the bcast. */ #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && - !(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { - MPI_Comm comm; /* File MPI Communicator */ - int mpi_code; /* MPI error code */ - int buf_size; + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access) { + if(!(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { + MPI_Comm comm; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ + int buf_size; - if(MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") + if(MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") - if(entry_ptr->image_ptr == NULL) { - int mpi_rank; - size_t image_size; + if(entry_ptr->image_ptr == NULL) { + int mpi_rank; + size_t image_size; - if((mpi_rank = H5F_mpi_get_rank(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") + if((mpi_rank = H5F_mpi_get_rank(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") - if(entry_ptr->compressed) - image_size = entry_ptr->compressed_size; - else - image_size = entry_ptr->size; - HDassert(image_size > 0); + if(entry_ptr->compressed) + image_size = entry_ptr->compressed_size; + else + image_size = entry_ptr->size; + HDassert(image_size > 0); - if(NULL == (entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") + if(NULL == (entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, - H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, + H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - if(0 == mpi_rank) - if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "Can't get Image") - } /* end if */ - - HDassert(entry_ptr->image_ptr); - - H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); - if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + if(0 == mpi_rank) + if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't generate entry's image") + } /* end if */ + HDassert(entry_ptr->image_ptr); - entry_ptr->coll_access = TRUE; + H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + /* Mark the entry as collective and insert into the collective list */ + entry_ptr->coll_access = TRUE; + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } /* end if */ + else if(entry_ptr->coll_access) { + H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } /* end else-if */ } /* end if */ - else if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && entry_ptr->coll_access) { - H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } /* end else-if */ #endif /* H5_HAVE_PARALLEL */ #if H5C_DO_TAGGING_SANITY_CHECKS @@ -3057,16 +3060,16 @@ H5C_protect(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { /* Make sure the size of the collective entries in the cache remain in check */ - if(TRUE == coll_access) { + if(coll_access) { if(H5P_USER_TRUE == f->coll_md_read) { if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) - if(H5C_clear_coll_entries(cache_ptr, 1) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries") } /* end if */ else { if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) - if(H5C_clear_coll_entries(cache_ptr, 1) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries") } /* end else */ } /* end if */ } /* end if */ @@ -7707,7 +7710,11 @@ done: */ herr_t H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, - unsigned flags, int64_t *entry_size_change_ptr, H5SL_t *collective_write_list) + unsigned flags, int64_t *entry_size_change_ptr, H5SL_t +#ifndef H5_HAVE_PARALLEL + H5_ATTR_UNUSED +#endif /* NDEBUG */ + *collective_write_list) { H5C_t * cache_ptr; /* Cache for file */ hbool_t destroy; /* external flag */ @@ -7718,11 +7725,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ hbool_t write_entry; /* internal flag */ hbool_t destroy_entry; /* internal flag */ hbool_t was_dirty; - haddr_t new_addr = HADDR_UNDEF; - haddr_t old_addr = HADDR_UNDEF; haddr_t entry_addr = HADDR_UNDEF; - size_t new_len = 0; - size_t new_compressed_len = 0; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -7807,7 +7810,6 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ /* serialize the entry if necessary, and then write it to disk. */ if(write_entry) { - unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; /* The entry is dirty, and we are doing either a flush, * or a flush destroy. In either case, serialize the @@ -7847,225 +7849,9 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ } /* end if */ if(!(entry_ptr->image_up_to_date)) { - /* reset cache_ptr->slist_changed so we can detect slist - * modifications in the pre_serialize call. - */ - cache_ptr->slist_changed = FALSE; - - /* make note of the entry's current address */ - old_addr = entry_ptr->addr; - - /* Call client's pre-serialize callback, if there's one */ - if ( ( entry_ptr->type->pre_serialize != NULL ) && - ( (entry_ptr->type->pre_serialize)(f, dxpl_id, - (void *)entry_ptr, - entry_ptr->addr, - entry_ptr->size, - entry_ptr->compressed_size, - &new_addr, &new_len, - &new_compressed_len, - &serialize_flags) < 0 ) ) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry") - - /* set cache_ptr->slist_change_in_pre_serialize if the - * slist was modified. - */ - if(cache_ptr->slist_changed) - cache_ptr->slist_change_in_pre_serialize = TRUE; - - /* Check for any flags set in the pre-serialize callback */ - if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { - /* Check for unexpected flags from serialize callback */ - if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | - H5C__SERIALIZE_MOVED_FLAG | - H5C__SERIALIZE_COMPRESSED_FLAG)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") -#ifdef H5_HAVE_PARALLEL - /* In the parallel case, resizes and moves in - * the serialize operation can cause problems. - * If they occur, scream and die. - * - * At present, in the parallel case, the aux_ptr - * will only be set if there is more than one - * process. Thus we can use this to detect - * the parallel case. - * - * This works for now, but if we start using the - * aux_ptr for other purposes, we will have to - * change this test accordingly. - * - * NB: While this test detects entryies that attempt - * to resize or move themselves during a flush - * in the parallel case, it will not detect an - * entry that dirties, resizes, and/or moves - * other entries during its flush. - * - * From what Quincey tells me, this test is - * sufficient for now, as any flush routine that - * does the latter will also do the former. - * - * If that ceases to be the case, further - * tests will be necessary. - */ - if(cache_ptr->aux_ptr != NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case.") -#endif /* H5_HAVE_PARALLEL */ - - /* Resize the buffer if required */ - if ( ( ( ! entry_ptr->compressed ) && - ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) ) || - ( ( entry_ptr->compressed ) && - ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) ) ) - { - size_t new_image_size; - - if(entry_ptr->compressed) - new_image_size = new_compressed_len; - else - new_image_size = new_len; - HDassert(new_image_size > 0); - - /* Release the current image */ - if(entry_ptr->image_ptr) - entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); - - /* Allocate a new image buffer */ - if(NULL == (entry_ptr->image_ptr = H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") -#if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ - - /* If required, update the entry and the cache data structures - * for a resize. - */ - if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { - H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, \ - entry_ptr, new_len) - - /* update the hash table for the size change*/ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, \ - entry_ptr->size, \ - new_len, entry_ptr, \ - !(entry_ptr->is_dirty)); - - /* The entry can't be protected since we are - * in the process of flushing it. Thus we must - * update the replacement policy data - * structures for the size change. The macro - * deals with the pinned case. - */ - H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); - - /* as we haven't updated the cache data structures for - * for the flush or flush destroy yet, the entry should - * be in the slist. Thus update it for the size change. - */ - HDassert(entry_ptr->in_slist); - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ - new_len) - - /* if defined, update *entry_size_change_ptr for the - * change in entry size. - */ - if(entry_size_change_ptr != NULL) - *entry_size_change_ptr = (int64_t)new_len - (int64_t)(entry_ptr->size); - - /* finally, update the entry for its new size */ - entry_ptr->size = new_len; - } /* end if */ - - /* If required, udate the entry and the cache data structures - * for a move - */ - if(serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { -#if H5C_DO_SANITY_CHECKS - int64_t saved_slist_len_increase; - int64_t saved_slist_size_increase; -#endif /* H5C_DO_SANITY_CHECKS */ - - H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) - - if(entry_ptr->addr == old_addr) { - /* we must update cache data structures for the - * change in address. - */ - - /* delete the entry from the hash table and the slist */ - H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr) - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) - - /* update the entry for its new address */ - entry_ptr->addr = new_addr; - - /* and then reinsert in the index and slist */ - H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) - -#if H5C_DO_SANITY_CHECKS - /* save cache_ptr->slist_len_increase and - * cache_ptr->slist_size_increase before the - * reinsertion into the slist, and restore - * them afterwards to avoid skewing our sanity - * checking. - */ - saved_slist_len_increase = cache_ptr->slist_len_increase; - saved_slist_size_increase = cache_ptr->slist_size_increase; -#endif /* H5C_DO_SANITY_CHECKS */ - - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - -#if H5C_DO_SANITY_CHECKS - cache_ptr->slist_len_increase = saved_slist_len_increase; - cache_ptr->slist_size_increase = saved_slist_size_increase; -#endif /* H5C_DO_SANITY_CHECKS */ - } - else /* move is alread done for us -- just do sanity checks */ - HDassert(entry_ptr->addr == new_addr); - } /* end if */ - - if(serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG) { - /* just save the new compressed entry size in - * entry_ptr->compressed_size. We don't need to - * do more, as compressed size is only used for I/O. - */ - HDassert(entry_ptr->compressed); - entry_ptr->compressed_size = new_compressed_len; - } - } /* end if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) */ - - /* Serialize object into buffer */ - { - size_t image_len; - - if(entry_ptr->compressed) - image_len = entry_ptr->compressed_size; - else - image_len = entry_ptr->size; - - /* reset cache_ptr->slist_changed so we can detect slist - * modifications in the serialize call. - */ - cache_ptr->slist_changed = FALSE; - - - if(entry_ptr->type->serialize(f, entry_ptr->image_ptr, - image_len, (void *)entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") - - /* set cache_ptr->slist_change_in_serialize if the - * slist was modified. - */ - if(cache_ptr->slist_changed) - cache_ptr->slist_change_in_pre_serialize = TRUE; - -#if H5C_DO_MEMORY_SANITY_CHECKS - HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + image_len, - H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE)); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - - entry_ptr->image_up_to_date = TRUE; - } + /* Generate the entry's image */ + if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, entry_size_change_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image") } /* end if ( ! (entry_ptr->image_up_to_date) ) */ /* Finally, write the image to disk. @@ -8091,10 +7877,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ #ifdef H5_HAVE_PARALLEL if(collective_write_list) { - H5C_collective_write_t *item = NULL; + H5C_collective_write_t *item; - if(NULL == (item = (H5C_collective_write_t *)H5MM_malloc(sizeof(H5C_collective_write_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate skip list item") + if(NULL == (item = (H5C_collective_write_t *)H5FL_MALLOC(H5C_collective_write_t))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "unable to allocate skip list item") item->length = image_size; item->free_buf = FALSE; @@ -8103,7 +7889,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ if(H5SL_insert(collective_write_list, item, &item->offset) < 0) { H5MM_free(item); - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to insert skip list item") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert skip list item") } /* end if */ } /* end if */ else @@ -8778,7 +8564,6 @@ H5C_load_entry(H5F_t * f, entry->clear_on_unprotect = FALSE; entry->flush_immediately = FALSE; entry->coll_access = coll_access; - entry->ind_access_while_coll = FALSE; #endif /* H5_HAVE_PARALLEL */ entry->flush_in_progress = FALSE; entry->destroy_in_progress = FALSE; @@ -8799,8 +8584,10 @@ H5C_load_entry(H5F_t * f, entry->aux_next = NULL; entry->aux_prev = NULL; +#ifdef H5_HAVE_PARALLEL entry->coll_next = NULL; entry->coll_prev = NULL; +#endif /* H5_HAVE_PARALLEL */ H5C__RESET_CACHE_ENTRY_STATS(entry); @@ -9018,13 +8805,6 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr->entries_scanned_to_make_space++; #endif /* H5C_COLLECT_CACHE_STATS */ -#ifdef H5_HAVE_PARALLEL - if(TRUE == entry_ptr->coll_access) { - entry_ptr->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } /* end if */ -#endif - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") } else { @@ -10207,9 +9987,22 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_get_entry_ring() */ + +/*------------------------------------------------------------------------- + * Function: H5C__generate_image + * + * Purpose: Serialize an entry and generate its image. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * 2/10/16 + * + *------------------------------------------------------------------------- + */ static herr_t -H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, - hid_t dxpl_id, int64_t *entry_size_change_ptr) +H5C__generate_image(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, + hid_t dxpl_id, int64_t *entry_size_change_ptr) { haddr_t new_addr = HADDR_UNDEF; haddr_t old_addr = HADDR_UNDEF; @@ -10218,8 +10011,9 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(!entry_ptr->image_up_to_date); /* reset cache_ptr->slist_changed so we can detect slist @@ -10231,93 +10025,91 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, old_addr = entry_ptr->addr; /* Call client's pre-serialize callback, if there's one */ - if ( ( entry_ptr->type->pre_serialize != NULL ) && - ( (entry_ptr->type->pre_serialize)(f, dxpl_id, - (void *)entry_ptr, - entry_ptr->addr, - entry_ptr->size, - entry_ptr->compressed_size, - &new_addr, &new_len, - &new_compressed_len, - &serialize_flags) < 0 ) ) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unable to pre-serialize entry"); - } + if(entry_ptr->type->pre_serialize && + (entry_ptr->type->pre_serialize)(f, dxpl_id, + (void *)entry_ptr, entry_ptr->addr, entry_ptr->size, + entry_ptr->compressed_size, &new_addr, &new_len, + &new_compressed_len, &serialize_flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry") /* set cache_ptr->slist_change_in_pre_serialize if the * slist was modified. */ - if ( cache_ptr->slist_changed ) + if(cache_ptr->slist_changed) cache_ptr->slist_change_in_pre_serialize = TRUE; /* Check for any flags set in the pre-serialize callback */ - if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) { + if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { /* Check for unexpected flags from serialize callback */ - if ( serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | - H5C__SERIALIZE_MOVED_FLAG | - H5C__SERIALIZE_COMPRESSED_FLAG)) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unknown serialize flag(s)"); - } + if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | + H5C__SERIALIZE_MOVED_FLAG | + H5C__SERIALIZE_COMPRESSED_FLAG)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") #ifdef H5_HAVE_PARALLEL - if ( cache_ptr->aux_ptr != NULL ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "resize/move in serialize occured in parallel case."); + /* In the parallel case, resizes and moves in + * the serialize operation can cause problems. + * If they occur, scream and die. + * + * At present, in the parallel case, the aux_ptr + * will only be set if there is more than one + * process. Thus we can use this to detect + * the parallel case. + * + * This works for now, but if we start using the + * aux_ptr for other purposes, we will have to + * change this test accordingly. + * + * NB: While this test detects entryies that attempt + * to resize or move themselves during a flush + * in the parallel case, it will not detect an + * entry that dirties, resizes, and/or moves + * other entries during its flush. + * + * From what Quincey tells me, this test is + * sufficient for now, as any flush routine that + * does the latter will also do the former. + * + * If that ceases to be the case, further + * tests will be necessary. + */ + if(cache_ptr->aux_ptr != NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case.") #endif /* Resize the buffer if required */ - if ( ( ( ! entry_ptr->compressed ) && - ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) ) || - ( ( entry_ptr->compressed ) && - ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) ) ) { + if(((!entry_ptr->compressed) && (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG)) || + ((entry_ptr->compressed) && (serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG))) { size_t new_image_size; - if ( entry_ptr->compressed ) + if(entry_ptr->compressed) new_image_size = new_compressed_len; else new_image_size = new_len; - HDassert(new_image_size > 0); /* Release the current image */ - if ( entry_ptr->image_ptr ) { + if(entry_ptr->image_ptr) entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); - } /* Allocate a new image buffer */ - entry_ptr->image_ptr = - H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE); - - if ( NULL == entry_ptr->image_ptr ) - { - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, \ - "memory allocation failed for on disk image buffer"); - } + if(NULL == (entry_ptr->image_ptr = H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, - H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE); - + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ /* If required, update the entry and the cache data structures * for a resize. */ - if ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) { - - H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, \ - entry_ptr, new_len); + if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { + H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); /* update the hash table for the size change*/ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, \ - entry_ptr->size, \ - new_len, entry_ptr, \ - !(entry_ptr->is_dirty)); + H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ + new_len, entry_ptr, !(entry_ptr->is_dirty)); /* The entry can't be protected since we are * in the process of flushing it. Thus we must @@ -10332,17 +10124,13 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, * be in the slist. Thus update it for the size change. */ HDassert(entry_ptr->in_slist); - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ - new_len); + H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len); /* if defined, update *entry_size_change_ptr for the * change in entry size. */ - if ( entry_size_change_ptr != NULL ) - { - *entry_size_change_ptr = (int64_t)new_len; - *entry_size_change_ptr -= (int64_t)(entry_ptr->size); - } + if(entry_size_change_ptr != NULL) + *entry_size_change_ptr = (int64_t)new_len - (int64_t)(entry_ptr->size); /* finally, update the entry for its new size */ entry_ptr->size = new_len; @@ -10359,7 +10147,7 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr); - if ( entry_ptr->addr == old_addr ) { + if(entry_ptr->addr == old_addr) { /* we must update cache data structures for the * change in address. */ @@ -10391,27 +10179,26 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, cache_ptr->slist_len_increase = saved_slist_len_increase; cache_ptr->slist_size_increase = saved_slist_size_increase; #endif /* H5C_DO_SANITY_CHECKS */ - } - else { + } /* end if */ + else /* move is already done for us -- just do sanity checks */ HDassert(entry_ptr->addr == new_addr); - } } /* end if */ - if ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) { + if(serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG) { /* just save the new compressed entry size in * entry_ptr->compressed_size. We don't need to * do more, as compressed size is only used for I/O. */ HDassert(entry_ptr->compressed); entry_ptr->compressed_size = new_compressed_len; - } - } /* end if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) */ + } /* end if */ + } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */ /* Serialize object into buffer */ { size_t image_len; - if ( entry_ptr->compressed ) + if(entry_ptr->compressed) image_len = entry_ptr->compressed_size; else image_len = entry_ptr->size; @@ -10420,33 +10207,25 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, * modifications in the serialize call. */ cache_ptr->slist_changed = FALSE; - - if ( entry_ptr->type->serialize(f, entry_ptr->image_ptr, - image_len, - (void *)entry_ptr) < 0) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unable to serialize entry"); - } + if(entry_ptr->type->serialize(f, entry_ptr->image_ptr, image_len, (void *)entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") /* set cache_ptr->slist_change_in_serialize if the * slist was modified. */ - if ( cache_ptr->slist_changed ) + if(cache_ptr->slist_changed) cache_ptr->slist_change_in_pre_serialize = TRUE; #if H5C_DO_MEMORY_SANITY_CHECKS - - HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + - image_len, - H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE)); - + HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + image_len, + H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE)); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ entry_ptr->image_up_to_date = TRUE; - } + } /* end block */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__generate_image */ + diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index e17aacd..4e88e44 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -43,13 +43,13 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ #include "H5FDprivate.h" /* File drivers */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#include "H5SLprivate.h" /* Skip lists */ -#ifdef H5_HAVE_PARALLEL +#ifdef H5_HAVE_PARALLEL /****************/ /* Local Macros */ /****************/ @@ -64,6 +64,9 @@ /********************/ /* Local Prototypes */ /********************/ +static herr_t H5C__collective_write(H5F_t *f, hid_t dxpl_id, + H5SL_t *collective_write_list); +static herr_t H5C__collective_write_free(void *_item, void *key, void *op_data); /*********************/ @@ -80,6 +83,9 @@ /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5C_collective_write_t struct */ +H5FL_DEFINE(H5C_collective_write_t); + /*------------------------------------------------------------------------- @@ -261,7 +267,7 @@ H5C_apply_candidate_list(H5F_t * f, /* Create skip list of entries for collective write */ if(NULL == (collective_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") - } + } /* end if */ n = num_candidates / mpi_size; m = num_candidates % mpi_size; @@ -376,7 +382,7 @@ H5C_apply_candidate_list(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ } /* end else */ } /* end for */ @@ -453,10 +459,8 @@ H5C_apply_candidate_list(H5F_t * f, * will not call either the pre_serialize or serialize callbacks. */ - if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } /* end if */ /* Else, if this process needs to flush this entry. */ @@ -500,9 +504,9 @@ H5C_apply_candidate_list(H5F_t * f, cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; - if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.") + /* Add this entry to the list of entries to collectively write */ + if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") if ( ( cache_ptr->entries_removed_counter > 1 ) || ( cache_ptr->last_entry_removed_ptr == entry_ptr ) ) @@ -655,14 +659,12 @@ H5C_apply_candidate_list(H5F_t * f, entries_cleared++; #if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 ) - HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank, - (long long)clear_ptr->addr); + HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank, + (long long)clear_ptr->addr); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } /* end else-if */ /* Else, if this process needs to independently flush this entry. */ @@ -677,9 +679,9 @@ H5C_apply_candidate_list(H5F_t * f, (long long)flush_ptr->addr); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + /* Add this entry to the list of entries to collectively write */ + if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } /* end else-if */ } /* end if */ @@ -712,16 +714,15 @@ H5C_apply_candidate_list(H5F_t * f, if (delayed_ptr) { if (delayed_ptr->clear_on_unprotect) { - if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, - NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.") + if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") entry_ptr->clear_on_unprotect = FALSE; entries_cleared++; } else if (delayed_ptr->flush_immediately) { - if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.") + /* Add this entry to the list of entries to collectively write */ + if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry collectively.") entry_ptr->flush_immediately = FALSE; entries_flushed++; @@ -731,15 +732,15 @@ H5C_apply_candidate_list(H5F_t * f, entries_flushed_or_cleared_last++; } /* end if */ + /* If we've deferred writing to do it collectively, take care of that now */ if(f->coll_md_write) { HDassert(collective_write_list); /* Write collective list */ - if(H5C_collective_write(f, - dxpl_id, - collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't write metadata collectively") - } + if(H5C__collective_write(f, dxpl_id, collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "Can't write metadata collectively") + } /* end if */ + /* ====================================================================== * * Finished flushing everything. * * ====================================================================== */ @@ -750,9 +751,9 @@ H5C_apply_candidate_list(H5F_t * f, HDassert((entries_flushed_collectively == entries_to_flush_collectively)); if((entries_flushed != entries_to_flush) || - (entries_cleared != entries_to_clear) || - (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) || - (entries_flushed_collectively != entries_to_flush_collectively)) + (entries_cleared != entries_to_clear) || + (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) || + (entries_flushed_collectively != entries_to_flush_collectively)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry count mismatch.") done: @@ -760,7 +761,7 @@ done: candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table); if(collective_write_list) - if(H5SL_destroy(collective_write_list, H5C_collective_write_free, NULL) < 0) + if(H5SL_destroy(collective_write_list, H5C__collective_write_free, NULL) < 0) HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list") FUNC_LEAVE_NOAPI(ret_value) @@ -1132,7 +1133,7 @@ H5C_mark_entries_as_clean(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ entry_ptr->clear_on_unprotect = TRUE; #if H5C_DO_SANITY_CHECKS @@ -1194,10 +1195,8 @@ H5C_mark_entries_as_clean(H5F_t * f, entry_ptr = entry_ptr->prev; entries_cleared++; - if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } else { entry_ptr = entry_ptr->prev; @@ -1224,10 +1223,8 @@ H5C_mark_entries_as_clean(H5F_t * f, entry_ptr = entry_ptr->next; entries_cleared++; - if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, NULL) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } else { entry_ptr = entry_ptr->next; @@ -1288,78 +1285,95 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial) +H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) { - int32_t list_len, coll_entries_cleared = 0; + int32_t clear_cnt; H5C_cache_entry_t * entry_ptr = NULL; - H5C_cache_entry_t * prev_ptr; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT entry_ptr = cache_ptr->coll_tail_ptr; - list_len = cache_ptr->coll_list_len; - - while(entry_ptr && (coll_entries_cleared < (partial ? list_len/2 : list_len))) { - prev_ptr = entry_ptr->coll_prev; + clear_cnt = (partial ? cache_ptr->coll_list_len / 2 : cache_ptr->coll_list_len); + while(entry_ptr && clear_cnt > 0) { + H5C_cache_entry_t *prev_ptr = entry_ptr->coll_prev; + /* Sanity check */ HDassert(entry_ptr->coll_access); + /* Mark entry as independent */ entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - coll_entries_cleared ++; + /* Decrement entry count */ + clear_cnt--; + + /* Advance to next entry */ entry_ptr = prev_ptr; - } + } /* end while */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_clear_coll_entries */ -herr_t -H5C_collective_write(H5F_t *f, - hid_t dxpl_id, - H5SL_t *collective_write_list) + +/*------------------------------------------------------------------------- + * + * Function: H5C__collective_write + * + * Purpose: Perform a collective write of a list of metadata entries. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mohamad Chaarawi + * February, 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__collective_write(H5F_t *f, hid_t dxpl_id, H5SL_t *collective_write_list) { H5P_genplist_t *plist = NULL; - H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE; - H5FD_mpio_xfer_t orig_xfer_mode; - H5SL_node_t *node; - H5C_collective_write_t *item; + H5FD_mpio_xfer_t orig_xfer_mode = H5FD_MPIO_COLLECTIVE; int count; - void *base_buf; int *length_array = NULL; MPI_Aint *buf_array = NULL; MPI_Aint *offset_array = NULL; MPI_Datatype btype; - MPI_Datatype ftype; hbool_t btype_created = FALSE; + MPI_Datatype ftype; hbool_t ftype_created = FALSE; int mpi_code; - int i; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT - - count = (int)H5SL_count(collective_write_list); + FUNC_ENTER_STATIC + /* Get original transfer mode */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") - if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &orig_xfer_mode) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") + /* Get number of entries in collective write list */ + count = (int)H5SL_count(collective_write_list); + if(count > 0) { + H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE; + H5SL_node_t *node; + H5C_collective_write_t *item; + void *base_buf; + int i; + if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") /* Allocate arrays */ if(NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective write table length array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective write table length array") if(NULL == (buf_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective buf table length array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective buf table length array") if(NULL == (offset_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective offset table length array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective offset table length array") /* Fill arrays */ node = H5SL_first(collective_write_list); @@ -1367,6 +1381,7 @@ H5C_collective_write(H5F_t *f, if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node))) HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + /* Set up initial array position & buffer base address */ length_array[0] = (int)item->length; base_buf = item->buf; buf_array[0] = (MPI_Aint)0; @@ -1378,28 +1393,31 @@ H5C_collective_write(H5F_t *f, if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node))) HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + /* Set up array position */ length_array[i] = (int)item->length; buf_array[i] = (MPI_Aint)item->buf - (MPI_Aint)base_buf; offset_array[i] = (MPI_Aint)item->offset; + + /* Advance to next node & array location */ node = H5SL_next(node); i++; } /* end while */ - /* Create memory mpi type */ + /* Create memory MPI type */ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) btype_created = TRUE; if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - /* Create file mpi type */ + /* Create file MPI type */ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) ftype_created = TRUE; if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - /* Pass buf type, file type to the file driver. */ + /* Pass buf type, file type to the file driver */ if(H5FD_mpi_setup_collective(dxpl_id, &btype, &ftype) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O properties") @@ -1417,19 +1435,16 @@ H5C_collective_write(H5F_t *f, mpi_fh = *(MPI_File*)mpi_fh_p; /* just to match up with the 1st MPI_File_set_view from H5FD_mpio_write() */ - if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, - MPI_BYTE, "native", MPI_INFO_NULL))) + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) /* just to match up with MPI_File_write_at_all from H5FD_mpio_write() */ HDmemset(&mpi_stat, 0, sizeof(MPI_Status)); - if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, - MPI_BYTE, &mpi_stat))) + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, MPI_BYTE, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) /* just to match up with the 2nd MPI_File_set_view (reset) in H5FD_mpio_write() */ - if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, - MPI_BYTE, "native", MPI_INFO_NULL))) + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end else */ @@ -1453,23 +1468,37 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value); -} /* end H5C_collective_write() */ +} /* end H5C__collective_write() */ -herr_t -H5C_collective_write_free(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) + +/*------------------------------------------------------------------------- + * + * Function: H5C__collective_write_free + * + * Purpose: Release node on collective write skiplist + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mohamad Chaarawi + * February, 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__collective_write_free(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) { H5C_collective_write_t *item = (H5C_collective_write_t *)_item; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - HDassert(item); + /* Sanity check */ + HDassert(item); if(item->free_buf) item->buf = H5MM_xfree(item->buf); - /*!FIXME change to use free list for items */ - H5MM_free(item); + H5FL_FREE(H5C_collective_write_t, item); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5C_collective_write_free() */ +} /* end H5C__collective_write_free() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 2f4d137..08be52b 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -3133,11 +3133,11 @@ if ( ( (entry_ptr) == NULL ) || \ (cache_ptr)->coll_list_size, \ (fail_val)) \ \ - H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ - (cache_ptr)->coll_tail_ptr, \ - (cache_ptr)->coll_list_len, \ - (cache_ptr)->coll_list_size, \ - (fail_val)) \ + H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ \ } /* H5C__MOVE_TO_TOP_IN_COLL_LIST */ #endif /* H5_HAVE_PARALLEL */ @@ -4254,6 +4254,7 @@ typedef struct H5C_collective_write_t { } H5C_collective_write_t; #endif /* H5_HAVE_PARALLEL */ + /*****************************/ /* Package Private Variables */ /*****************************/ @@ -4264,10 +4265,6 @@ typedef struct H5C_collective_write_t { /******************************/ H5_DLL herr_t H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, unsigned flags, int64_t *entry_size_change_ptr, H5SL_t *collective_write_list); -#ifdef H5_HAVE_PARALLEL -H5_DLL herr_t H5C_collective_write(H5F_t *f, hid_t dxpl_id, H5SL_t *collective_write_list); -H5_DLL herr_t H5C_collective_write_free(void *_item, void *key, void *op_data); -#endif /* H5_HAVE_PARALLEL */ #endif /* _H5Cpkg_H */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 5ad026b..5502e9f 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1609,7 +1609,6 @@ typedef struct H5C_cache_entry_t { hbool_t clear_on_unprotect; hbool_t flush_immediately; hbool_t coll_access; - hbool_t ind_access_while_coll; #endif /* H5_HAVE_PARALLEL */ hbool_t flush_in_progress; hbool_t destroy_in_progress; @@ -1633,8 +1632,10 @@ typedef struct H5C_cache_entry_t { struct H5C_cache_entry_t * prev; struct H5C_cache_entry_t * aux_next; struct H5C_cache_entry_t * aux_prev; +#ifdef H5_HAVE_PARALLEL struct H5C_cache_entry_t * coll_next; struct H5C_cache_entry_t * coll_prev; +#endif /* H5_HAVE_PARALLEL */ #if H5C_COLLECT_CACHE_ENTRY_STATS /* cache entry stats fields */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 37e48ba..a17e035 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -45,7 +45,7 @@ /****************/ #include "H5Dmodule.h" /* This source code file is part of the H5D module */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ + /***********/ /* Headers */ @@ -56,7 +56,7 @@ #endif /* H5_HAVE_PARALLEL */ #include "H5Dpkg.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File functions */ +#include "H5Fprivate.h" /* File functions */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -2652,7 +2652,7 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, if(!H5D__chunk_cinfo_cache_found(&dset->shared->cache.chunk.last, udata)) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ #ifdef H5_HAVE_PARALLEL - H5P_coll_md_read_flag_t temp_flag; /* temp flag to hold the coll metadata read setting */ + H5P_coll_md_read_flag_t temp_cmr; /* Temp value to hold the coll metadata read setting */ #endif /* H5_HAVE_PARALLEL */ /* Compose chunked index info struct */ @@ -2668,9 +2668,9 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, as it is highly unlikely that users would read the same chunks from all processes. MSC - might turn on for root node? */ - temp_flag = idx_info.f->coll_md_read; - idx_info.f->coll_md_read = H5P_FORCE_FALSE; - } + temp_cmr = H5F_COLL_MD_READ(idx_info.f); + H5F_set_coll_md_read(idx_info.f, H5P_FORCE_FALSE); + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* Go get the chunk information */ @@ -2678,9 +2678,8 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) { - idx_info.f->coll_md_read = temp_flag; - } + if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) + H5F_set_coll_md_read(idx_info.f, temp_cmr); #endif /* H5_HAVE_PARALLEL */ /* Cache the information retrieved */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 1753917..82545c1 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -141,8 +141,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Build and open the new dataset */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, - dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ diff --git a/src/H5Fint.c b/src/H5Fint.c index ea6c9c1..063b65f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2110,3 +2110,33 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__set_eoa() */ +#ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * Function: H5F_set_coll_md_read + * + * Purpose: Set the coll_md_read field with a new value. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Quincey Koziol + * 2/10/16 + * + *------------------------------------------------------------------------- + */ +void +H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(f); + + f->coll_md_read = cmr; + + FUNC_LEAVE_NOAPI_VOID +} /* H5F_set_coll_md_read() */ +#endif /* H5_HAVE_PARALLEL */ + diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 7decaed..52649e5 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -27,6 +27,9 @@ #include "H5FDpublic.h" /* File drivers */ /* Private headers needed by this file */ +#ifdef H5_HAVE_PARALLEL +#include "H5Pprivate.h" /* Property lists */ +#endif /* H5_HAVE_PARALLEL */ #include "H5VMprivate.h" /* Vectors and arrays */ @@ -312,6 +315,9 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL) #define H5F_USE_TMP_SPACE(F) ((F)->shared->use_tmp_space) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR))) +#ifdef H5_HAVE_PARALLEL +#define H5F_COLL_MD_READ(F) ((F)->coll_md_read) +#endif /* H5_HAVE_PARALLEL */ #else /* H5F_MODULE */ #define H5F_INTENT(F) (H5F_get_intent(F)) #define H5F_OPEN_NAME(F) (H5F_get_open_name(F)) @@ -354,6 +360,9 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC))) #define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F)) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR))) +#ifdef H5_HAVE_PARALLEL +#define H5F_COLL_MD_READ(F) (H5F_coll_md_read(F)) +#endif /* H5_HAVE_PARALLEL */ #endif /* H5F_MODULE */ @@ -639,6 +648,10 @@ H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f); H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5UC_t *rc); H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f); H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr); +#ifdef H5_HAVE_PARALLEL +H5_DLL H5P_coll_md_read_flag_t H5F_coll_md_read(const H5F_t *f); +H5_DLL void H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t flag); +#endif /* H5_HAVE_PARALLEL */ /* Functions that retrieve values from VFD layer */ H5_DLL hid_t H5F_get_driver_id(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 75fc216..e9af300 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1073,3 +1073,31 @@ H5F_use_tmp_space(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->use_tmp_space) } /* end H5F_use_tmp_space() */ +#ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * Function: H5F_coll_md_read + * + * Purpose: Retrieve the 'collective metadata reads' flag for the file. + * + * Return: Success: Non-negative, the 'collective metadata reads' flag + * Failure: (can't happen) + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Feb 10 2016 + * + *------------------------------------------------------------------------- + */ +H5P_coll_md_read_flag_t +H5F_coll_md_read(const H5F_t *f) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + + FUNC_LEAVE_NOAPI(f->coll_md_read) +} /* end H5F_coll_md_read() */ +#endif /* H5_HAVE_PARALLEL */ + diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 535e34b..9353094 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -179,7 +179,6 @@ #ifdef H5_DEBUG_BUILD /* dxpl I/O type - private property */ #define H5FD_DXPL_TYPE_SIZE sizeof(H5FD_dxpl_type_t) -#define H5FD_DXPL_TYPE_DEF H5FD_NOIO_DXPL #endif /* H5_DEBUG_BUILD */ #ifdef H5_HAVE_PARALLEL /* Definition for reading metadata collectively */ @@ -187,7 +186,9 @@ #define H5D_XFER_COLL_MD_READ_DEF H5P_USER_FALSE #define H5D_XFER_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t #define H5D_XFER_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t -#endif H5_HAVE_PARALLEL +#endif /* H5_HAVE_PARALLEL */ + + /******************/ /* Local Typedefs */ /******************/ diff --git a/src/H5Pint.c b/src/H5Pint.c index 3c145c5..a222082 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -29,7 +29,9 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#ifdef H5_HAVE_PARALLEL +#include "H5ACprivate.h" /* Metadata cache */ +#endif /* H5_HAVE_PARALLEL */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free lists */ @@ -5452,7 +5454,15 @@ H5P_get_class(const H5P_genplist_t *plist) */ herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id, - hid_t loc_id, hbool_t is_collective) + hid_t +#ifndef H5_HAVE_PARALLEL + H5_ATTR_UNUSED +#endif /* H5_HAVE_PARALLEL */ + loc_id, hbool_t +#ifndef H5_HAVE_PARALLEL + H5_ATTR_UNUSED +#endif /* H5_HAVE_PARALLEL */ + is_collective) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5495,8 +5505,6 @@ H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t * if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id)) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") - *dxpl_id = H5AC_ind_read_dxpl_id; - #ifdef H5_HAVE_PARALLEL /* Get the plist structure for the access property list */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id))) diff --git a/src/H5Plapl.c b/src/H5Plapl.c index cba2f88..f2711e8 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -94,6 +94,7 @@ #define H5L_ACS_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t #define H5L_ACS_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t + /******************/ /* Local Typedefs */ /******************/ @@ -222,8 +223,7 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, - &H5L_def_coll_md_read_g, + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index be2bceb..29fb919 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -41,13 +41,13 @@ #define H5P_CLASS(P) (H5P_get_class(P)) #endif /* H5P_MODULE */ +#define H5_COLL_MD_READ_FLAG_NAME "collective_metadata_read" + /****************************/ /* Library Private Typedefs */ /****************************/ -#define H5_COLL_MD_READ_FLAG_NAME "collective_metadata_read" - typedef enum H5P_coll_md_read_flag_t { H5P_FORCE_FALSE = -1, H5P_USER_FALSE = 0, diff --git a/src/H5R.c b/src/H5R.c index f0aafc3..bc49364 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -611,10 +611,10 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - + /* Verify access property list and get correct dxpl */ if(H5P_verify_apl_and_dxpl(&oapl_id, H5P_CLS_DACC, &dxpl_id, obj_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the file pointer from the entry */ file = loc.oloc->file; diff --git a/testpar/t_cache.c b/testpar/t_cache.c index d7a12fe..48beb80 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7595,7 +7595,7 @@ main(int argc, char **argv) #endif /* enable the collective metadata read property */ if ( world_mpi_rank != world_server_mpi_rank ) { - if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { + if ( H5Pset_coll_metadata_read(fapl, TRUE) < 0 ) { nerrors++; if ( verbose ) { diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index f718f5b..66d6f49 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -888,7 +888,7 @@ void independent_group_read(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); - H5Pset_coll_metadata_read(plist, 0); + H5Pset_coll_metadata_read(plist, FALSE); fid = H5Fopen(filename, H5F_ACC_RDONLY, plist); H5Pclose(plist); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 1b856d0..106dd7b 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4948,9 +4948,9 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, true); + ret = H5Pset_coll_metadata_read(ret_pl, TRUE); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); + ret = H5Pset_coll_metadata_write(ret_pl, TRUE); VRFY((ret >= 0), ""); return(ret_pl); } diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index b5ebb98..8ff0dc6 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -272,9 +272,9 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, true); + ret = H5Pset_coll_metadata_read(ret_pl, TRUE); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); + ret = H5Pset_coll_metadata_write(ret_pl, TRUE); VRFY((ret >= 0), ""); return(ret_pl); } @@ -536,6 +536,7 @@ int main(int argc, char **argv) AddTest("denseattr", test_dense_attr, NULL, "Store Dense Attributes", PARATESTFILE); + /* Display testing information */ TestInfo(argv[0]); -- cgit v0.12 From 25f271d84bb56b1f318545fb04dc5f7564417f13 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Wed, 10 Feb 2016 13:19:12 -0500 Subject: [svn-r29079] rename the coll read requirement function. --- UserMacros.cmake | 2 +- src/H5Pfapl.c | 6 +++--- src/H5Ppublic.h | 2 +- testpar/t_cache.c | 4 ++-- testpar/t_mdset.c | 3 ++- testpar/t_shapesame.c | 2 +- testpar/testphdf5.c | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/UserMacros.cmake b/UserMacros.cmake index 65ea5d4..cb8739f 100644 --- a/UserMacros.cmake +++ b/UserMacros.cmake @@ -19,4 +19,4 @@ endif (BUILD_USER_DEFINED_LIBS) #----------------------------------------------------------------------------- #------------------- E X A M P L E E N D ----------------------------------- #----------------------------------------------------------------------------- - \ No newline at end of file + diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 75f9e7c..d90dcd5 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -3581,7 +3581,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- - * Function: H5Pset_coll_metadata_read + * Function: H5Pset_all_coll_metadata_ops * * Purpose: Tell the library whether the metadata read operations will * be done collectively (1) or not (0). Default is independent. @@ -3602,7 +3602,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) *------------------------------------------------------------------------- */ herr_t -H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective) +H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective) { H5P_genplist_t *plist; /* Property list pointer */ H5P_coll_md_read_flag_t coll_meta_read; /* Property value */ @@ -3636,7 +3636,7 @@ H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective) done: FUNC_LEAVE_API(ret_value) -} /* end H5Pset_coll_metadata_read() */ +} /* end H5Pset_all_coll_metadata_ops() */ /*------------------------------------------------------------------------- diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 1820625..9308339 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -352,7 +352,7 @@ H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); #ifdef H5_HAVE_PARALLEL -H5_DLL herr_t H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective); +H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective); H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective); diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 48beb80..a5db9d7 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7595,11 +7595,11 @@ main(int argc, char **argv) #endif /* enable the collective metadata read property */ if ( world_mpi_rank != world_server_mpi_rank ) { - if ( H5Pset_coll_metadata_read(fapl, TRUE) < 0 ) { + if ( H5Pset_all_coll_metadata_ops(fapl, TRUE) < 0 ) { nerrors++; if ( verbose ) { - HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + HDfprintf(stdout, "%d:%s: H5Pset_all_coll_metadata_ops() failed 1.\n", world_mpi_rank, FUNC); } } diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 66d6f49..c88cb86 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -888,7 +888,8 @@ void independent_group_read(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); - H5Pset_coll_metadata_read(plist, FALSE); + H5Pset_all_coll_metadata_ops(plist, FALSE); + fid = H5Fopen(filename, H5F_ACC_RDONLY, plist); H5Pclose(plist); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 106dd7b..8be1610 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4948,7 +4948,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, TRUE); + ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE); VRFY((ret >= 0), ""); ret = H5Pset_coll_metadata_write(ret_pl, TRUE); VRFY((ret >= 0), ""); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 8ff0dc6..abe074a 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -272,7 +272,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, TRUE); + ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE); VRFY((ret >= 0), ""); ret = H5Pset_coll_metadata_write(ret_pl, TRUE); VRFY((ret >= 0), ""); -- cgit v0.12