mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Fix for the bug exposed from running test/set_extent.c when selection… (#3319)
* Fix for the bug exposed from running test/set_extent.c when selection I/O is enabled. This is a fix from Neil. The test/set_extent.c is modified to test for selection I/O enabled.
This commit is contained in:
+32
-12
@@ -2731,11 +2731,20 @@ H5D__chunk_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)
|
||||
}
|
||||
} /* end if */
|
||||
else if (!skip_missing_chunks) {
|
||||
/* Set up nonexistent dataset info for (fill value) read from nonexistent chunk */
|
||||
nonexistent_dset_info.layout_io_info.contig_piece_info = chunk_info;
|
||||
nonexistent_dset_info.file_space = chunk_info->fspace;
|
||||
nonexistent_dset_info.mem_space = chunk_info->mspace;
|
||||
nonexistent_dset_info.nelmts = chunk_info->piece_points;
|
||||
|
||||
/* Set request_nelmts. This is not normally set by the upper layers because selection I/O
|
||||
* usually does not use strip mining (H5D__scatgath_write), and instead allocates buffers
|
||||
* large enough for the entire I/O. Set request_nelmts to be large enough for all selected
|
||||
* elements in this chunk because it must be at least that large */
|
||||
nonexistent_dset_info.type_info.request_nelmts = nonexistent_dset_info.nelmts;
|
||||
|
||||
/* Perform the actual read operation from the nonexistent chunk
|
||||
*/
|
||||
nonexistent_dset_info.file_space = chunk_info->fspace;
|
||||
nonexistent_dset_info.mem_space = chunk_info->mspace;
|
||||
nonexistent_dset_info.nelmts = chunk_info->piece_points;
|
||||
if ((dset_info->io_ops.single_read)(&nonexistent_io_info, &nonexistent_dset_info) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed");
|
||||
} /* end if */
|
||||
@@ -2866,9 +2875,10 @@ H5D__chunk_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)
|
||||
|
||||
/* Perform the actual read operation */
|
||||
assert(chk_io_info->count == 1);
|
||||
chk_io_info->dsets_info[0].file_space = chunk_info->fspace;
|
||||
chk_io_info->dsets_info[0].mem_space = chunk_info->mspace;
|
||||
chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points;
|
||||
chk_io_info->dsets_info[0].layout_io_info.contig_piece_info = chunk_info;
|
||||
chk_io_info->dsets_info[0].file_space = chunk_info->fspace;
|
||||
chk_io_info->dsets_info[0].mem_space = chunk_info->mspace;
|
||||
chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points;
|
||||
if ((dset_info->io_ops.single_read)(chk_io_info, &chk_io_info->dsets_info[0]) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed");
|
||||
|
||||
@@ -3055,10 +3065,19 @@ H5D__chunk_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)
|
||||
/* Set up the storage buffer information for this chunk */
|
||||
cpt_store.compact.buf = chunk;
|
||||
|
||||
/* Set up compact dataset info for write to cached chunk */
|
||||
cpt_dset_info.layout_io_info.contig_piece_info = chunk_info;
|
||||
cpt_dset_info.file_space = chunk_info->fspace;
|
||||
cpt_dset_info.mem_space = chunk_info->mspace;
|
||||
cpt_dset_info.nelmts = chunk_info->piece_points;
|
||||
|
||||
/* Set request_nelmts. This is not normally set by the upper layers because selection I/O
|
||||
* usually does not use strip mining (H5D__scatgath_write), and instead allocates buffers
|
||||
* large enough for the entire I/O. Set request_nelmts to be large enough for all selected
|
||||
* elements in this chunk because it must be at least that large */
|
||||
cpt_dset_info.type_info.request_nelmts = cpt_dset_info.nelmts;
|
||||
|
||||
/* Perform the actual write operation */
|
||||
cpt_dset_info.file_space = chunk_info->fspace;
|
||||
cpt_dset_info.mem_space = chunk_info->mspace;
|
||||
cpt_dset_info.nelmts = chunk_info->piece_points;
|
||||
if ((dset_info->io_ops.single_write)(&cpt_io_info, &cpt_dset_info) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed");
|
||||
|
||||
@@ -3253,9 +3272,10 @@ H5D__chunk_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info)
|
||||
|
||||
/* Perform the actual write operation */
|
||||
assert(chk_io_info->count == 1);
|
||||
chk_io_info->dsets_info[0].file_space = chunk_info->fspace;
|
||||
chk_io_info->dsets_info[0].mem_space = chunk_info->mspace;
|
||||
chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points;
|
||||
chk_io_info->dsets_info[0].layout_io_info.contig_piece_info = chunk_info;
|
||||
chk_io_info->dsets_info[0].file_space = chunk_info->fspace;
|
||||
chk_io_info->dsets_info[0].mem_space = chunk_info->mspace;
|
||||
chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points;
|
||||
if ((dset_info->io_ops.single_write)(chk_io_info, &chk_io_info->dsets_info[0]) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed");
|
||||
|
||||
|
||||
+3
-2
@@ -233,8 +233,9 @@ H5D__compact_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo)
|
||||
{
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
dinfo->store->compact.buf = dinfo->dset->shared->layout.storage.u.compact.buf;
|
||||
dinfo->store->compact.dirty = &dinfo->dset->shared->layout.storage.u.compact.dirty;
|
||||
dinfo->store->compact.buf = dinfo->dset->shared->layout.storage.u.compact.buf;
|
||||
dinfo->store->compact.dirty = &dinfo->dset->shared->layout.storage.u.compact.dirty;
|
||||
dinfo->layout_io_info.contig_piece_info = NULL;
|
||||
|
||||
/* Disable selection I/O */
|
||||
io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF;
|
||||
|
||||
@@ -198,6 +198,9 @@ H5D__efl_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo)
|
||||
|
||||
H5MM_memcpy(&dinfo->store->efl, &(dinfo->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t));
|
||||
|
||||
/* No "pieces" selected */
|
||||
dinfo->layout_io_info.contig_piece_info = NULL;
|
||||
|
||||
/* Disable selection I/O */
|
||||
io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF;
|
||||
io_info->no_selection_io_cause |= H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
|
||||
|
||||
+120
-55
@@ -32,9 +32,15 @@
|
||||
/****************/
|
||||
|
||||
/* Macro to determine if we're using H5D__compound_opt_read() */
|
||||
#define H5D__SCATGATH_USE_CMPD_OPT_READ(DSET_INFO, PIECE_INFO) \
|
||||
#define H5D__SCATGATH_USE_CMPD_OPT_READ(DSET_INFO, IN_PLACE_TCONV) \
|
||||
((DSET_INFO)->type_info.cmpd_subset && H5T_SUBSET_FALSE != (DSET_INFO)->type_info.cmpd_subset->subset && \
|
||||
!(PIECE_INFO)->in_place_tconv)
|
||||
!(IN_PLACE_TCONV))
|
||||
|
||||
/* Macro to determine if we're using H5D__compound_opt_write() */
|
||||
#define H5D__SCATGATH_USE_CMPD_OPT_WRITE(DSET_INFO, IN_PLACE_TCONV) \
|
||||
((DSET_INFO)->type_info.cmpd_subset && H5T_SUBSET_DST == (DSET_INFO)->type_info.cmpd_subset->subset && \
|
||||
(DSET_INFO)->type_info.dst_type_size == (DSET_INFO)->type_info.cmpd_subset->copy_size && \
|
||||
!(IN_PLACE_TCONV))
|
||||
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
@@ -49,7 +55,7 @@ static size_t H5D__gather_file(const H5D_io_info_t *io_info, const H5D_dset_io_i
|
||||
H5S_sel_iter_t *file_iter, size_t nelmts, void *buf);
|
||||
static herr_t H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_t *type_info,
|
||||
uint8_t *tconv_buf, void *user_buf /*out*/);
|
||||
static herr_t H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info, uint8_t *tconv_buf);
|
||||
static herr_t H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info, void *tconv_buf);
|
||||
|
||||
/*********************/
|
||||
/* Package Variables */
|
||||
@@ -440,6 +446,7 @@ herr_t
|
||||
H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info)
|
||||
{
|
||||
void *buf; /* Local pointer to application buffer */
|
||||
void *tmp_buf; /* Buffer to use for type conversion */
|
||||
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
|
||||
hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
|
||||
H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
|
||||
@@ -448,6 +455,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_
|
||||
hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
|
||||
hsize_t smine_start; /* Strip mine start loc */
|
||||
size_t smine_nelmts; /* Elements per strip */
|
||||
hbool_t in_place_tconv; /* Whether to perform in-place type_conversion */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
@@ -466,6 +474,10 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_
|
||||
if (dset_info->nelmts == 0)
|
||||
HGOTO_DONE(SUCCEED);
|
||||
|
||||
/* Check for in-place type conversion */
|
||||
in_place_tconv = dset_info->layout_io_info.contig_piece_info &&
|
||||
dset_info->layout_io_info.contig_piece_info->in_place_tconv;
|
||||
|
||||
/* Allocate the iterators */
|
||||
if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator");
|
||||
@@ -490,9 +502,34 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_
|
||||
for (smine_start = 0; smine_start < dset_info->nelmts; smine_start += smine_nelmts) {
|
||||
size_t n; /* Elements operated on */
|
||||
|
||||
/* Go figure out how many elements to read from the file */
|
||||
assert(H5S_SELECT_ITER_NELMTS(file_iter) == (dset_info->nelmts - smine_start));
|
||||
smine_nelmts = (size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start));
|
||||
|
||||
/* Determine strip mine size. First check if we're doing in-place type conversion */
|
||||
if (in_place_tconv) {
|
||||
/* If this is not a selection I/O operation and there is a background buffer, we cannot exceed
|
||||
* request_nelmts. It could be part of a selection I/O operation if this read is used to fill in
|
||||
* a nonexistent chunk */
|
||||
assert(!H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, in_place_tconv));
|
||||
if (dset_info->type_info.need_bkg && (io_info->use_select_io != H5D_SELECTION_IO_MODE_ON))
|
||||
smine_nelmts =
|
||||
(size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start));
|
||||
else {
|
||||
assert(smine_start == 0);
|
||||
smine_nelmts = dset_info->nelmts;
|
||||
}
|
||||
|
||||
/* Calculate buffer position in user buffer */
|
||||
tmp_buf = (uint8_t *)buf + dset_info->layout_io_info.contig_piece_info->buf_off +
|
||||
(smine_start * dset_info->type_info.dst_type_size);
|
||||
}
|
||||
else {
|
||||
/* Do type conversion using intermediate buffer */
|
||||
tmp_buf = io_info->tconv_buf;
|
||||
|
||||
/* Go figure out how many elements to read from the file */
|
||||
smine_nelmts =
|
||||
(size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start));
|
||||
}
|
||||
|
||||
/*
|
||||
* Gather the data from disk into the datatype conversion
|
||||
@@ -500,10 +537,19 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_
|
||||
* if necessary.
|
||||
*/
|
||||
|
||||
/* Fill background buffer here unless we will use H5D__compound_opt_read(). Must do this before
|
||||
* the read so the read buffer doesn't get wiped out if we're using in-place type conversion */
|
||||
if ((H5T_BKG_YES == dset_info->type_info.need_bkg) &&
|
||||
!H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, in_place_tconv)) {
|
||||
n = H5D__gather_mem(buf, bkg_iter, smine_nelmts, io_info->bkg_buf /*out*/);
|
||||
if (n != smine_nelmts)
|
||||
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed");
|
||||
}
|
||||
|
||||
/*
|
||||
* Gather data
|
||||
*/
|
||||
n = H5D__gather_file(io_info, dset_info, file_iter, smine_nelmts, io_info->tconv_buf /*out*/);
|
||||
n = H5D__gather_file(io_info, dset_info, file_iter, smine_nelmts, tmp_buf /*out*/);
|
||||
if (n != smine_nelmts)
|
||||
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed");
|
||||
|
||||
@@ -511,25 +557,18 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_
|
||||
* and no conversion is needed, copy the data directly into user's buffer and
|
||||
* bypass the rest of steps.
|
||||
*/
|
||||
if (dset_info->type_info.cmpd_subset &&
|
||||
H5T_SUBSET_FALSE != dset_info->type_info.cmpd_subset->subset) {
|
||||
if (H5D__compound_opt_read(smine_nelmts, mem_iter, &dset_info->type_info, io_info->tconv_buf,
|
||||
buf /*out*/) < 0)
|
||||
if (H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, in_place_tconv)) {
|
||||
if (H5D__compound_opt_read(smine_nelmts, mem_iter, &dset_info->type_info, tmp_buf, buf /*out*/) <
|
||||
0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed");
|
||||
} /* end if */
|
||||
else {
|
||||
if (H5T_BKG_YES == dset_info->type_info.need_bkg) {
|
||||
n = H5D__gather_mem(buf, bkg_iter, smine_nelmts, io_info->bkg_buf /*out*/);
|
||||
if (n != smine_nelmts)
|
||||
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed");
|
||||
} /* end if */
|
||||
|
||||
/*
|
||||
* Perform datatype conversion.
|
||||
*/
|
||||
if (H5T_convert(dset_info->type_info.tpath, dset_info->type_info.src_type_id,
|
||||
dset_info->type_info.dst_type_id, smine_nelmts, (size_t)0, (size_t)0,
|
||||
io_info->tconv_buf, io_info->bkg_buf) < 0)
|
||||
dset_info->type_info.dst_type_id, smine_nelmts, (size_t)0, (size_t)0, tmp_buf,
|
||||
io_info->bkg_buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed");
|
||||
|
||||
/* Do the data transform after the conversion (since we're using type mem_type) */
|
||||
@@ -540,14 +579,14 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_
|
||||
if (H5CX_get_data_transform(&data_transform) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info");
|
||||
|
||||
if (H5Z_xform_eval(data_transform, io_info->tconv_buf, smine_nelmts,
|
||||
dset_info->type_info.mem_type) < 0)
|
||||
if (H5Z_xform_eval(data_transform, tmp_buf, smine_nelmts, dset_info->type_info.mem_type) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform");
|
||||
}
|
||||
|
||||
/* Scatter the data into memory */
|
||||
if (H5D__scatter_mem(io_info->tconv_buf, mem_iter, smine_nelmts, buf /*out*/) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed");
|
||||
/* Scatter the data into memory if this was not an in-place conversion */
|
||||
if (!in_place_tconv)
|
||||
if (H5D__scatter_mem(tmp_buf, mem_iter, smine_nelmts, buf /*out*/) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed");
|
||||
} /* end else */
|
||||
} /* end for */
|
||||
|
||||
@@ -582,6 +621,7 @@ herr_t
|
||||
H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info)
|
||||
{
|
||||
const void *buf; /* Local pointer to application buffer */
|
||||
void *tmp_buf; /* Buffer to use for type conversion */
|
||||
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
|
||||
hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
|
||||
H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
|
||||
@@ -590,6 +630,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset
|
||||
hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
|
||||
hsize_t smine_start; /* Strip mine start loc */
|
||||
size_t smine_nelmts; /* Elements per strip */
|
||||
hbool_t in_place_tconv; /* Whether to perform in-place type_conversion */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
@@ -599,7 +640,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset
|
||||
assert(dset_info);
|
||||
assert(dset_info->mem_space);
|
||||
assert(dset_info->file_space);
|
||||
assert(dset_info->buf.vp);
|
||||
assert(dset_info->buf.cvp);
|
||||
|
||||
/* Set buf pointer */
|
||||
buf = dset_info->buf.cvp;
|
||||
@@ -608,6 +649,10 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset
|
||||
if (dset_info->nelmts == 0)
|
||||
HGOTO_DONE(SUCCEED);
|
||||
|
||||
/* Check for in-place type conversion */
|
||||
in_place_tconv = dset_info->layout_io_info.contig_piece_info &&
|
||||
dset_info->layout_io_info.contig_piece_info->in_place_tconv;
|
||||
|
||||
/* Allocate the iterators */
|
||||
if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator");
|
||||
@@ -633,29 +678,56 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset
|
||||
for (smine_start = 0; smine_start < dset_info->nelmts; smine_start += smine_nelmts) {
|
||||
size_t n; /* Elements operated on */
|
||||
|
||||
/* Go figure out how many elements to read from the file */
|
||||
assert(H5S_SELECT_ITER_NELMTS(file_iter) == (dset_info->nelmts - smine_start));
|
||||
smine_nelmts = (size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start));
|
||||
|
||||
/*
|
||||
* Gather data from application buffer into the datatype conversion
|
||||
* buffer. Also gather data from the file into the background buffer
|
||||
* if necessary.
|
||||
*/
|
||||
n = H5D__gather_mem(buf, mem_iter, smine_nelmts, io_info->tconv_buf /*out*/);
|
||||
if (n != smine_nelmts)
|
||||
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed");
|
||||
/* Determine strip mine size. First check if we're doing in-place type conversion */
|
||||
if (in_place_tconv) {
|
||||
/* If this is not a selection I/O operation and there is a background buffer, we cannot exceed
|
||||
* request_nelmts. It could be part of a selection I/O operation if this is used to write the
|
||||
* fill value to a cached chunk that will immediately be evicted. */
|
||||
assert(!H5D__SCATGATH_USE_CMPD_OPT_WRITE(dset_info, in_place_tconv));
|
||||
if (dset_info->type_info.need_bkg && (io_info->use_select_io != H5D_SELECTION_IO_MODE_ON))
|
||||
smine_nelmts =
|
||||
(size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start));
|
||||
else {
|
||||
assert(smine_start == 0);
|
||||
smine_nelmts = dset_info->nelmts;
|
||||
}
|
||||
|
||||
/* Calculate buffer position in user buffer */
|
||||
/* Use "vp" field of union to twiddle away const. OK because if we're doing this it means the
|
||||
* user explicitly allowed us to modify this buffer via H5Pset_modify_write_buf(). */
|
||||
tmp_buf = (uint8_t *)dset_info->buf.vp + dset_info->layout_io_info.contig_piece_info->buf_off +
|
||||
(smine_start * dset_info->type_info.dst_type_size);
|
||||
}
|
||||
else {
|
||||
/* Do type conversion using intermediate buffer */
|
||||
tmp_buf = io_info->tconv_buf;
|
||||
|
||||
/* Go figure out how many elements to read from the file */
|
||||
smine_nelmts =
|
||||
(size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start));
|
||||
|
||||
/*
|
||||
* Gather data from application buffer into the datatype conversion
|
||||
* buffer. Also gather data from the file into the background buffer
|
||||
* if necessary.
|
||||
*/
|
||||
n = H5D__gather_mem(buf, mem_iter, smine_nelmts, tmp_buf /*out*/);
|
||||
if (n != smine_nelmts)
|
||||
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed");
|
||||
}
|
||||
|
||||
/* If the source and destination are compound types and the destination is
|
||||
* is a subset of the source and no conversion is needed, copy the data
|
||||
* directly into user's buffer and bypass the rest of steps. If the source
|
||||
* directly from user's buffer and bypass the rest of steps. If the source
|
||||
* is a subset of the destination, the optimization is done in conversion
|
||||
* function H5T_conv_struct_opt to protect the background data.
|
||||
*/
|
||||
if (dset_info->type_info.cmpd_subset && H5T_SUBSET_DST == dset_info->type_info.cmpd_subset->subset &&
|
||||
dset_info->type_info.dst_type_size == dset_info->type_info.cmpd_subset->copy_size) {
|
||||
if (H5D__compound_opt_write(smine_nelmts, &dset_info->type_info, io_info->tconv_buf) < 0)
|
||||
if (H5D__SCATGATH_USE_CMPD_OPT_WRITE(dset_info, in_place_tconv)) {
|
||||
if (H5D__compound_opt_write(smine_nelmts, &dset_info->type_info, tmp_buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed");
|
||||
|
||||
} /* end if */
|
||||
else {
|
||||
if (H5T_BKG_YES == dset_info->type_info.need_bkg) {
|
||||
@@ -673,8 +745,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset
|
||||
if (H5CX_get_data_transform(&data_transform) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info");
|
||||
|
||||
if (H5Z_xform_eval(data_transform, io_info->tconv_buf, smine_nelmts,
|
||||
dset_info->type_info.mem_type) < 0)
|
||||
if (H5Z_xform_eval(data_transform, tmp_buf, smine_nelmts, dset_info->type_info.mem_type) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform");
|
||||
}
|
||||
|
||||
@@ -682,15 +753,15 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset
|
||||
* Perform datatype conversion.
|
||||
*/
|
||||
if (H5T_convert(dset_info->type_info.tpath, dset_info->type_info.src_type_id,
|
||||
dset_info->type_info.dst_type_id, smine_nelmts, (size_t)0, (size_t)0,
|
||||
io_info->tconv_buf, io_info->bkg_buf) < 0)
|
||||
dset_info->type_info.dst_type_id, smine_nelmts, (size_t)0, (size_t)0, tmp_buf,
|
||||
io_info->bkg_buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed");
|
||||
} /* end else */
|
||||
|
||||
/*
|
||||
* Scatter the data out to the file.
|
||||
*/
|
||||
if (H5D__scatter_file(io_info, dset_info, file_iter, smine_nelmts, io_info->tconv_buf) < 0)
|
||||
if (H5D__scatter_file(io_info, dset_info, file_iter, smine_nelmts, tmp_buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed");
|
||||
} /* end for */
|
||||
|
||||
@@ -795,7 +866,7 @@ H5D__scatgath_read_select(H5D_io_info_t *io_info)
|
||||
|
||||
/* Fill background buffer here unless we will use H5D__compound_opt_read(). Must do this before
|
||||
* the read so the read buffer doesn't get wiped out if we're using in-place type conversion */
|
||||
if (!H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, io_info->sel_pieces[i])) {
|
||||
if (!H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, io_info->sel_pieces[i]->in_place_tconv)) {
|
||||
/* Check for background buffer */
|
||||
if (dset_info->type_info.need_bkg) {
|
||||
assert(io_info->bkg_buf);
|
||||
@@ -864,7 +935,7 @@ H5D__scatgath_read_select(H5D_io_info_t *io_info)
|
||||
* and no conversion is needed, copy the data directly into user's buffer and
|
||||
* bypass the rest of steps.
|
||||
*/
|
||||
if (H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, io_info->sel_pieces[i])) {
|
||||
if (H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, io_info->sel_pieces[i]->in_place_tconv)) {
|
||||
if (H5D__compound_opt_read((size_t)io_info->sel_pieces[i]->piece_points, mem_iter,
|
||||
&dset_info->type_info, tmp_bufs[i], io_info->rbufs[i] /*out*/) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed");
|
||||
@@ -1064,18 +1135,11 @@ H5D__scatgath_write_select(H5D_io_info_t *io_info)
|
||||
* destination, the optimization is done in conversion function H5T_conv_struct_opt to
|
||||
* protect the background data.
|
||||
*/
|
||||
if (dset_info->type_info.cmpd_subset &&
|
||||
H5T_SUBSET_DST == dset_info->type_info.cmpd_subset->subset &&
|
||||
dset_info->type_info.dst_type_size == dset_info->type_info.cmpd_subset->copy_size &&
|
||||
!io_info->sel_pieces[i]->in_place_tconv) {
|
||||
if (H5D__SCATGATH_USE_CMPD_OPT_WRITE(dset_info, io_info->sel_pieces[i]->in_place_tconv)) {
|
||||
if (H5D__compound_opt_write((size_t)io_info->sel_pieces[i]->piece_points,
|
||||
&dset_info->type_info, tmp_write_buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed");
|
||||
|
||||
/* No background buffer necessary, prevent this element from being considered in the second
|
||||
* loop */
|
||||
/* Add this to H5Tconv.c? -NAF */
|
||||
dset_info->type_info.need_bkg = H5T_BKG_NO;
|
||||
} /* end if */
|
||||
else {
|
||||
/* Check for background buffer */
|
||||
@@ -1180,7 +1244,8 @@ H5D__scatgath_write_select(H5D_io_info_t *io_info)
|
||||
for (i = 0; i < io_info->pieces_added; i++) {
|
||||
H5D_dset_io_info_t *dset_info = io_info->sel_pieces[i]->dset_info;
|
||||
|
||||
if (H5T_BKG_YES == dset_info->type_info.need_bkg) {
|
||||
if ((H5T_BKG_YES == dset_info->type_info.need_bkg) &&
|
||||
!H5D__SCATGATH_USE_CMPD_OPT_WRITE(dset_info, io_info->sel_pieces[i]->in_place_tconv)) {
|
||||
/* Non-const write_buf[i]. Use pointer math here to avoid const warnings. When
|
||||
* there's a background buffer write_buf[i] always points inside the non-const tconv
|
||||
* buf so this is OK. */
|
||||
@@ -1422,7 +1487,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info, uint8_t *tconv_buf)
|
||||
H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info, void *tconv_buf)
|
||||
{
|
||||
uint8_t *xsbuf, *xdbuf; /* Source & destination pointers into dataset buffer */
|
||||
size_t src_stride, dst_stride; /* Strides through source & destination datatypes */
|
||||
|
||||
+3
-5
@@ -8411,11 +8411,9 @@ H5_DLL herr_t H5Pget_no_selection_io_cause(hid_t plist_id, uint32_t *no_selectio
|
||||
* default value for modify_write_buf is FALSE.
|
||||
*
|
||||
* This function can be used to allow the library to perform in-place
|
||||
* type conversion on write operations to save memory space. This is
|
||||
* currently only used for selection I/O operations, which are used for
|
||||
* collective I/O with type conversion. After making an API call with
|
||||
* this parameter set to TRUE, the contents of the write buffer are
|
||||
* undefined.
|
||||
* type conversion on write operations to save memory space. After making an
|
||||
* API call with this parameter set to TRUE, the contents of the write buffer
|
||||
* are undefined.
|
||||
*
|
||||
* \note When modify_write_buf is set to TRUE the library may violate the
|
||||
* const qualifier on the API parameter for the write buffer.
|
||||
|
||||
+124
-63
@@ -78,22 +78,22 @@ typedef enum rank4_index_t {
|
||||
RANK4_NINDICES, /* Must be last */
|
||||
} rank4_index_t;
|
||||
|
||||
static int do_ranks(hid_t fapl, hbool_t new_format);
|
||||
static int do_layouts(hid_t fapl);
|
||||
static int do_ranks(hid_t fapl, hbool_t new_format, hbool_t use_select_io);
|
||||
static int do_layouts(hid_t fapl, hbool_t use_select_io);
|
||||
|
||||
static int test_rank1(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
|
||||
static int test_rank1(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
|
||||
hbool_t set_istore_k);
|
||||
static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
|
||||
static int test_rank2(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
|
||||
hbool_t set_istore_k);
|
||||
static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
|
||||
static int test_rank3(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
|
||||
hbool_t set_istore_k);
|
||||
static int test_random_rank4(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
|
||||
hbool_t do_sparse, rank4_index_t index_type);
|
||||
static int test_random_rank4_vl(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
|
||||
hbool_t do_sparse, rank4_index_t index_type);
|
||||
static int test_random_rank4(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fillvalue,
|
||||
hbool_t disable_edge_filters, hbool_t do_sparse, rank4_index_t index_type);
|
||||
static int test_random_rank4_vl(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fillvalue,
|
||||
hbool_t disable_edge_filters, hbool_t do_sparse, rank4_index_t index_type);
|
||||
|
||||
static int test_external(hid_t fapl);
|
||||
static int test_layouts(H5D_layout_t layout, hid_t fapl);
|
||||
static int test_external(hid_t fapl, hbool_t use_select_io);
|
||||
static int test_layouts(H5D_layout_t layout, hid_t fapl, hid_t dxpl);
|
||||
static void test_random_rank4_dump(unsigned ndim_sets, hsize_t dim_log[][4], hsize_t cdims[4], int j, int k,
|
||||
int l, int m);
|
||||
|
||||
@@ -177,14 +177,21 @@ main(void)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Tests which use chunked datasets */
|
||||
if (!new_format || (new_format && contig_addr_vfd))
|
||||
nerrors += do_ranks(my_fapl, new_format) < 0 ? 1 : 0;
|
||||
if (!new_format || (new_format && contig_addr_vfd)) {
|
||||
/* Run do_ranks() with H5D_SELECTION_IO_MODE_DEFAULT/H5D_SELECTION_IO_MODE_ON */
|
||||
nerrors += do_ranks(my_fapl, new_format, FALSE) < 0 ? 1 : 0;
|
||||
nerrors += do_ranks(my_fapl, new_format, TRUE) < 0 ? 1 : 0;
|
||||
}
|
||||
} /* end for */
|
||||
|
||||
/* Tests which do not use chunked datasets */
|
||||
if (!new_format || (new_format && contig_addr_vfd)) {
|
||||
nerrors += test_external(fapl) < 0 ? 1 : 0;
|
||||
nerrors += do_layouts(fapl) < 0 ? 1 : 0;
|
||||
/* Run test_external() with H5D_SELECTION_IO_MODE_DEFAULT/H5D_SELECTION_IO_MODE_ON */
|
||||
nerrors += test_external(fapl, FALSE) < 0 ? 1 : 0;
|
||||
nerrors += test_external(fapl, TRUE) < 0 ? 1 : 0;
|
||||
/* Run do_layouts() with H5D_SELECTION_IO_MODE_DEFAULT/H5D_SELECTION_IO_MODE_ON */
|
||||
nerrors += do_layouts(fapl, FALSE) < 0 ? 1 : 0;
|
||||
nerrors += do_layouts(fapl, TRUE) < 0 ? 1 : 0;
|
||||
}
|
||||
} /* end for */
|
||||
|
||||
@@ -217,18 +224,32 @@ error:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
do_ranks(hid_t fapl, hbool_t new_format)
|
||||
do_ranks(hid_t fapl, hbool_t new_format, hbool_t use_select_io)
|
||||
{
|
||||
|
||||
hbool_t do_fillvalue = FALSE;
|
||||
hbool_t disable_edge_filters = FALSE;
|
||||
rank4_index_t index_type;
|
||||
hid_t dcpl = -1;
|
||||
hid_t dxpl = -1;
|
||||
int fillvalue = FILL_VALUE;
|
||||
unsigned config;
|
||||
hbool_t driver_is_parallel;
|
||||
|
||||
TESTING_2("datasets with ranks 1 to 4 (all configurations)");
|
||||
if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
if (use_select_io) {
|
||||
TESTING_2("datasets with ranks 1 to 4 (all configurations)");
|
||||
printf("\n With H5D_SELECTION_IO_MODE_ON ");
|
||||
|
||||
if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0)
|
||||
TEST_ERROR;
|
||||
}
|
||||
else {
|
||||
TESTING_2("datasets with ranks 1 to 4 (all configurations)");
|
||||
printf("\n With H5D_SELECTION_IO_MODE_DEFAULT ");
|
||||
}
|
||||
|
||||
if (h5_using_parallel_driver(fapl, &driver_is_parallel) < 0)
|
||||
TEST_ERROR;
|
||||
@@ -280,22 +301,22 @@ do_ranks(hid_t fapl, hbool_t new_format)
|
||||
else if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
if (test_rank1(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
if (test_rank1(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Rank 1")
|
||||
printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC"));
|
||||
goto error;
|
||||
} /* end if */
|
||||
if (test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
if (test_rank2(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Rank 2")
|
||||
printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC"));
|
||||
goto error;
|
||||
} /* end if */
|
||||
if (test_rank3(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
if (test_rank3(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Rank 3")
|
||||
printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC"));
|
||||
goto error;
|
||||
} /* end if */
|
||||
if (test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE) < 0) {
|
||||
if (test_rank2(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, TRUE) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Rank 2 with non-default indexed storage B-tree")
|
||||
printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC"));
|
||||
goto error;
|
||||
@@ -308,19 +329,19 @@ do_ranks(hid_t fapl, hbool_t new_format)
|
||||
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
if (test_rank1(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
if (test_rank1(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Rank 1")
|
||||
goto error;
|
||||
} /* end if */
|
||||
if (test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
if (test_rank2(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Rank 2")
|
||||
goto error;
|
||||
} /* end if */
|
||||
if (test_rank3(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
if (test_rank3(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, FALSE) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Rank 3")
|
||||
goto error;
|
||||
} /* end if */
|
||||
if (test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE) < 0) {
|
||||
if (test_rank2(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, TRUE) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Rank 2 with non-default indexed storage B-tree")
|
||||
goto error;
|
||||
} /* end if */
|
||||
@@ -335,7 +356,8 @@ do_ranks(hid_t fapl, hbool_t new_format)
|
||||
*/
|
||||
for (index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; index_type++) {
|
||||
/* Standard test */
|
||||
if (test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) {
|
||||
if (test_random_rank4(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, FALSE, index_type) <
|
||||
0) {
|
||||
DO_RANKS_PRINT_CONFIG("Randomized rank 4")
|
||||
printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
|
||||
? "btree"
|
||||
@@ -345,8 +367,8 @@ do_ranks(hid_t fapl, hbool_t new_format)
|
||||
|
||||
if (!driver_is_parallel) {
|
||||
/* VL test */
|
||||
if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) <
|
||||
0) {
|
||||
if (test_random_rank4_vl(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, FALSE,
|
||||
index_type) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length")
|
||||
printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
|
||||
? "btree"
|
||||
@@ -357,7 +379,8 @@ do_ranks(hid_t fapl, hbool_t new_format)
|
||||
|
||||
/* Sparse allocation test (regular and VL) */
|
||||
if (!(config & CONFIG_EARLY_ALLOC)) {
|
||||
if (test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) {
|
||||
if (test_random_rank4(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, TRUE,
|
||||
index_type) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Randomized rank 4 with sparse allocation")
|
||||
printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
|
||||
? "btree"
|
||||
@@ -366,7 +389,7 @@ do_ranks(hid_t fapl, hbool_t new_format)
|
||||
} /* end if */
|
||||
|
||||
if (!driver_is_parallel) {
|
||||
if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE,
|
||||
if (test_random_rank4_vl(fapl, dcpl, dxpl, do_fillvalue, disable_edge_filters, TRUE,
|
||||
index_type) < 0) {
|
||||
DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length with sparse allocation")
|
||||
printf(" Index: %s\n",
|
||||
@@ -388,6 +411,10 @@ do_ranks(hid_t fapl, hbool_t new_format)
|
||||
TEST_ERROR;
|
||||
} /* end for */
|
||||
|
||||
/* Close dxpl */
|
||||
if (H5Pclose(dxpl) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
PASSED();
|
||||
|
||||
return 0;
|
||||
@@ -396,6 +423,7 @@ error:
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5Pclose(dcpl);
|
||||
H5Pclose(dxpl);
|
||||
}
|
||||
H5E_END_TRY
|
||||
|
||||
@@ -407,13 +435,26 @@ error:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
do_layouts(hid_t fapl)
|
||||
do_layouts(hid_t fapl, hbool_t use_select_io)
|
||||
{
|
||||
hid_t new_fapl = -1;
|
||||
hid_t dxpl = -1;
|
||||
H5F_libver_t low, high; /* Low and high bounds */
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
TESTING("storage layout use - tested with all low/high library format bounds");
|
||||
|
||||
if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
if (use_select_io) {
|
||||
printf("\n With H5D_SELECTION_IO_MODE_ON ");
|
||||
if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0)
|
||||
TEST_ERROR;
|
||||
}
|
||||
else
|
||||
printf("\n With H5D_SELECTION_IO_MODE_DEFAULT ");
|
||||
|
||||
/* Loop through all the combinations of low/high library format bounds */
|
||||
for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
|
||||
for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
|
||||
@@ -435,10 +476,10 @@ do_layouts(hid_t fapl)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (test_layouts(H5D_COMPACT, new_fapl) < 0)
|
||||
if (test_layouts(H5D_COMPACT, new_fapl, dxpl) < 0)
|
||||
goto error;
|
||||
|
||||
if (test_layouts(H5D_CONTIGUOUS, new_fapl) < 0)
|
||||
if (test_layouts(H5D_CONTIGUOUS, new_fapl, dxpl) < 0)
|
||||
goto error;
|
||||
|
||||
if (H5Pclose(new_fapl) < 0)
|
||||
@@ -446,6 +487,9 @@ do_layouts(hid_t fapl)
|
||||
} /* end for high */
|
||||
} /* end for low */
|
||||
|
||||
if (H5Pclose(dxpl) < 0)
|
||||
goto error;
|
||||
|
||||
PASSED();
|
||||
|
||||
return 0;
|
||||
@@ -454,6 +498,7 @@ error:
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5Pclose(new_fapl);
|
||||
H5Pclose(dxpl);
|
||||
}
|
||||
H5E_END_TRY
|
||||
return -1;
|
||||
@@ -465,7 +510,8 @@ error:
|
||||
*/
|
||||
|
||||
static int
|
||||
test_rank1(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k)
|
||||
test_rank1(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
|
||||
hbool_t set_istore_k)
|
||||
{
|
||||
|
||||
hid_t fid = -1;
|
||||
@@ -536,7 +582,7 @@ test_rank1(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
TEST_ERROR;
|
||||
|
||||
/* write */
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, dxpl, buf_o) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG)
|
||||
@@ -575,7 +621,7 @@ test_rank1(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
TEST_ERROR;
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_e) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG)
|
||||
@@ -644,7 +690,7 @@ test_rank1(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
*/
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_s) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG)
|
||||
@@ -688,7 +734,7 @@ test_rank1(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
TEST_ERROR;
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_r) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG)
|
||||
@@ -798,7 +844,8 @@ error:
|
||||
*/
|
||||
|
||||
static int
|
||||
test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k)
|
||||
test_rank2(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
|
||||
hbool_t set_istore_k)
|
||||
{
|
||||
|
||||
hid_t fid = -1;
|
||||
@@ -891,7 +938,7 @@ test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
}
|
||||
|
||||
/* write */
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) {
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, dxpl, buf_o) < 0) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
@@ -950,7 +997,7 @@ test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
}
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_e) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG2)
|
||||
@@ -1046,7 +1093,7 @@ test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
*/
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) {
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_s) < 0) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
@@ -1114,7 +1161,7 @@ test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
*/
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_r) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG2)
|
||||
@@ -1292,7 +1339,8 @@ error:
|
||||
*/
|
||||
|
||||
static int
|
||||
test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k)
|
||||
test_rank3(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fill_value, hbool_t disable_edge_filters,
|
||||
hbool_t set_istore_k)
|
||||
{
|
||||
|
||||
hid_t fid = -1;
|
||||
@@ -1378,7 +1426,7 @@ test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
}
|
||||
|
||||
/* write */
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) {
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, dxpl, buf_o) < 0) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
@@ -1432,7 +1480,7 @@ test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
}
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_e) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG3)
|
||||
@@ -1523,7 +1571,7 @@ test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
*/
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) {
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_s) < 0) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
@@ -1585,7 +1633,7 @@ test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_f
|
||||
}
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_r) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG3)
|
||||
@@ -1726,13 +1774,14 @@ error:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_external(hid_t fapl)
|
||||
test_external(hid_t fapl, hbool_t use_select_io)
|
||||
{
|
||||
|
||||
hid_t fid = -1;
|
||||
hid_t did = -1;
|
||||
hid_t sid = -1;
|
||||
hid_t dcpl = -1;
|
||||
hid_t dxpl = -1;
|
||||
hsize_t dims_o[RANK2] = {DIM0, DIM1}; /* original dimensions */
|
||||
hsize_t dims_s[RANK2] = {DIMS0, DIMS1}; /* shrinking dimensions */
|
||||
hsize_t dims_e[RANK2] = {DIME0, DIM1}; /* extended dimensions, dimension 1 is the original */
|
||||
@@ -1761,6 +1810,18 @@ test_external(hid_t fapl)
|
||||
|
||||
TESTING("external file use");
|
||||
|
||||
if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
if (use_select_io) {
|
||||
printf("\n With H5D_SELECTION_IO_MODE_ON ");
|
||||
if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0)
|
||||
TEST_ERROR;
|
||||
}
|
||||
else {
|
||||
printf("\n With H5D_SELECTION_IO_MODE_DEFAULT ");
|
||||
}
|
||||
|
||||
/* create a new file */
|
||||
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
|
||||
if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
||||
@@ -1804,7 +1865,7 @@ test_external(hid_t fapl)
|
||||
FAIL_STACK_ERROR;
|
||||
if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, dxpl, buf_o) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Sclose(sid) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
@@ -1815,7 +1876,7 @@ test_external(hid_t fapl)
|
||||
*/
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ro) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_ro) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG)
|
||||
@@ -1870,7 +1931,7 @@ test_external(hid_t fapl)
|
||||
}
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_e) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG)
|
||||
@@ -1938,7 +1999,7 @@ test_external(hid_t fapl)
|
||||
*/
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_s) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG)
|
||||
@@ -2016,7 +2077,7 @@ error:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_layouts(H5D_layout_t layout, hid_t fapl)
|
||||
test_layouts(H5D_layout_t layout, hid_t fapl, hid_t dxpl)
|
||||
{
|
||||
|
||||
hid_t fid = -1;
|
||||
@@ -2065,7 +2126,7 @@ test_layouts(H5D_layout_t layout, hid_t fapl)
|
||||
}
|
||||
|
||||
/* write */
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) {
|
||||
if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, dxpl, buf_o) < 0) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
@@ -2119,7 +2180,7 @@ test_layouts(H5D_layout_t layout, hid_t fapl)
|
||||
}
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_r) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
#if defined(H5_SET_EXTENT_DEBUG4)
|
||||
@@ -2173,7 +2234,7 @@ test_layouts(H5D_layout_t layout, hid_t fapl)
|
||||
*/
|
||||
|
||||
/* read */
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0) {
|
||||
if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, buf_r) < 0) {
|
||||
TEST_ERROR;
|
||||
}
|
||||
|
||||
@@ -2232,7 +2293,7 @@ error:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_random_rank4(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
|
||||
test_random_rank4(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
|
||||
hbool_t do_sparse, rank4_index_t index_type)
|
||||
{
|
||||
hid_t file = -1;
|
||||
@@ -2332,7 +2393,7 @@ test_random_rank4(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_
|
||||
wbuf->arr[j][k][l][m] = HDrandom();
|
||||
|
||||
/* Write data */
|
||||
if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
|
||||
if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, H5S_ALL, dxpl, wbuf) < 0)
|
||||
RAND4_FAIL_DUMP(i + 1, -1, -1, -1, -1)
|
||||
} /* end if */
|
||||
|
||||
@@ -2361,7 +2422,7 @@ test_random_rank4(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_
|
||||
/* Read data from resized dataset */
|
||||
if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
|
||||
RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
|
||||
if (H5Dread(dset, H5T_NATIVE_INT, mspace, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
|
||||
if (H5Dread(dset, H5T_NATIVE_INT, mspace, H5S_ALL, dxpl, rbuf) < 0)
|
||||
RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
|
||||
|
||||
/* Verify correctness of read data */
|
||||
@@ -2449,7 +2510,7 @@ error:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_random_rank4_vl(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
|
||||
test_random_rank4_vl(hid_t fapl, hid_t dcpl, hid_t dxpl, hbool_t do_fillvalue, hbool_t disable_edge_filters,
|
||||
hbool_t do_sparse, rank4_index_t index_type)
|
||||
{
|
||||
hid_t file = -1;
|
||||
@@ -2594,7 +2655,7 @@ test_random_rank4_vl(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disab
|
||||
} /* end for */
|
||||
|
||||
/* Write data */
|
||||
if (H5Dwrite(dset, type, mspace, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
|
||||
if (H5Dwrite(dset, type, mspace, H5S_ALL, dxpl, wbuf) < 0)
|
||||
RAND4_FAIL_DUMP(i + 1, -1, -1, -1, -1)
|
||||
} /* end if */
|
||||
|
||||
@@ -2623,7 +2684,7 @@ test_random_rank4_vl(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disab
|
||||
/* Read data from resized dataset */
|
||||
if (H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
|
||||
RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
|
||||
if (H5Dread(dset, type, mspace, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
|
||||
if (H5Dread(dset, type, mspace, H5S_ALL, dxpl, rbuf) < 0)
|
||||
RAND4_FAIL_DUMP(i + 2, -1, -1, -1, -1)
|
||||
|
||||
/* Verify correctness of read data */
|
||||
|
||||
Reference in New Issue
Block a user