summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2007-06-01 19:28:10 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2007-06-01 19:28:10 (GMT)
commitdc86a890adef656b0f0eddd4b6cdfa4b73378b69 (patch)
tree9d60df193e6a0ca51e0d7d6e325ab8594040ec38 /src
parent65e657479ef2a17e6a276a38e83c1831a395ada0 (diff)
downloadhdf5-dc86a890adef656b0f0eddd4b6cdfa4b73378b69.zip
hdf5-dc86a890adef656b0f0eddd4b6cdfa4b73378b69.tar.gz
hdf5-dc86a890adef656b0f0eddd4b6cdfa4b73378b69.tar.bz2
[svn-r13828] 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), cobalt, copper, and sol.
Diffstat (limited to 'src')
-rw-r--r--src/H5FDmpio.c14
-rw-r--r--src/H5config.h.in3
2 files changed, 16 insertions, 1 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 8d0479f..4f348d5 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -742,6 +742,9 @@ 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)
@@ -816,9 +819,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 4d4685b..c34a7c0 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -219,6 +219,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 to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H