Adds barrier and rank 0 check to MPI-I/O VFD delete
This commit is contained in:
@@ -1760,26 +1760,39 @@ static herr_t
|
||||
H5FD__mpio_delete(const char *filename, hid_t fapl_id)
|
||||
{
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
MPI_Info info = MPI_INFO_NULL;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
MPI_Comm comm = MPI_COMM_NULL;
|
||||
MPI_Info info = MPI_INFO_NULL;
|
||||
int mpi_rank = INT_MAX;
|
||||
int mpi_code; /* MPI return code */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_STATIC
|
||||
|
||||
HDassert(filename);
|
||||
|
||||
/* Get the MPI info from the fapl */
|
||||
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
|
||||
if (H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_peek_driver(plist))
|
||||
info = MPI_INFO_NULL; /* default */
|
||||
else {
|
||||
|
||||
/* Get the MPI communicator and info from the fapl */
|
||||
if (H5P_FILE_ACCESS_DEFAULT != fapl_id && H5FD_MPIO == H5P_peek_driver(plist)) {
|
||||
if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI info object")
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI info object")
|
||||
if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0)
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator")
|
||||
}
|
||||
|
||||
/* Get the MPI rank of this process */
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank)))
|
||||
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mpi_code)
|
||||
|
||||
/* Set up a barrier */
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Barrier(comm)))
|
||||
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
|
||||
|
||||
/* Delete the file */
|
||||
if (MPI_File_delete(filename, info) < 0)
|
||||
HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file")
|
||||
if (mpi_rank == 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_File_delete(filename, info)))
|
||||
HMPI_GOTO_ERROR(FAIL, "MPI_File_delete failed", mpi_code)
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
||||
Reference in New Issue
Block a user