summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2007-06-02 18:19:36 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2007-06-02 18:19:36 (GMT)
commit1280f90f8128a72f1b2cfe45d3a5a24334c222e0 (patch)
treea7969815417facfd248292e2830679fd4fbea9df /src
parent2aa1084117a0040dbb6c54246837cd3133f51bdf (diff)
downloadhdf5-1280f90f8128a72f1b2cfe45d3a5a24334c222e0.zip
hdf5-1280f90f8128a72f1b2cfe45d3a5a24334c222e0.tar.gz
hdf5-1280f90f8128a72f1b2cfe45d3a5a24334c222e0.tar.bz2
[svn-r13829] Some systems (only SGI Altix ProPack 4 discovered so far) doesn't return correct
file size from MPI_File_get_size. Bypass this problem by replacing it with stat. Add an option --disable-mpi-size in configure to indicate this function doesn't work properly. Add a test in testpar/t_mpi.c, too. If it returns wrong file size, print out a warning. Tested on kagiso (parallel) because already tested the same change to v1.6 on several platforms (kagiso, cobalt, copper, and sol).
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@