summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-11-06 19:19:02 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-11-06 19:19:02 (GMT)
commit0502eb185fe4cef644f464ae88f8b5cc1f8e1cf5 (patch)
treee45b22ac34928be20d0d129712cf28c58efe1f45
parentc63341344edf44a7ce4c86004981bef3b2a006b7 (diff)
downloadhdf5-0502eb185fe4cef644f464ae88f8b5cc1f8e1cf5.zip
hdf5-0502eb185fe4cef644f464ae88f8b5cc1f8e1cf5.tar.gz
hdf5-0502eb185fe4cef644f464ae88f8b5cc1f8e1cf5.tar.bz2
[svn-r25796] merge 25750 from trunk.
use MPI_File_get_size() instead of stat when retrieving the file size for the MPIO driver.
-rw-r--r--test/h5test.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/h5test.c b/test/h5test.c
index f434823..21aacb5 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;