From 584115efb2d3334aedff5d36ad5b34d49abda718 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 10 Mar 2014 14:14:37 -0500 Subject: [svn-r24774] add persist flag to H5Fclose_ff. --- src/H5FF.c | 20 ++++++++++++++++---- src/H5FFpublic.h | 2 +- src/H5VLiod.c | 3 +++ src/H5VLiod_client.h | 1 + src/H5VLiod_common.h | 1 + src/H5VLiod_file.c | 11 +++++++++++ src/H5VLiod_server.c | 2 +- 7 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/H5FF.c b/src/H5FF.c index 002af4d..ef151ef 100644 --- a/src/H5FF.c +++ b/src/H5FF.c @@ -278,7 +278,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Fclose_ff(hid_t file_id, hid_t estack_id) +H5Fclose_ff(hid_t file_id, hbool_t persist_flag, hid_t estack_id) { H5VL_t *vol_plugin = NULL; herr_t ret_value = SUCCEED; @@ -286,9 +286,21 @@ H5Fclose_ff(hid_t file_id, hid_t estack_id) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ii", file_id, estack_id); - /* Check/fix arguments. */ - if(H5I_FILE != H5I_get_type(file_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") + /* If persist flag is FALSE (non-default), then set that flag in the file struct */ + if(FALSE == persist_flag) { + H5VL_iod_file_t *file = NULL; + + /* Check/fix arguments. */ + if(NULL == (file = (H5VL_iod_file_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID"); + + file->persist_on_close = persist_flag; + } + else { + /* Check/fix arguments. */ + if(H5I_FILE != H5I_get_type(file_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") + } /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) diff --git a/src/H5FFpublic.h b/src/H5FFpublic.h index c77e219..4f07449 100644 --- a/src/H5FFpublic.h +++ b/src/H5FFpublic.h @@ -78,7 +78,7 @@ H5_DLL hid_t H5Fcreate_ff(const char *filename, unsigned flags, hid_t fcpl, hid_t fapl, hid_t estack_id); H5_DLL hid_t H5Fopen_ff(const char *filename, unsigned flags, hid_t fapl_id, hid_t *rcxt_id, hid_t estack_id); -H5_DLL herr_t H5Fclose_ff(hid_t file_id, hid_t estack_id); +H5_DLL herr_t H5Fclose_ff(hid_t file_id, hbool_t persist_flag, hid_t estack_id); H5_DLL hid_t H5Gcreate_ff(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t trans_id, hid_t estack_id); diff --git a/src/H5VLiod.c b/src/H5VLiod.c index 1d1cb8e..50b9818 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -1826,6 +1826,7 @@ H5VL_iod_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "failed to copy fapl"); file->nopen_objs = 1; file->num_req = 0; + file->persist_on_close = TRUE; /* initialize head and tail of the container's linked list of requests */ file->request_list_head = NULL; @@ -1966,6 +1967,7 @@ H5VL_iod_file_open(const char *name, unsigned flags, hid_t fapl_id, HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "failed to copy fapl"); file->nopen_objs = 1; file->num_req = 0; + file->persist_on_close = TRUE; /* initialize head and tail of the container's linked list */ file->request_list_head = NULL; @@ -2285,6 +2287,7 @@ H5VL_iod_file_close(void *_file, hid_t UNUSED dxpl_id, void **req) input.root_oh = file->remote_file.root_oh; input.root_id = file->remote_file.root_id; input.cs_scope = file->md_integrity_scope; + input.persist_on_close = file->persist_on_close; if(file->num_req) { H5VL_iod_request_t *cur_req = file->request_list_head; diff --git a/src/H5VLiod_client.h b/src/H5VLiod_client.h index 01ccaf8..209b87b 100644 --- a/src/H5VLiod_client.h +++ b/src/H5VLiod_client.h @@ -232,6 +232,7 @@ typedef struct H5VL_iod_file_t { int my_rank; int num_procs; size_t num_req; + hbool_t persist_on_close; unsigned nopen_objs; H5VL_iod_request_t *request_list_head; H5VL_iod_request_t *request_list_tail; diff --git a/src/H5VLiod_common.h b/src/H5VLiod_common.h index 36e13ac..2ef6103 100644 --- a/src/H5VLiod_common.h +++ b/src/H5VLiod_common.h @@ -233,6 +233,7 @@ MERCURY_GEN_PROC(file_close_in_t, ((iod_handle_t)(coh)) ((iod_handles_t)(root_oh)) ((iod_obj_id_t)(root_id)) + ((hbool_t)(persist_on_close)) ((iod_obj_id_t)(max_kv_index)) ((iod_obj_id_t)(max_array_index)) ((iod_obj_id_t)(max_blob_index))) diff --git a/src/H5VLiod_file.c b/src/H5VLiod_file.c index 775efdf..7380f65 100644 --- a/src/H5VLiod_file.c +++ b/src/H5VLiod_file.c @@ -698,7 +698,9 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, if(ret != 0) HGOTO_ERROR_IOD(ret, FAIL, "can't get number of KV entries"); +#if H5VL_IOD_DEBUG fprintf(stderr, "NUM entries in OID index KV = %d\n", num_entries); +#endif if(num_entries) { kvs = (iod_kv_params_t *)malloc(sizeof(iod_kv_params_t) * (size_t)num_entries); @@ -743,6 +745,15 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, /* finish the transaction */ if(iod_trans_finish(coh, trans_num, NULL, 0, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTSET, FAIL, "can't finish transaction"); + + if(TRUE == input->persist_on_close) { +#if H5VL_IOD_DEBUG + fprintf(stderr, "Persisting Last TID (%"PRIu64") before closing\n", trans_num); +#endif + /* persist the last transaction */ + if(iod_trans_persist(coh, trans_num, NULL, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTSET, FAIL, "can't persist before closing container"); + } } #if H5VL_IOD_DEBUG diff --git a/src/H5VLiod_server.c b/src/H5VLiod_server.c index c9e04e0..bcb8e61 100644 --- a/src/H5VLiod_server.c +++ b/src/H5VLiod_server.c @@ -310,7 +310,7 @@ EFF_start_server(MPI_Comm comm, MPI_Info UNUSED info) return FAIL; /* Set number of threads in AXE engine */ - if(AXEset_num_threads(&engine_attr, 4) != AXE_SUCCEED) + if(AXEset_num_threads(&engine_attr, 16) != AXE_SUCCEED) return FAIL; /* Create AXE engine */ -- cgit v0.12