diff options
author | Robert Kim Yates <rkyates@llnl.gov> | 1998-08-17 15:20:56 (GMT) |
---|---|---|
committer | Robert Kim Yates <rkyates@llnl.gov> | 1998-08-17 15:20:56 (GMT) |
commit | a1e8ce1d81cbb8b6029c1bb972fcc527cd179f0d (patch) | |
tree | 88a5b2a2942c309949011084b019596f7929d0e2 /src/H5Flow.c | |
parent | 8ed18c9e73733939216251e1d154b18e7d34bad3 (diff) | |
download | hdf5-a1e8ce1d81cbb8b6029c1bb972fcc527cd179f0d.zip hdf5-a1e8ce1d81cbb8b6029c1bb972fcc527cd179f0d.tar.gz hdf5-a1e8ce1d81cbb8b6029c1bb972fcc527cd179f0d.tar.bz2 |
[svn-r599] Added code to convert HDF dataspace selections to MPI datatypes.
Diffstat (limited to 'src/H5Flow.c')
-rw-r--r-- | src/H5Flow.c | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/src/H5Flow.c b/src/H5Flow.c index f929e44..5ddc299 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -269,6 +269,11 @@ H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms, * June 2, 1998 Albert Cheng * Added xfer_mode argument * + * rky 980816 + * Accommodate fancy MPI compound datatype writes. + * Also, parallel writes now abort if writing beyond eof + * (rather than just printing an error message + * and continuing, as they used to). *------------------------------------------------------------------------- */ herr_t @@ -279,19 +284,40 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms, herr_t ret_value = FAIL; haddr_t tmp_addr; +#ifdef HAVE_PARALLEL + int use_types; +#endif + FUNC_ENTER(H5F_low_write, FAIL); assert(lf && lf->type); assert(addr && addr_defined(addr)); assert(buf); - /* Extend the file eof marker if we write past it */ - tmp_addr = *addr; - H5F_addr_inc(&tmp_addr, (hsize_t)size); - if (H5F_addr_gt(&tmp_addr, &(lf->eof))) { - fprintf(stderr, "H5F: extending file w/o allocation\n"); - lf->eof = tmp_addr; - } + /* check for writing past the end of file marker */ +#ifdef HAVE_PARALLEL + if (H5F_LOW_MPIO==access_parms->driver + && access_parms->u.mpio.use_types) { + /* In the case of fancy use of MPI datatypes, the addr and size + * parameters have a very peculiar interpretation. + * It is logically possible, but quite complex, to calculate + * the physical offset that the last byte to be written will have + * (assuming the write doesn't fail partway thru, which it may). + * Instead, we fix up the eof _after_ the write + * (I really don't know if that's OK or not... rky 980816) */ + use_types = access_parms->u.mpio.use_types; /* check after write */ + } else { +#endif /* HAVE_PARALLEL */ + /* writing a simple block of bytes; can check for writing beyond eof */ + tmp_addr = *addr; + H5F_addr_inc(&tmp_addr, (hsize_t)size); + if (H5F_addr_gt(&tmp_addr, &(lf->eof))) { + fprintf(stderr, "H5F: extending file w/o allocation\n"); + lf->eof = tmp_addr; + } +#ifdef HAVE_PARALLEL + } /* end else */ +#endif /* HAVE_PARALLEL */ /* Write the data */ if (lf->type->write) { @@ -303,6 +329,19 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms, HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "no write method"); } +#ifdef HAVE_PARALLEL + /* fix up eof for MPI use_type writes */ + if (H5F_LOW_MPIO==access_parms->driver && use_types) { + /* set logical eof to current physical eof + * (ephemeral though it may be...) */ + MPI_Offset size; + if (MPI_SUCCESS != MPI_File_get_size(lf->u.mpio.f,&size)) { + HRETURN_ERROR(H5E_IO, H5E_MPI, NULL, "couldn't get file size" ); + } + lf->eof.offset = size; + } +#endif + FUNC_LEAVE(ret_value); } |