summaryrefslogtreecommitdiffstats
path: root/src/H5FDmpio.c
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/H5FDmpio.c
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/H5FDmpio.c')
-rw-r--r--src/H5FDmpio.c16
1 files changed, 14 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 */