summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert Kim Yates <rkyates@llnl.gov>1998-09-18 23:08:09 (GMT)
committerRobert Kim Yates <rkyates@llnl.gov>1998-09-18 23:08:09 (GMT)
commit8718c53e6b8ca3d64b2e129a0b4401e124aef116 (patch)
tree302b7916e23e173227c855a2faa06cddf6d5f944 /src
parentd3c8def6aa7e19e0005b6392f41a9d4bd4bb14af (diff)
downloadhdf5-8718c53e6b8ca3d64b2e129a0b4401e124aef116.zip
hdf5-8718c53e6b8ca3d64b2e129a0b4401e124aef116.tar.gz
hdf5-8718c53e6b8ca3d64b2e129a0b4401e124aef116.tar.bz2
[svn-r706] Added must_convert parameter to sconv->read and sconv->write functions
so that reads/writes can proceed in the unoptimized way if necessary, rather than simply failing if they can't be optimized.
Diffstat (limited to 'src')
-rw-r--r--src/H5D.c49
-rw-r--r--src/H5Smpio.c29
-rw-r--r--src/H5Sprivate.h24
3 files changed, 78 insertions, 24 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 89526c8..5ad5145 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1267,6 +1267,9 @@ H5D_close(H5D_t *dataset)
* Robb Matzke, 11 Aug 1998
* Added timing calls around all the data space I/O functions.
*
+ * rky 980918
+ * Added must_convert to do non-optimized read when necessary.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1294,6 +1297,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
size_t request_nelmts; /*requested strip mine */
H5T_bkg_t need_bkg; /*type of background buf*/
H5S_t *free_this_space=NULL; /*data space to free */
+ hbool_t must_convert; /*have to xfer the slow way */
#ifdef H5T_DEBUG
H5_timer_t timer;
#endif
@@ -1390,13 +1394,19 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
&(dataset->create_parms->efl),
H5T_get_size (dataset->type), file_space,
mem_space, xfer_parms->xfer_mode,
- buf/*out*/);
- if (status>=0) goto succeed;
-#ifdef HAVE_PARALLEL
- /* Supports only no conversion, type or space, for now. */
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
- "optimized parallel read failed");
-#endif
+ buf/*out*/, &must_convert );
+ if (status<0) {
+ /* Supports only no conversion, type or space, for now. */
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
+ "optimized read failed");
+ }
+ if (must_convert) {
+ /* sconv->read cannot do a direct transfer;
+ * fall through and xfer the data in the more roundabout way */
+ } else {
+ /* direct xfer accomplished successfully */
+ goto succeed;
+ }
#ifdef H5D_DEBUG
if (H5DEBUG(D)) {
fprintf (H5DEBUG(D), "H5D: data space conversion could not be "
@@ -1613,6 +1623,9 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
* Robb Matzke, 9 Jun 1998
* The data space is no longer cached in the dataset struct.
*
+ * rky 980918
+ * Added must_convert to do non-optimized read when necessary.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1639,6 +1652,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
size_t request_nelmts; /*requested strip mine */
H5T_bkg_t need_bkg; /*type of background buf*/
H5S_t *free_this_space=NULL; /*data space to free */
+ hbool_t must_convert; /*have to xfer the slow way */
#ifdef H5T_DEBUG
H5_timer_t timer;
#endif
@@ -1742,13 +1756,20 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
&(dataset->create_parms->pline),
&(dataset->create_parms->efl),
H5T_get_size (dataset->type), file_space,
- mem_space, xfer_parms->xfer_mode, buf);
- if (status>=0) goto succeed;
-#ifdef HAVE_PARALLEL
- /* Supports only no conversion, type or space, for now. */
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL,
- "optimized parallel write failed");
-#endif
+ mem_space, xfer_parms->xfer_mode, buf,
+ &must_convert /*out*/ );
+ if (status<0) {
+ /* Supports only no conversion, type or space, for now. */
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
+ "optimized write failed");
+ }
+ if (must_convert) {
+ /* sconv->write cannot do a direct transfer;
+ * fall through and xfer the data in the more roundabout way */
+ } else {
+ /* direct xfer accomplished successfully */
+ goto succeed;
+ }
#ifdef H5D_DEBUG
if (H5DEBUG(D)) {
fprintf (H5DEBUG(D), "H5D: data space conversion could not be "
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 2275120..2610f94 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -55,6 +55,7 @@ H5S_mpio_spaces_xfer (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_efl_t __unused__ *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_t *mem_space,
const H5D_transfer_t xfer_mode, void *buf /*out*/,
+ hbool_t *must_convert /*out*/,
const hbool_t do_write );
/*-------------------------------------------------------------------------
@@ -434,6 +435,9 @@ H5S_mpio_space_type( const H5S_t *space, const size_t elmt_size,
*
* Modifications:
*
+ * rky 980918
+ * Added must_convert parameter to let caller know we can't optimize the xfer.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -442,6 +446,7 @@ H5S_mpio_spaces_xfer (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_efl_t __unused__ *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_t *mem_space,
const H5D_transfer_t xfer_mode, void *buf /*out*/,
+ hbool_t *must_convert /*out*/,
const hbool_t do_write )
{
herr_t ret_value = SUCCEED;
@@ -454,6 +459,8 @@ H5S_mpio_spaces_xfer (H5F_t *f, const struct H5O_layout_t *layout,
FUNC_ENTER (H5S_mpio_spaces_xfer, FAIL);
+ *must_convert = 0; /* means we at least tried to do optimized xfer */
+
/* Check args */
assert (f);
assert (layout);
@@ -466,9 +473,11 @@ H5S_mpio_spaces_xfer (H5F_t *f, const struct H5O_layout_t *layout,
/* Currently can only handle H5D_CONTIGUOUS layout */
if (layout->type != H5D_CONTIGUOUS) {
#ifdef H5S_DEBUG
- fprintf (stderr, "H5S: can only create MPI datatype for hyperslab selection when layout is contiguous.\n" );
+ if (H5DEBUG(S)) {
+ fprintf (H5DEBUG(S), "H5S: can only create MPI datatype for hyperslab when layout is contiguous.\n" );
+ }
#endif
- ret_value = FAIL;
+ *must_convert = 1; /* can't do optimized xfer; do the old way */
goto done;
}
@@ -555,6 +564,9 @@ H5S_mpio_spaces_xfer (H5F_t *f, const struct H5O_layout_t *layout,
*
* Modifications:
*
+ * rky 980918
+ * Added must_convert parameter to let caller know we can't optimize the xfer.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -562,7 +574,8 @@ H5S_mpio_spaces_read (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_t *mem_space,
- const H5D_transfer_t xfer_mode, void *buf /*out*/ )
+ const H5D_transfer_t xfer_mode, void *buf /*out*/,
+ hbool_t *must_convert /*out*/ )
{
herr_t ret_value = FAIL;
@@ -570,7 +583,7 @@ H5S_mpio_spaces_read (H5F_t *f, const struct H5O_layout_t *layout,
ret_value = H5S_mpio_spaces_xfer( f, layout, pline, efl, elmt_size,
file_space, mem_space, xfer_mode, (void*)buf,
- 0 /*read*/ );
+ must_convert /*out*/, 0 /*read*/ );
FUNC_LEAVE (ret_value);
} /* H5S_mpio_spaces_read() */
@@ -586,6 +599,9 @@ H5S_mpio_spaces_read (H5F_t *f, const struct H5O_layout_t *layout,
*
* Modifications:
*
+ * rky 980918
+ * Added must_convert parameter to let caller know we can't optimize the xfer.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -593,7 +609,8 @@ H5S_mpio_spaces_write(H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_t *mem_space,
- const H5D_transfer_t xfer_mode, const void *buf )
+ const H5D_transfer_t xfer_mode, const void *buf,
+ hbool_t *must_convert /*out*/ )
{
herr_t ret_value = FAIL;
@@ -601,7 +618,7 @@ H5S_mpio_spaces_write(H5F_t *f, const struct H5O_layout_t *layout,
ret_value = H5S_mpio_spaces_xfer( f, layout, pline, efl, elmt_size,
file_space, mem_space, xfer_mode, (void*)buf,
- 1 /*write*/ );
+ must_convert /*out*/, 1 /*write*/ );
FUNC_LEAVE (ret_value);
} /* H5S_mpio_spaces_write() */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index c66f27d..862de9a 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -223,6 +223,17 @@ typedef struct H5S_conv_t {
* If there is no data type conversion then it might be possible to
* transfer data points between application memory and the file in one
* step without going through the data type conversion buffer.
+ *
+ * rky 980918
+ * If the direct read or write function determines that the transfer
+ * must be done indirectly, i.e., through the conversion buffer or
+ * (in the case of parallel MPI-IO) in block-by-block transfers
+ * then the function returns with the value of must_convert!=0,
+ * the function's return value is SUCCEED,
+ * and no transfer of data is attempted.
+ * Otherwise the direct read or write function returns must_convert 0,
+ * with the function's return value being SUCCEED or FAIL
+ * depending on whether or not the transfer of data was successful.
*/
/* Read from file to application w/o intermediate scratch buffer */
@@ -230,14 +241,17 @@ typedef struct H5S_conv_t {
const struct H5O_pline_t *pline,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_t *mem_space,
- const H5D_transfer_t xfer_mode, void *buf/*out*/);
+ const H5D_transfer_t xfer_mode, void *buf/*out*/,
+ hbool_t *must_convert/*out*/ );
+
/* Write directly from app buffer to file */
herr_t (*write)(H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_t *mem_space,
- const H5D_transfer_t xfer_mode, const void *buf);
+ const H5D_transfer_t xfer_mode, const void *buf,
+ hbool_t *must_convert/*out*/ );
#ifdef H5S_DEBUG
struct {
@@ -332,14 +346,16 @@ hbool_t H5S_hyper_select_valid (const H5S_t *space);
const struct H5O_pline_t *pline,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_t *mem_space,
- const H5D_transfer_t xfer_mode, void *buf/*out*/);
+ const H5D_transfer_t xfer_mode, void *buf/*out*/,
+ hbool_t *must_convert /*out*/ );
/* MPI-IO function to write directly from app buffer to file rky980813 */
herr_t H5S_mpio_spaces_write(H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, const H5S_t *mem_space,
- const H5D_transfer_t xfer_mode, const void *buf);
+ const H5D_transfer_t xfer_mode, const void *buf,
+ hbool_t *must_convert /*out*/ );
#ifndef _H5S_IN_H5S_C
/* Global var whose value comes from environment variable */