summaryrefslogtreecommitdiffstats
path: root/src/H5Dio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Dio.c')
-rw-r--r--src/H5Dio.c464
1 files changed, 307 insertions, 157 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c
index f1d6890..13c3422 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -21,7 +21,6 @@
#include "H5private.h" /* Generic Functions */
#include "H5Dpkg.h" /* Dataset functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5FDprivate.h" /* File drivers */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
@@ -79,28 +78,34 @@ static herr_t H5D_write(H5D_t *dataset, const H5T_t *mem_type,
hid_t dset_xfer_plist, const void *buf);
static herr_t
H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
- const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist,
- H5P_genplist_t *dx_plist, hid_t dxpl_id,
+ const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv,
+ const H5D_dcpl_cache_t *dcpl_cache,
+ const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
hid_t src_id, hid_t dst_id, void *buf/*out*/);
static herr_t
H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
- const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist,
- H5P_genplist_t *dx_plist, hid_t dxpl_id,
+ const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv,
+ const H5D_dcpl_cache_t *dcpl_cache,
+ const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
hid_t src_id, hid_t dst_id, const void *buf);
static herr_t
H5D_chunk_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
- const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist,
- H5P_genplist_t *dx_plist, hid_t dxpl_id,
+ const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv,
+ const H5D_dcpl_cache_t *dcpl_cache,
+ const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
hid_t src_id, hid_t dst_id, void *buf/*out*/);
static herr_t
H5D_chunk_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
- const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist,
- H5P_genplist_t *dx_plist, hid_t dxpl_id,
+ const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv,
+ const H5D_dcpl_cache_t *dcpl_cache,
+ const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
hid_t src_id, hid_t dst_id, const void *buf);
#ifdef H5_HAVE_PARALLEL
static herr_t
-H5D_io_assist_mpio(H5P_genplist_t *dx_plist, H5FD_mpio_xfer_t xfer_mode,
+H5D_io_assist_mpio(hid_t dxpl_id, H5D_dxpl_cache_t *dxpl_cache,
hbool_t *xfer_mode_changed);
+static herr_t
+H5D_io_restore_mpio(hid_t dxpl_id);
#endif /*H5_HAVE_PARALLEL*/
static herr_t H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type,
const H5S_t *file_space, const H5S_t *mem_space, fm_map *fm);
@@ -271,6 +276,138 @@ done:
} /* H5D_fill() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5D_get_dxpl_cache
+ PURPOSE
+ Get all the values for the DXPL cache.
+ USAGE
+ herr_t H5D_get_dxpl_cache(dxpl_id, cache)
+ hid_t dxpl_id; IN: DXPL to query
+ H5D_dxpl_cache_t *cache;IN/OUT: DXPL cache to fill with values
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Query all the values from a DXPL that are needed by internal routines
+ within the library.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t *cache)
+{
+ H5P_genplist_t *dx_plist; /* Data transfer property list */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5D_get_dxpl_cache,FAIL)
+
+ /* Check args */
+ assert(cache);
+
+ /* Get the dataset transfer property list */
+ if (NULL == (dx_plist = H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
+
+ /* Get maximum temporary buffer size */
+ if(H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &cache->max_temp_buf)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size")
+
+ /* Get temporary buffer pointer */
+ if(H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &cache->tconv_buf)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer")
+
+ /* Get background buffer pointer */
+ if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &cache->bkgr_buf)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer")
+
+ /* Get background buffer type */
+ if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &cache->bkgr_buf_type)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+
+ /* Get B-tree split ratios */
+ if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+
+ /* Get B-tree split ratios */
+ if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+
+ /* Get I/O vector size */
+ if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &cache->vec_size)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size")
+
+#ifdef H5_HAVE_PARALLEL
+ /* Collect Parallel I/O information for possible later use */
+ if(H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &cache->xfer_mode)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
+#endif /*H5_HAVE_PARALLEL*/
+
+ /* Get error detection properties */
+ if(H5P_get(dx_plist, H5D_XFER_EDC_NAME, &cache->err_detect)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve error detection info")
+
+ /* Get filter callback function */
+ if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &cache->filter_cb)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve filter callback function")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D_get_dxpl_cache() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5D_get_dcpl_cache
+ PURPOSE
+ Get all the values for the DCPL cache.
+ USAGE
+ herr_t H5D_get_dcpl_cache(dcpl_id, cache)
+ hid_t dcpl_id; IN: DCPL to query
+ H5D_dcpl_cache_t *cache;IN/OUT: DCPL cache to fill with values
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Query all the values from a DCPL that are needed by internal routines
+ within the library.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5D_get_dcpl_cache(hid_t dcpl_id, H5D_dcpl_cache_t *cache)
+{
+ H5P_genplist_t *dc_plist; /* Data transfer property list */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5D_get_dcpl_cache)
+
+ /* Check args */
+ assert(cache);
+
+ /* Get the dataset transfer property list */
+ if (NULL == (dc_plist = H5I_object(dcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
+
+ /* Get I/O pipeline info */
+ if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &cache->pline)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O pipeline info")
+
+ /* Get fill value info */
+ if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &cache->fill)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill value info")
+
+ /* Get fill time info */
+ if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &cache->fill_time)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill time")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D_get_dcpl_cache() */
+
+
/*-------------------------------------------------------------------------
* Function: H5Dread
*
@@ -516,11 +653,10 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5S_conv_t *sconv=NULL; /*space conversion funcs*/
hbool_t use_par_opt_io=FALSE; /* Whether the 'optimized' I/O routines with be parallel */
#ifdef H5_HAVE_PARALLEL
- H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */
hbool_t xfer_mode_changed=FALSE; /* Whether the transfer mode was changed */
#endif /*H5_HAVE_PARALLEL*/
- H5P_genplist_t *dx_plist=NULL; /* Data transfer property list */
- H5P_genplist_t *dc_plist; /* Dataset creation roperty list */
+ H5D_dxpl_cache_t dxpl_cache; /* Data transfer property cache */
+ H5D_dcpl_cache_t dcpl_cache; /* Dataset creation property cache */
unsigned sconv_flags=0; /* Flags for the space conversion */
herr_t ret_value = SUCCEED; /* Return value */
@@ -531,14 +667,6 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
assert(mem_type);
assert(buf);
- /* Get the dataset's creation property list */
- if (NULL == (dc_plist = H5I_object(dataset->dcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
-
- /* Get the dataset transfer property list */
- if (NULL == (dx_plist = H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
-
if (!file_space)
file_space = dataset->space;
if (!mem_space)
@@ -547,17 +675,22 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
-#ifdef H5_HAVE_PARALLEL
- /* Collect Parallel I/O information for possible later use */
- xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(dx_plist, H5D_XFER_IO_XFER_MODE_NAME);
+ /* Fill the DCPL cache values for later use */
+ if (H5D_get_dcpl_cache(dataset->dcpl_id,&dcpl_cache)<0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dcpl cache")
+ /* Fill the DXPL cache values for later use */
+ if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
+
+#ifdef H5_HAVE_PARALLEL
/* Collective access is not permissible without a MPI based VFD */
- if (xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file))
+ if (dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file))
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only")
/* Set the "parallel I/O possible" flag, for H5S_find(), if we are doing collective I/O */
/* (Don't set the parallel I/O possible flag for the MPI-posix driver, since it doesn't do real collective I/O) */
- if (H5S_mpi_opt_types_g && xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file))
+ if (H5S_mpi_opt_types_g && dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file))
sconv_flags |= H5S_CONV_PAR_IO_POSSIBLE;
#endif /*H5_HAVE_PARALLEL*/
@@ -576,29 +709,23 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
*/
if(nelmts > 0 && dataset->efl.nused==0 && dataset->layout.type!=H5D_COMPACT
&& dataset->layout.addr==HADDR_UNDEF) {
- H5O_fill_t fill={NULL,0,NULL}; /* Fill value info */
- H5D_fill_time_t fill_time; /* When to write the fill values */
H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
/* Retrieve dataset's fill-value properties */
- if(H5P_fill_value_defined(dc_plist, &fill_status)<0)
+ if(H5P_is_fill_value_defined(&dcpl_cache.fill, &fill_status)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
- if((fill_status==H5D_FILL_VALUE_DEFAULT || fill_status==H5D_FILL_VALUE_USER_DEFINED)
- && H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,"can't retrieve fill value")
- if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,"can't retrieve fill time")
/* Should be impossible, but check anyway... */
- if(fill_status == H5D_FILL_VALUE_UNDEFINED && (fill_time == H5D_FILL_TIME_ALLOC || fill_time == H5D_FILL_TIME_IFSET))
+ if(fill_status == H5D_FILL_VALUE_UNDEFINED &&
+ (dcpl_cache.fill_time == H5D_FILL_TIME_ALLOC || dcpl_cache.fill_time == H5D_FILL_TIME_IFSET))
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "read failed: dataset doesn't exist, no data can be read")
/* If we're never going to fill this dataset, just leave the junk in the user's buffer */
- if(fill_time == H5D_FILL_TIME_NEVER)
+ if(dcpl_cache.fill_time == H5D_FILL_TIME_NEVER)
HGOTO_DONE(SUCCEED)
/* Go fill the user's selection with the dataset's fill value */
- if(H5D_fill(fill.buf,dataset->type,buf,mem_type,mem_space, dxpl_id)<0)
+ if(H5D_fill(dcpl_cache.fill.buf,dataset->type,buf,mem_type,mem_space,dxpl_id)<0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed")
else
HGOTO_DONE(SUCCEED)
@@ -645,33 +772,26 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
/* Don't reset the transfer mode if we can't or won't use it */
if(!use_par_opt_io || !H5T_path_noop(tpath))
- H5D_io_assist_mpio(dx_plist, xfer_mode, &xfer_mode_changed);
+ H5D_io_assist_mpio(dxpl_id, &dxpl_cache, &xfer_mode_changed);
#endif /*H5_HAVE_PARALLEL*/
/* Determine correct I/O routine to invoke */
if(dataset->layout.type!=H5D_CHUNKED) {
- if(H5D_contig_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, dc_plist,
- dx_plist, dxpl_id, src_id, dst_id, buf)<0)
+ if(H5D_contig_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, &dcpl_cache,
+ &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
} /* end if */
else {
- if(H5D_chunk_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, dc_plist,
- dx_plist, dxpl_id, src_id, dst_id, buf)<0)
+ if(H5D_chunk_read(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, &dcpl_cache,
+ &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
} /* end else */
done:
#ifdef H5_HAVE_PARALLEL
- /* restore xfer_mode due to the kludge */
- if (xfer_mode_changed) {
-#ifdef H5D_DEBUG
- if (H5DEBUG(D))
- fprintf (H5DEBUG(D), "H5D: xfer_mode was COLLECTIVE, restored to INDEPENDENT\n");
-#endif
- xfer_mode = H5FD_MPIO_COLLECTIVE;
- if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0)
- HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode")
- } /* end if */
+ /* Restore xfer_mode due to the kludge */
+ if (xfer_mode_changed)
+ H5D_io_restore_mpio(dxpl_id);
#endif /*H5_HAVE_PARALLEL*/
if (src_id >= 0) {
if(H5I_dec_ref(src_id)<0)
@@ -741,11 +861,10 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5S_conv_t *sconv=NULL; /*space conversion funcs*/
hbool_t use_par_opt_io=FALSE; /* Whether the 'optimized' I/O routines with be parallel */
#ifdef H5_HAVE_PARALLEL
- H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */
hbool_t xfer_mode_changed=FALSE; /* Whether the transfer mode was changed */
#endif /*H5_HAVE_PARALLEL*/
- H5P_genplist_t *dx_plist=NULL; /* Data transfer property list */
- H5P_genplist_t *dc_plist; /* Dataset creation roperty list */
+ H5D_dxpl_cache_t dxpl_cache; /* Data transfer property cache */
+ H5D_dcpl_cache_t dcpl_cache; /* Dataset creation property cache */
unsigned sconv_flags=0; /* Flags for the space conversion */
herr_t ret_value = SUCCEED; /* Return value */
@@ -776,13 +895,13 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
if (0==(H5F_get_intent(dataset->ent.file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file")
- /* Get the dataset's creation property list */
- if (NULL == (dc_plist = H5I_object(dataset->dcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
+ /* Fill the DCPL cache values for later use */
+ if (H5D_get_dcpl_cache(dataset->dcpl_id,&dcpl_cache)<0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dcpl cache")
- /* Get the dataset transfer property list */
- if (NULL == (dx_plist = H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
+ /* Fill the DXPL cache values for later use */
+ if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
if (!file_space)
file_space = dataset->space;
@@ -793,16 +912,13 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
#ifdef H5_HAVE_PARALLEL
- /* Collect Parallel I/O information for possible later use */
- xfer_mode=(H5FD_mpio_xfer_t)H5P_peek_unsigned(dx_plist, H5D_XFER_IO_XFER_MODE_NAME);
-
/* Collective access is not permissible without a MPI based VFD */
- if (xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file))
+ if (dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPI(dataset->ent.file))
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based driver only")
/* Set the "parallel I/O possible" flag, for H5S_find(), if we are doing collective I/O */
/* (Don't set the parallel I/O possible flag for the MPI-posix driver, since it doesn't do real collective I/O) */
- if (H5S_mpi_opt_types_g && xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file))
+ if (H5S_mpi_opt_types_g && dxpl_cache.xfer_mode==H5FD_MPIO_COLLECTIVE && !IS_H5FD_MPIPOSIX(dataset->ent.file))
sconv_flags |= H5S_CONV_PAR_IO_POSSIBLE;
#endif /*H5_HAVE_PARALLEL*/
@@ -874,19 +990,20 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef H5_HAVE_PARALLEL
/* Don't reset the transfer mode if we can't or won't use it */
- if(!use_par_opt_io || !H5T_path_noop(tpath))
- H5D_io_assist_mpio(dx_plist, xfer_mode, &xfer_mode_changed);
+ if(!use_par_opt_io || !H5T_path_noop(tpath)) {
+ H5D_io_assist_mpio(dxpl_id, &dxpl_cache, &xfer_mode_changed);
+ } /* end if */
#endif /*H5_HAVE_PARALLEL*/
/* Determine correct I/O routine to invoke */
if(dataset->layout.type!=H5D_CHUNKED) {
- if(H5D_contig_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, dc_plist,
- dx_plist, dxpl_id, src_id, dst_id, buf)<0)
+ if(H5D_contig_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, &dcpl_cache,
+ &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
} /* end if */
else {
- if(H5D_chunk_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, dc_plist,
- dx_plist, dxpl_id, src_id, dst_id, buf)<0)
+ if(H5D_chunk_write(nelmts, dataset, mem_type, mem_space, file_space, tpath, sconv, &dcpl_cache,
+ &dxpl_cache, dxpl_id, src_id, dst_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
} /* end else */
@@ -907,16 +1024,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
done:
#ifdef H5_HAVE_PARALLEL
- /* restore xfer_mode due to the kludge */
- if (xfer_mode_changed) {
-#ifdef H5D_DEBUG
- if (H5DEBUG(D))
- fprintf (H5DEBUG(D), "H5D: xfer_mode was COLLECTIVE, restored to INDEPENDENT\n");
-#endif
- xfer_mode = H5FD_MPIO_COLLECTIVE;
- if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0)
- HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode")
- } /* end if */
+ /* Restore xfer_mode due to the kludge */
+ if (xfer_mode_changed)
+ H5D_io_restore_mpio(dxpl_id);
#endif /*H5_HAVE_PARALLEL*/
if (src_id >= 0) {
if(H5I_dec_ref(src_id)<0)
@@ -951,8 +1061,9 @@ done:
static herr_t
H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
const H5S_t *mem_space, const H5S_t *file_space, H5T_path_t *tpath,
- H5S_conv_t *sconv, H5P_genplist_t *dc_plist, H5P_genplist_t *dx_plist,
- hid_t dxpl_id, hid_t src_id, hid_t dst_id, void *buf/*out*/)
+ H5S_conv_t *sconv, const H5D_dcpl_cache_t *dcpl_cache,
+ const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
+ hid_t src_id, hid_t dst_id, void *buf/*out*/)
{
herr_t status; /*function return status*/
#ifdef H5S_DEBUG
@@ -989,8 +1100,8 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 ||
dataset->layout.type==H5D_COMPACT);
status = (sconv->read)(dataset->ent.file, &(dataset->layout),
- dc_plist, (H5D_storage_t *)&(dataset->efl), H5T_get_size(dataset->type),
- file_space, mem_space, dxpl_id, buf/*out*/);
+ dcpl_cache, (H5D_storage_t *)&(dataset->efl), H5T_get_size(dataset->type),
+ file_space, mem_space, dxpl_cache, dxpl_id, buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].read_timer), &timer);
sconv->stats[1].read_nbytes += nelmts * H5T_get_size(dataset->type);
@@ -1012,7 +1123,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
/* Compute element sizes and other parameters */
src_type_size = H5T_get_size(dataset->type);
dst_type_size = H5T_get_size(mem_type);
- target_size = H5P_peek_size_t(dx_plist,H5D_XFER_MAX_TEMP_BUF_NAME);
+ target_size = dxpl_cache->max_temp_buf;
/* XXX: This could cause a problem if the user sets their buffer size
* to the same size as the default, and then the dataset elements are
* too large for the buffer... - QAK
@@ -1048,19 +1159,18 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
H5T_bkg_t path_bkg; /* Type conversion's background info */
/* Retrieve the bkgr buffer property */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+ need_bkg=dxpl_cache->bkgr_buf_type;
path_bkg = H5T_path_bkg(tpath);
need_bkg = MAX(path_bkg, need_bkg);
} else {
need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/
} /* end else */
- if (NULL==(tconv_buf=H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))) {
+ if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
- if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))) {
+ if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
H5_CHECK_OVERFLOW((request_nelmts*dst_type_size),hsize_t,size_t);
if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(size_t)(request_nelmts*dst_type_size)))==NULL)
@@ -1085,8 +1195,8 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 ||
dataset->layout.type==H5D_COMPACT);
n = H5S_select_fgath(dataset->ent.file, &(dataset->layout),
- dc_plist, (H5D_storage_t *)&(dataset->efl), src_type_size, file_space,
- &file_iter, smine_nelmts, dxpl_id, tconv_buf/*out*/);
+ dcpl_cache, (H5D_storage_t *)&(dataset->efl), src_type_size, file_space,
+ &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].gath_timer), &timer);
@@ -1101,7 +1211,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
H5_timer_begin(&timer);
#endif
n = H5S_select_mgath(buf, dst_type_size, mem_space, &bkg_iter,
- smine_nelmts, dxpl_id, bkg_buf/*out*/);
+ smine_nelmts, dxpl_cache, bkg_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].bkg_timer), &timer);
sconv->stats[1].bkg_nbytes += n * dst_type_size;
@@ -1124,7 +1234,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
H5_timer_begin(&timer);
#endif
status = H5S_select_mscat(tconv_buf, dst_type_size, mem_space,
- &mem_iter, smine_nelmts, dxpl_id, buf/*out*/);
+ &mem_iter, smine_nelmts, dxpl_cache, buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].scat_timer), &timer);
sconv->stats[1].scat_nbytes += smine_nelmts * dst_type_size;
@@ -1150,10 +1260,9 @@ done:
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
- assert(dx_plist);
- if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))
+ if (tconv_buf && NULL==dxpl_cache->tconv_buf)
H5FL_BLK_FREE(type_conv,tconv_buf);
- if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))
+ if (bkg_buf && NULL==dxpl_cache->bkgr_buf)
H5FL_BLK_FREE(type_conv,bkg_buf);
FUNC_LEAVE_NOAPI(ret_value)
@@ -1179,8 +1288,9 @@ done:
/* ARGSUSED */
static herr_t
H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
- const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist,
- H5P_genplist_t *dx_plist, hid_t dxpl_id,
+ const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv,
+ const H5D_dcpl_cache_t *dcpl_cache,
+ const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
hid_t src_id, hid_t dst_id, const void *buf)
{
herr_t status; /*function return status*/
@@ -1215,8 +1325,8 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5
H5_timer_begin(&timer);
#endif
status = (sconv->write)(dataset->ent.file, &(dataset->layout),
- dc_plist, (H5D_storage_t *)&(dataset->efl), H5T_get_size(dataset->type),
- file_space, mem_space, dxpl_id, buf);
+ dcpl_cache, (H5D_storage_t *)&(dataset->efl), H5T_get_size(dataset->type),
+ file_space, mem_space, dxpl_cache, dxpl_id, buf);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[0].write_timer), &timer);
sconv->stats[0].write_nbytes += nelmts * H5T_get_size(mem_type);
@@ -1238,7 +1348,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5
/* Compute element sizes and other parameters */
src_type_size = H5T_get_size(mem_type);
dst_type_size = H5T_get_size(dataset->type);
- target_size = H5P_peek_size_t(dx_plist,H5D_XFER_MAX_TEMP_BUF_NAME);
+ target_size = dxpl_cache->max_temp_buf;
/* XXX: This could cause a problem if the user sets their buffer size
* to the same size as the default, and then the dataset elements are
* too large for the buffer... - QAK
@@ -1278,19 +1388,18 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5
H5T_bkg_t path_bkg; /* Type conversion's background info */
/* Retrieve the bkgr buffer property */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+ need_bkg=dxpl_cache->bkgr_buf_type;
path_bkg = H5T_path_bkg(tpath);
need_bkg = MAX (path_bkg, need_bkg);
} else {
need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/
} /* end else */
- if (NULL==(tconv_buf=H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))) {
+ if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
- if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))) {
+ if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
H5_CHECK_OVERFLOW((request_nelmts*dst_type_size),hsize_t,size_t);
if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(size_t)(request_nelmts*dst_type_size)))==NULL)
@@ -1312,7 +1421,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5
H5_timer_begin(&timer);
#endif
n = H5S_select_mgath(buf, src_type_size, mem_space, &mem_iter,
- smine_nelmts, dxpl_id, tconv_buf/*out*/);
+ smine_nelmts, dxpl_cache, tconv_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[0].gath_timer), &timer);
sconv->stats[0].gath_nbytes += n * src_type_size;
@@ -1326,8 +1435,8 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5
H5_timer_begin(&timer);
#endif
n = H5S_select_fgath(dataset->ent.file, &(dataset->layout),
- dc_plist, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space,
- &bkg_iter, smine_nelmts, dxpl_id, bkg_buf/*out*/);
+ dcpl_cache, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space,
+ &bkg_iter, smine_nelmts, dxpl_cache, dxpl_id, bkg_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[0].bkg_timer), &timer);
@@ -1351,8 +1460,8 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5
H5_timer_begin(&timer);
#endif
status = H5S_select_fscat(dataset->ent.file, &(dataset->layout),
- dc_plist, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space, &file_iter,
- smine_nelmts, dxpl_id, tconv_buf);
+ dcpl_cache, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space, &file_iter,
+ smine_nelmts, dxpl_cache, dxpl_id, tconv_buf);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[0].scat_timer), &timer);
@@ -1378,10 +1487,9 @@ done:
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
- assert(dx_plist);
- if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))
+ if (tconv_buf && NULL==dxpl_cache->tconv_buf)
H5FL_BLK_FREE(type_conv,tconv_buf);
- if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))
+ if (bkg_buf && NULL==dxpl_cache->bkgr_buf)
H5FL_BLK_FREE(type_conv,bkg_buf);
FUNC_LEAVE_NOAPI(ret_value)
@@ -1411,8 +1519,10 @@ H5D_chunk_read(hsize_t
UNUSED
#endif /* NDEBUG */
nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
- const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist,
- H5P_genplist_t *dx_plist, hid_t dxpl_id, hid_t src_id, hid_t dst_id, void *buf/*out*/)
+ const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv,
+ const H5D_dcpl_cache_t *dcpl_cache,
+ const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
+ hid_t src_id, hid_t dst_id, void *buf/*out*/)
{
fm_map fm; /* File<->memory mapping */
H5TB_NODE *chunk_node; /* Current node in chunk TBBT */
@@ -1481,8 +1591,8 @@ UNUSED
/* Perform the actual read operation */
status = (sconv->read)(dataset->ent.file, &(dataset->layout),
- dc_plist, &store, H5T_get_size(dataset->type),
- chunk_info->fspace, chunk_info->mspace, dxpl_id, buf);
+ dcpl_cache, &store, H5T_get_size(dataset->type),
+ chunk_info->fspace, chunk_info->mspace, dxpl_cache, dxpl_id, buf);
/* Check return value from optimized read */
if (status<0)
@@ -1509,7 +1619,7 @@ UNUSED
/* Compute element sizes and other parameters */
src_type_size = H5T_get_size(dataset->type);
dst_type_size = H5T_get_size(mem_type);
- target_size = H5P_peek_size_t(dx_plist,H5D_XFER_MAX_TEMP_BUF_NAME);
+ target_size = dxpl_cache->max_temp_buf;
/* XXX: This could cause a problem if the user sets their buffer size
* to the same size as the default, and then the dataset elements are
* too large for the buffer... - QAK
@@ -1534,19 +1644,18 @@ UNUSED
H5T_bkg_t path_bkg; /* Type conversion's background info */
/* Retrieve the bkgr buffer property */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+ need_bkg=dxpl_cache->bkgr_buf_type;
path_bkg = H5T_path_bkg(tpath);
need_bkg = MAX(path_bkg, need_bkg);
} else {
need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/
} /* end else */
- if (NULL==(tconv_buf=H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))) {
+ if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
- if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))) {
+ if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
H5_CHECK_OVERFLOW((request_nelmts*dst_type_size),hsize_t,size_t);
if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(size_t)(request_nelmts*dst_type_size)))==NULL)
@@ -1602,8 +1711,8 @@ UNUSED
assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 ||
dataset->layout.type==H5D_COMPACT);
n = H5S_select_fgath(dataset->ent.file, &(dataset->layout),
- dc_plist, &store, src_type_size, chunk_info->fspace,
- &file_iter, smine_nelmts, dxpl_id, tconv_buf/*out*/);
+ dcpl_cache, &store, src_type_size, chunk_info->fspace,
+ &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].gath_timer), &timer);
@@ -1618,7 +1727,7 @@ UNUSED
H5_timer_begin(&timer);
#endif
n = H5S_select_mgath(buf, dst_type_size, chunk_info->mspace, &bkg_iter,
- smine_nelmts, dxpl_id, bkg_buf/*out*/);
+ smine_nelmts, dxpl_cache, bkg_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].bkg_timer), &timer);
sconv->stats[1].bkg_nbytes += n * dst_type_size;
@@ -1642,7 +1751,7 @@ UNUSED
H5_timer_begin(&timer);
#endif
status = H5S_select_mscat(tconv_buf, dst_type_size, chunk_info->mspace,
- &mem_iter, smine_nelmts, dxpl_id, buf/*out*/);
+ &mem_iter, smine_nelmts, dxpl_cache, buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].scat_timer), &timer);
sconv->stats[1].scat_nbytes += smine_nelmts * dst_type_size;
@@ -1674,10 +1783,9 @@ UNUSED
} /* end while */
done:
- assert(dx_plist);
- if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))
+ if (tconv_buf && NULL==dxpl_cache->tconv_buf)
H5FL_BLK_FREE(type_conv,tconv_buf);
- if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))
+ if (bkg_buf && NULL==dxpl_cache->bkgr_buf)
H5FL_BLK_FREE(type_conv,bkg_buf);
/* Release selection iterators, if necessary */
@@ -1725,8 +1833,9 @@ H5D_chunk_write(hsize_t
UNUSED
#endif /* NDEBUG */
nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
- const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv, H5P_genplist_t *dc_plist,
- H5P_genplist_t *dx_plist, hid_t dxpl_id,
+ const H5S_t *file_space, H5T_path_t *tpath, H5S_conv_t *sconv,
+ const H5D_dcpl_cache_t *dcpl_cache,
+ const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
hid_t src_id, hid_t dst_id, const void *buf)
{
fm_map fm; /* File<->memory mapping */
@@ -1819,8 +1928,8 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/* Perform the actual write operation */
status = (sconv->write)(dataset->ent.file, &(dataset->layout),
- dc_plist, &store, H5T_get_size(dataset->type),
- chunk_info->fspace, chunk_info->mspace, dxpl_id, buf);
+ dcpl_cache, &store, H5T_get_size(dataset->type),
+ chunk_info->fspace, chunk_info->mspace, dxpl_cache, dxpl_id, buf);
/* Check return value from optimized write */
if (status<0)
@@ -1863,7 +1972,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/* Compute element sizes and other parameters */
src_type_size = H5T_get_size(mem_type);
dst_type_size = H5T_get_size(dataset->type);
- target_size = H5P_peek_size_t(dx_plist,H5D_XFER_MAX_TEMP_BUF_NAME);
+ target_size = dxpl_cache->max_temp_buf;
/* XXX: This could cause a problem if the user sets their buffer size
* to the same size as the default, and then the dataset elements are
* too large for the buffer... - QAK
@@ -1892,19 +2001,18 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5T_bkg_t path_bkg; /* Type conversion's background info */
/* Retrieve the bkgr buffer property */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
+ need_bkg=dxpl_cache->bkgr_buf_type;
path_bkg = H5T_path_bkg(tpath);
need_bkg = MAX (path_bkg, need_bkg);
} else {
need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/
} /* end else */
- if (NULL==(tconv_buf=H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))) {
+ if (NULL==(tconv_buf=dxpl_cache->tconv_buf)) {
/* Allocate temporary buffer */
if((tconv_buf=H5FL_BLK_MALLOC(type_conv,target_size))==NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
- if (need_bkg && NULL==(bkg_buf=H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))) {
+ if (need_bkg && NULL==(bkg_buf=dxpl_cache->bkgr_buf)) {
/* Allocate background buffer */
H5_CHECK_OVERFLOW((request_nelmts*dst_type_size),hsize_t,size_t);
if((bkg_buf=H5FL_BLK_CALLOC(type_conv,(size_t)(request_nelmts*dst_type_size)))==NULL)
@@ -1957,7 +2065,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5_timer_begin(&timer);
#endif
n = H5S_select_mgath(buf, src_type_size, chunk_info->mspace, &mem_iter,
- smine_nelmts, dxpl_id, tconv_buf/*out*/);
+ smine_nelmts, dxpl_cache, tconv_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].gath_timer), &timer);
@@ -1972,8 +2080,8 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5_timer_begin(&timer);
#endif
n = H5S_select_fgath(dataset->ent.file, &(dataset->layout),
- dc_plist, &store, dst_type_size, chunk_info->fspace,
- &bkg_iter, smine_nelmts, dxpl_id, bkg_buf/*out*/);
+ dcpl_cache, &store, dst_type_size, chunk_info->fspace,
+ &bkg_iter, smine_nelmts, dxpl_cache, dxpl_id, bkg_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[0].bkg_timer), &timer);
@@ -1998,8 +2106,8 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5_timer_begin(&timer);
#endif
status = H5S_select_fscat(dataset->ent.file, &(dataset->layout),
- dc_plist, &store, dst_type_size, chunk_info->fspace,
- &file_iter, smine_nelmts, dxpl_id, tconv_buf);
+ dcpl_cache, &store, dst_type_size, chunk_info->fspace,
+ &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[0].scat_timer), &timer);
@@ -2032,10 +2140,9 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
} /* end while */
done:
- assert(dx_plist);
- if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))
+ if (tconv_buf && NULL==dxpl_cache->tconv_buf)
H5FL_BLK_FREE(type_conv,tconv_buf);
- if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))
+ if (bkg_buf && NULL==dxpl_cache->bkgr_buf)
H5FL_BLK_FREE(type_conv,bkg_buf);
/* Release selection iterators, if necessary */
@@ -2079,7 +2186,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_io_assist_mpio(H5P_genplist_t *dx_plist, H5FD_mpio_xfer_t xfer_mode,
+H5D_io_assist_mpio(hid_t dxpl_id, H5D_dxpl_cache_t *dxpl_cache,
hbool_t *xfer_mode_changed)
{
herr_t ret_value = SUCCEED; /*return value */
@@ -2091,25 +2198,68 @@ H5D_io_assist_mpio(H5P_genplist_t *dx_plist, H5FD_mpio_xfer_t xfer_mode,
* request according to the MPI collective specification.
* Do the collective request via independent mode.
*/
- if (xfer_mode==H5FD_MPIO_COLLECTIVE) {
+ if (dxpl_cache->xfer_mode==H5FD_MPIO_COLLECTIVE) {
+ H5P_genplist_t *dx_plist; /* Data transer property list */
+
+ /* Get the dataset transfer property list */
+ if (NULL == (dx_plist = H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
+
/* Kludge: change the xfer_mode to independent, handle the request,
* then xfer_mode before return.
* Better way is to get a temporary data_xfer property with
* INDEPENDENT xfer_mode and pass it downwards.
*/
- xfer_mode = H5FD_MPIO_INDEPENDENT;
- if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0)
+ dxpl_cache->xfer_mode = H5FD_MPIO_INDEPENDENT;
+ if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &dxpl_cache->xfer_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode")
*xfer_mode_changed=TRUE; /* restore it before return */
-#ifdef H5D_DEBUG
- if (H5DEBUG(D))
- fprintf(H5DEBUG(D), "H5D: Cannot handle this COLLECTIVE write request. Do it via INDEPENDENT calls\n");
-#endif
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5D_io_assist_mpio() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_io_restore_mpio
+ *
+ * Purpose: Common logic for restoring MPI transfer mode
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, February 6, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D_io_restore_mpio(hid_t dxpl_id)
+{
+ H5P_genplist_t *dx_plist; /* Data transer property list */
+ H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */
+ herr_t ret_value = SUCCEED; /*return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5D_io_restore_mpio)
+
+ /* Get the dataset transfer property list */
+ if (NULL == (dx_plist = H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list")
+
+ /* Kludge: change the xfer_mode to independent, handle the request,
+ * then xfer_mode before return.
+ * Better way is to get a temporary data_xfer property with
+ * INDEPENDENT xfer_mode and pass it downwards.
+ */
+ xfer_mode = H5FD_MPIO_COLLECTIVE;
+ if(H5P_set (dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_io_restore_mpio() */
#endif /*H5_HAVE_PARALLEL*/