summaryrefslogtreecommitdiffstats
path: root/src/H5FDmpio.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-05-13 20:21:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-05-13 20:21:59 (GMT)
commitc5a9d502a3e9a1ac3fdb56d946b3b466b32bad4b (patch)
tree35044db27d80ffa8d102e224e80d47696b6ec545 /src/H5FDmpio.c
parentd07e0dd9a3d98981ba49c1a39998faf7cb522075 (diff)
downloadhdf5-c5a9d502a3e9a1ac3fdb56d946b3b466b32bad4b.zip
hdf5-c5a9d502a3e9a1ac3fdb56d946b3b466b32bad4b.tar.gz
hdf5-c5a9d502a3e9a1ac3fdb56d946b3b466b32bad4b.tar.bz2
[svn-r5408] Purpose:
Performance enhancement Description: Doing an MPI_File_sync() just before a file is closed causing a large performance loss. Solution: Add flag to MPI file driver to avoid performance the MPI_File_sync() when the flag is set before a call to H5F_flush(). Platforms tested: IRIX64 6.5 (modi4)
Diffstat (limited to 'src/H5FDmpio.c')
-rw-r--r--src/H5FDmpio.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index fdf39ad..585aa47 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -55,6 +55,7 @@ typedef struct H5FD_mpio_t {
int mpi_rank; /* This process's rank */
int mpi_size; /* Total number of processes */
int mpi_round; /* Current round robin process (for metadata I/O) */
+ unsigned closing; /* Indicate that the file is closing immediately after call to flush */
haddr_t eof; /*end-of-file marker */
haddr_t eoa; /*end-of-address marker */
MPI_Datatype btype; /*buffer type for xfers */
@@ -579,6 +580,37 @@ H5FD_mpio_signal_right_neighbor(H5FD_t *_file)
/*-------------------------------------------------------------------------
+ * Function: H5FD_mpio_closing
+ *
+ * Purpose: Indicate that next flush call is immediately prior to a
+ * close on the file.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol, May 13, 2002
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_mpio_closing(H5FD_t *_file)
+{
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+
+ FUNC_ENTER(H5FD_mpio_closing, FAIL);
+ assert(file);
+ assert(H5FD_MPIO==file->pub.driver_id);
+
+ /* Set the 'closing' flag for this file */
+ file->closing=TRUE;
+
+ FUNC_LEAVE(SUCCEED);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5FD_mpio_fapl_get
*
* Purpose: Returns a file access property list which could be used to
@@ -787,6 +819,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
file->mpi_rank = mpi_rank;
file->mpi_size = mpi_size;
file->mpi_round = 0; /* Start metadata writes with process 0 */
+ file->closing = FALSE; /* Not closing yet */
file->btype = MPI_DATATYPE_NULL;
file->ftype = MPI_DATATYPE_NULL;
@@ -1563,8 +1596,14 @@ 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);
+ /* Only sync the file if we are not going to immediately close it */
+ if(!file->closing) {
+ if (MPI_SUCCESS != (mpi_code=MPI_File_sync(file->f)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_sync failed", mpi_code);
+ } /* end if */
+
+ /* Reset 'closing' flag now */
+ file->closing=FALSE;
done:
#ifdef H5FDmpio_DEBUG