summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5FDmpio.c16
-rw-r--r--src/H5config.h.in3
-rw-r--r--src/Makefile.in1
3 files changed, 18 insertions, 2 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 6593969..5d5f092 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -942,7 +942,10 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
MPI_Comm comm_dup=MPI_COMM_NULL;
MPI_Info info_dup=MPI_INFO_NULL;
H5FD_t *ret_value; /* Return value */
-
+#ifndef H5_HAVE_MPI_GET_SIZE
+ struct stat stat_buf;
+#endif
+
FUNC_ENTER_NOAPI(H5FD_mpio_open, NULL)
#ifdef H5FDmpio_DEBUG
@@ -1016,9 +1019,18 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
/* Only processor p0 will get the filesize and broadcast it. */
if (mpi_rank == 0) {
- /* Get current file size */
+ /* Get current file size. If MPI_File_get_size is disabled in configuration
+ * because it doesn't return correct value (SGI Altix Propack 4),
+ * use stat to get the file size. */
+#ifdef H5_HAVE_MPI_GET_SIZE
if (MPI_SUCCESS != (mpi_code=MPI_File_get_size(fh, &size)))
HMPI_GOTO_ERROR(NULL, "MPI_File_get_size failed", mpi_code)
+#else
+ if((mpi_code=HDstat(name, &stat_buf))<0)
+ HMPI_GOTO_ERROR(NULL, "stat failed", mpi_code)
+ /* Hopefully this casting is safe */
+ size = (MPI_Offset)(stat_buf.st_size);
+#endif
} /* end if */
/* Broadcast file size */
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 6b966f5..3817ea8 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -210,6 +210,9 @@
/* Define to 1 if you have the <mpe.h> header file. */
#undef HAVE_MPE_H
+/* Define if MPI_File_get_size works correctly */
+#undef HAVE_MPI_GET_SIZE
+
/* Define if `MPI_Comm_c2f' and `MPI_Comm_f2c' exists */
#undef HAVE_MPI_MULTI_LANG_Comm
diff --git a/src/Makefile.in b/src/Makefile.in
index cf7257c..c985af0 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -235,6 +235,7 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
+MPI_GET_SIZE = @MPI_GET_SIZE@
OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@