summaryrefslogtreecommitdiffstats
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
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)
-rw-r--r--src/H5F.c6
-rw-r--r--src/H5FDmpio.c43
-rw-r--r--src/H5FDmpio.h1
3 files changed, 48 insertions, 2 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 470f993..4021c22 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2622,6 +2622,12 @@ H5F_close(H5F_t *f)
H5AC_debug(f);
H5F_istore_stats(f, FALSE);
+#ifdef H5_HAVE_PARALLEL
+ if(IS_H5FD_MPIO(f)) {
+ if (SUCCEED!= H5FD_mpio_closing(f->shared->lf))
+ HRETURN_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to set 'closing' flag");
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
/* Flush and destroy all caches */
if (H5F_flush(f, H5F_SCOPE_LOCAL, TRUE, FALSE)<0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache");
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
diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h
index 08dd857..425a346 100644
--- a/src/H5FDmpio.h
+++ b/src/H5FDmpio.h
@@ -61,6 +61,7 @@ __DLL__ herr_t H5FD_mpio_setup(H5FD_t *_file, MPI_Datatype btype, MPI_Datatype f
haddr_t disp, hbool_t use_types);
__DLL__ herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file);
__DLL__ herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file);
+__DLL__ herr_t H5FD_mpio_closing(H5FD_t *file);
#ifdef __cplusplus
}
#endif