diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-16 17:33:00 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-16 17:33:00 (GMT) |
commit | d7bde16f45fac765f45172d88a1a9cd44a1f95fa (patch) | |
tree | be73c954ea0220b752cfbb49597e35954aa47cd9 /src/H5FDmpio.c | |
parent | bf1c2f0e8bf9788c2e47a1b1ac963cc321afab0e (diff) | |
download | hdf5-d7bde16f45fac765f45172d88a1a9cd44a1f95fa.zip hdf5-d7bde16f45fac765f45172d88a1a9cd44a1f95fa.tar.gz hdf5-d7bde16f45fac765f45172d88a1a9cd44a1f95fa.tar.bz2 |
[svn-r7480] Purpose:
Bug fix
Description:
The MPI_File_set_size() routine on ASCI Red is not able to extend files
so that they are larger than 2GB.
Solution:
Add an extra macro which controls whether MPI_File_set_size() can handle
>2GB offsets or if our "older" way of reading a byte, then writing a byte at
the appropriate offset should be used.
Platforms tested:
FreeBSD 4.9 (sleipnir)
h5committest
Diffstat (limited to 'src/H5FDmpio.c')
-rw-r--r-- | src/H5FDmpio.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 503641a..5bd714b 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -2026,10 +2026,10 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) int mpi_code; /* mpi return code */ MPI_Offset mpi_off; herr_t ret_value=SUCCEED; -#ifdef OLD_WAY +#ifndef H5_MPI_FILE_SET_SIZE_BIG uint8_t byte=0; MPI_Status mpi_stat; -#endif /* OLD_WAY */ +#endif /* H5_MPI_FILE_SET_SIZE_BIG */ FUNC_ENTER_NOAPI(H5FD_mpio_flush, FAIL) @@ -2040,17 +2040,24 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) assert(file); assert(H5FD_MPIO==file->pub.driver_id); -#ifdef OLD_WAY +#ifndef H5_MPI_FILE_SET_SIZE_BIG /* Portably initialize MPI status variable */ HDmemset(&mpi_stat,0,sizeof(MPI_Status)); -#endif /* OLD_WAY */ +#endif /* H5_MPI_FILE_SET_SIZE_BIG */ /* Extend the file to make sure it's large enough, then sync. * Unfortunately, keeping track of EOF is an expensive operation, so * we can't just check whether EOF<EOA like with other drivers. * Therefore we'll just read the byte at EOA-1 and then write it back. */ if(file->eoa>file->last_eoa) { -#ifdef OLD_WAY +#ifdef H5_MPI_FILE_SET_SIZE_BIG + if (H5FD_mpio_haddr_to_MPIOff(file->eoa, &mpi_off)<0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset") + + /* Extend the file's size */ + if (MPI_SUCCESS != (mpi_code=MPI_File_set_size(file->f, mpi_off))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_size failed", mpi_code) +#else /* H5_MPI_FILE_SET_SIZE_BIG */ if (0==file->mpi_rank) { if (H5FD_mpio_haddr_to_MPIOff(file->eoa-1, &mpi_off)<0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset") @@ -2059,13 +2066,7 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) if (MPI_SUCCESS != (mpi_code=MPI_File_write_at(file->f, mpi_off, &byte, 1, MPI_BYTE, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) } /* end if */ -#else /* OLD_WAY */ - if (H5FD_mpio_haddr_to_MPIOff(file->eoa, &mpi_off)<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset") - - /* Extend the file's size */ - if (MPI_SUCCESS != (mpi_code=MPI_File_set_size(file->f, mpi_off))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_size failed", mpi_code) +#endif /* H5_MPI_FILE_SET_SIZE_BIG */ /* Don't let any proc return until all have extended the file. * (Prevents race condition where some processes go ahead and write @@ -2075,7 +2076,6 @@ H5FD_mpio_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned closing) */ if (MPI_SUCCESS!= (mpi_code=MPI_Barrier(file->comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) -#endif /* OLD_WAY */ /* Update the 'last' eoa value */ file->last_eoa=file->eoa; |