diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-01-22 16:56:09 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-01-22 16:56:09 (GMT) |
commit | c3f08947c1fbca8f6ccd87ca35f0f23b6209b129 (patch) | |
tree | a87fa70f66b23e898e462a3a3104720cd1ca7ca5 /src/H5Fmpi.c | |
parent | d543f1247312741e0e33dcf6bddc5a73b842e5d0 (diff) | |
parent | 91aeb766fafbc4c03d98699de4cac590df9c63a3 (diff) | |
download | hdf5-c3f08947c1fbca8f6ccd87ca35f0f23b6209b129.zip hdf5-c3f08947c1fbca8f6ccd87ca35f0f23b6209b129.tar.gz hdf5-c3f08947c1fbca8f6ccd87ca35f0f23b6209b129.tar.bz2 |
[svn-r28959] merge from trunk.
renaming metadata dxpl properties.
Diffstat (limited to 'src/H5Fmpi.c')
-rw-r--r-- | src/H5Fmpi.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index ae15142..5434aa5 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -287,5 +287,74 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) done: FUNC_LEAVE_API(ret_value) } + + +/*------------------------------------------------------------------------- + * Function: H5F_mpi_retrieve_comm + * + * Purpose: Retrieves an MPI communicator from the file the location ID + * is in. If the loc_id is invalid, the fapl_id is used to + * retrieve the communicator. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(mpi_comm); + *mpi_comm = MPI_COMM_NULL; + + /* if the loc_id is valid, then get the comm from the file + attached to the loc_id */ + if(H5I_INVALID_HID != loc_id) { + H5G_loc_t loc; + H5F_t *f = NULL; + + /* retrieve the file structure */ + 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)) { + /* retrieve the file communicator */ + if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f))) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator") + } + } + /* otherwise, this if from H5Fopen or H5Fcreate and has to be collective */ + else { + H5P_genplist_t *plist; /* Property list pointer */ + + HDassert(H5P_isa_class(acspl_id, H5P_FILE_ACCESS)); + + if(NULL == (plist = H5P_object_verify(acspl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") + + if(H5FD_MPIO == H5P_peek_driver(plist)) { + const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */ + + if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + + *mpi_comm = fa->comm; + } + } +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_mpi_retrieve_comm */ + #endif /* H5_HAVE_PARALLEL */ |