summaryrefslogtreecommitdiffstats
path: root/src/H5Fsuper.c
diff options
context:
space:
mode:
authorRichard Warren <Richard.Warren@hdfgroup.org>2017-09-28 20:27:29 (GMT)
committerRichard Warren <Richard.Warren@hdfgroup.org>2017-09-28 20:27:29 (GMT)
commit81094ac3cfbf5785c0006516133d0dc34665b81c (patch)
treef13cd6e113cc4edf125bf47fe664bff8e194ce1a /src/H5Fsuper.c
parentb5446a9c638b5a95b8dfe132f646aa4358d2b539 (diff)
downloadhdf5-81094ac3cfbf5785c0006516133d0dc34665b81c.zip
hdf5-81094ac3cfbf5785c0006516133d0dc34665b81c.tar.gz
hdf5-81094ac3cfbf5785c0006516133d0dc34665b81c.tar.bz2
The initial coding for the superblock read optization
Diffstat (limited to 'src/H5Fsuper.c')
-rw-r--r--src/H5Fsuper.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 7c70a64..32051f3 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -333,6 +333,7 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
unsigned rw_flags; /* Read/write permissions for file */
hbool_t skip_eof_check = FALSE; /* Whether to skip checking the EOF value */
herr_t ret_value = SUCCEED; /* Return value */
+ int mpi_rank = 0, mpi_size = 1;
FUNC_ENTER_PACKAGE_TAG(meta_dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL)
@@ -354,8 +355,33 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
/* Find the superblock */
- if(H5FD_locate_signature(&fdio_info, &super_addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
+#ifdef H5_HAVE_PARALLEL
+ H5FD_GET_MPI_RANK_AND_SIZE(mpi_rank, mpi_size, f);
+ /* If we are an MPI application with at least two processes, the
+ * following superblock signature location optimization is applicable.
+ */
+ if ( mpi_size > 1 ) {
+ MPI_Comm this_comm = MPI_COMM_NULL;
+
+ if ( mpi_rank == 0 ) {
+ if(H5FD_locate_signature(&fdio_info, &super_addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
+ }
+ H5FD_GET_MPI_COMM(this_comm, f);
+ if (( this_comm == MPI_COMM_NULL ) ||
+ ( MPI_Bcast(&super_addr,sizeof(super_addr), MPI_BYTE, 0, this_comm) != MPI_SUCCESS))
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
+ }
+ else {
+ /* Locate the signature as per per the serial library */
+#endif /* H5_HAVE_PARALLEL */
+
+ if(H5FD_locate_signature(&fdio_info, &super_addr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature")
+
+#ifdef H5_HAVE_PARALLEL
+ }
+#endif
if(HADDR_UNDEF == super_addr)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "file signature not found")