diff options
Diffstat (limited to 'src/H5Fmpi.c')
-rw-r--r-- | src/H5Fmpi.c | 87 |
1 files changed, 36 insertions, 51 deletions
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 02f93f7..d930c1f 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -26,56 +26,47 @@ /* Module Setup */ /****************/ -#include "H5Fmodule.h" /* This source code file is part of the H5F module */ - +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Iprivate.h" /* IDs */ #include "H5VLnative_private.h" /* Native VOL connector */ - /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Package Typedefs */ /********************/ - /********************/ /* Local Prototypes */ /********************/ - /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- @@ -92,7 +83,7 @@ herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle) { herr_t ret_value = SUCCEED; - hid_t fapl_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; FUNC_ENTER_NOAPI(FAIL) @@ -106,7 +97,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_mpi_handle() */ - /*------------------------------------------------------------------------- * Function: H5F_mpi_get_rank * @@ -138,7 +128,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_mpi_get_rank() */ - /*------------------------------------------------------------------------- * Function: H5F_mpi_get_comm * @@ -156,7 +145,7 @@ done: MPI_Comm H5F_mpi_get_comm(const H5F_t *f) { - MPI_Comm ret_value = MPI_COMM_NULL; + MPI_Comm ret_value = MPI_COMM_NULL; FUNC_ENTER_NOAPI(MPI_COMM_NULL) @@ -170,7 +159,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_mpi_get_comm() */ - /*------------------------------------------------------------------------- * Function: H5F_shared_mpi_get_size * @@ -195,14 +183,13 @@ H5F_shared_mpi_get_size(const H5F_shared_t *f_sh) HDassert(f_sh); /* Dispatch to driver */ - if((ret_value = H5FD_mpi_get_size(f_sh->lf)) < 0) + if ((ret_value = H5FD_mpi_get_size(f_sh->lf)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_size request failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_shared_mpi_get_size() */ - /*------------------------------------------------------------------------- * Function: H5F_mpi_get_size * @@ -234,7 +221,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_mpi_get_size() */ - /*------------------------------------------------------------------------- * Function: H5F_set_mpi_atomicity * @@ -247,7 +233,7 @@ done: herr_t H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL); @@ -256,7 +242,8 @@ H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag) /* Check VFD */ if (!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, does not support MPI atomicity mode"); + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, + "incorrect VFL driver, does not support MPI atomicity mode"); /* Set atomicity value */ if (H5FD_set_mpio_atomicity(file->shared->lf, flag) < 0) @@ -266,7 +253,6 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5F_set_mpi_atomicity() */ - /*------------------------------------------------------------------------- * Function: H5Fset_mpi_atomicity * @@ -283,26 +269,26 @@ done: herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) { - H5VL_object_t *vol_obj = NULL; - int va_flag = (int)flag; /* C is grumpy about passing hbool_t via va_arg */ - herr_t ret_value = SUCCEED; + H5VL_object_t *vol_obj = NULL; + int va_flag = (int)flag; /* C is grumpy about passing hbool_t via va_arg */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL); H5TRACE2("e", "ib", file_id, flag); /* Get the file object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set atomicity value */ - if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, va_flag) < 0) + if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, va_flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set MPI atomicity"); done: FUNC_LEAVE_API(ret_value); } /* end H5Fset_mpi_atomicity() */ - /*------------------------------------------------------------------------- * Function: H5F_get_mpi_atomicity * @@ -315,7 +301,7 @@ done: herr_t H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL); @@ -325,7 +311,8 @@ H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag) /* Check VFD */ if (!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, does not support MPI atomicity mode"); + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, + "incorrect VFL driver, does not support MPI atomicity mode"); /* Get atomicity value */ if (H5FD_get_mpio_atomicity(file->shared->lf, flag) < 0) @@ -335,7 +322,6 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5F_get_mpi_atomicity() */ - /*------------------------------------------------------------------------- * Function: H5Fget_mpi_atomicity * @@ -352,25 +338,25 @@ done: herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) { - H5VL_object_t *vol_obj = NULL; - herr_t ret_value = SUCCEED; + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL); H5TRACE2("e", "i*b", file_id, flag); /* Get the file object */ - if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Get atomicity value */ - if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, flag) < 0) + if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MPI atomicity"); done: FUNC_LEAVE_API(ret_value); } /* end H5Fget_mpi_atomicity() */ - /*------------------------------------------------------------------------- * Function: H5F_mpi_retrieve_comm * @@ -390,7 +376,7 @@ done: herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -402,32 +388,32 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) /* if the loc_id is valid, then get the comm from the file attached to the loc_id */ - if(H5I_INVALID_HID != loc_id) { + if (H5I_INVALID_HID != loc_id) { H5G_loc_t loc; - H5F_t *f = NULL; + H5F_t * f = NULL; /* Retrieve the file structure */ - if(H5G_loc(loc_id, &loc) < 0) + if (H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") f = loc.oloc->file; HDassert(f); /* Check if MPIO driver is used */ - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { /* retrieve the file communicator */ - if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f))) + if (MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f))) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") } } /* otherwise, this is from H5Fopen or H5Fcreate and has to be collective */ else { - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist; /* Property list pointer */ - if(NULL == (plist = H5P_object_verify(acspl_id, H5P_FILE_ACCESS))) + if (NULL == (plist = H5P_object_verify(acspl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file access list") - if(H5FD_MPIO == H5P_peek_driver(plist)) - if(H5P_peek(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, mpi_comm) < 0) + if (H5FD_MPIO == H5P_peek_driver(plist)) + if (H5P_peek(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, mpi_comm) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") } @@ -435,4 +421,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_mpi_retrieve_comm */ #endif /* H5_HAVE_PARALLEL */ - |