diff options
Diffstat (limited to 'src/H5FDmpio.c')
-rw-r--r-- | src/H5FDmpio.c | 16 |
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 */ |