diff options
Diffstat (limited to 'src/H5FDmpio.c')
-rw-r--r-- | src/H5FDmpio.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 2d28828..9be69f6 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -83,7 +83,7 @@ static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd size_t size, void *buf); static herr_t H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_mpio_flush(H5FD_t *_file); +static herr_t H5FD_mpio_flush(H5FD_t *_file, hbool_t closing); /* MPIO-specific file access properties */ typedef struct H5FD_mpio_fapl_t { @@ -1521,7 +1521,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_flush(H5FD_t *_file) +H5FD_mpio_flush(H5FD_t *_file, hbool_t closing) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; int mpi_code; /* mpi return code */ @@ -1563,9 +1563,13 @@ H5FD_mpio_flush(H5FD_t *_file) } } - - if (MPI_SUCCESS != (mpi_code=MPI_File_sync(file->f))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_sync failed", mpi_code); + /* Don't bother calling MPI_File_sync() if we are going to immediately + * close the file, MPI_File_close() performs the same sync actions. + */ + if(!closing) { + if (MPI_SUCCESS != (mpi_code=MPI_File_sync(file->f))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_sync failed", mpi_code); + } /* end if */ done: #ifdef H5FDmpio_DEBUG |