summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-10-28 16:59:36 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-10-28 16:59:36 (GMT)
commit6735f59f7d65a3d2d1821c5217fb3f9612cfed49 (patch)
tree8b85ee878e5e188e7e4e5dd7ab20beb0a4038d17 /test
parent73465a6bc2ef74dd251dd87b89b5f363b2ef69ae (diff)
downloadhdf5-6735f59f7d65a3d2d1821c5217fb3f9612cfed49.zip
hdf5-6735f59f7d65a3d2d1821c5217fb3f9612cfed49.tar.gz
hdf5-6735f59f7d65a3d2d1821c5217fb3f9612cfed49.tar.bz2
[svn-r25750] use MPI_File_get_size() instead of stat when retrieving the file size for the MPIO driver.
Diffstat (limited to 'test')
-rw-r--r--test/h5test.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/h5test.c b/test/h5test.c
index 61a9ae0..693760c 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -908,7 +908,7 @@ h5_get_file_size(const char *filename, hid_t fapl)
{
char temp[2048]; /* Temporary buffer for file names */
h5_stat_t sb; /* Structure for querying file info */
- int j = 0;
+ int j = 0;
if(fapl == H5P_DEFAULT) {
/* Get the file's statistics */
@@ -924,9 +924,6 @@ h5_get_file_size(const char *filename, hid_t fapl)
/* Check for simple cases */
if(driver == H5FD_SEC2 || driver == H5FD_STDIO || driver == H5FD_CORE ||
-#ifdef H5_HAVE_PARALLEL
- driver == H5FD_MPIO ||
-#endif /* H5_HAVE_PARALLEL */
#ifdef H5_HAVE_WINDOWS
driver == H5FD_WINDOWS ||
#endif /* H5_HAVE_WINDOWS */
@@ -961,6 +958,22 @@ h5_get_file_size(const char *filename, hid_t fapl)
/* Return total size */
return(tot_size);
} /* end if */
+#ifdef H5_HAVE_PARALLEL
+ else if(driver == H5FD_MPIO) {
+ MPI_File fh; /* MPI file handle used to open the file and verify its size */
+ int mpi_ret;
+ MPI_Offset file_size;
+
+ mpi_ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh);
+ if (mpi_ret != MPI_SUCCESS) return -1;
+ mpi_ret = MPI_File_get_size(fh, &file_size);
+ if (mpi_ret != MPI_SUCCESS) return -1;
+ mpi_ret = MPI_File_close(&fh);
+ if (mpi_ret != MPI_SUCCESS) return -1;
+
+ return file_size;
+ }
+#endif /* H5_HAVE_PARALLEL */
else if(driver == H5FD_FAMILY) {
h5_stat_size_t tot_size = 0;