summaryrefslogtreecommitdiffstats
path: root/testpar/t_chunk_alloc.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 /testpar/t_chunk_alloc.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 'testpar/t_chunk_alloc.c')
-rw-r--r--testpar/t_chunk_alloc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c
index 770a1fc..5b60c0e 100644
--- a/testpar/t_chunk_alloc.c
+++ b/testpar/t_chunk_alloc.c
@@ -36,7 +36,11 @@ get_filesize(const char *filename)
int mpierr;
MPI_File fd;
MPI_Offset filesize;
+#ifndef H5_HAVE_MPI_GET_SIZE
+ struct stat stat_buf;
+#endif
+#ifdef H5_HAVE_MPI_GET_SIZE
mpierr = MPI_File_open(MPI_COMM_SELF, (char*)filename, MPI_MODE_RDONLY,
MPI_INFO_NULL, &fd);
VRFY((mpierr == MPI_SUCCESS), "");
@@ -46,6 +50,16 @@ get_filesize(const char *filename)
mpierr = MPI_File_close(&fd);
VRFY((mpierr == MPI_SUCCESS), "");
+#else
+ /* Some systems (only SGI Altix Propack 4 so far) doesn't return correct
+ * file size for MPI_File_get_size. Use stat instead.
+ */
+ if((mpierr=stat(filename, &stat_buf))<0)
+ VRFY((mpierr == MPI_SUCCESS), "");
+
+ /* Hopefully this casting is safe */
+ filesize = (MPI_Offset)(stat_buf.st_size);
+#endif
return(filesize);
}