summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2020-06-11 15:02:56 (GMT)
committerQuincey Koziol <koziol@lbl.gov>2020-06-11 15:02:56 (GMT)
commit24748a738ed80930d67fbab95c91e1c07971103b (patch)
treed2814c88db56a6e2256ccfe06c2eb69e480fe42e
parent770f7b844949e78412310f8d08e4282f971eed92 (diff)
parentdf31370d45d53f2e8ba10e74791a91e7efdb818f (diff)
downloadhdf5-24748a738ed80930d67fbab95c91e1c07971103b.zip
hdf5-24748a738ed80930d67fbab95c91e1c07971103b.tar.gz
hdf5-24748a738ed80930d67fbab95c91e1c07971103b.tar.bz2
Merge pull request #2640 in HDFFV/hdf5 from hdf5_1_12_opt_single_selection_io to hdf5_1_12
* commit 'df31370d45d53f2e8ba10e74791a91e7efdb818f': Add info to release notes about improvement for single element I/O. Eliminate allocating file & memory offset & length arrays when performing I/O on a single element.
-rw-r--r--release_docs/RELEASE.txt8
-rw-r--r--src/H5Dselect.c59
2 files changed, 39 insertions, 28 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 61f8ba8..69a1ce7 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -109,8 +109,14 @@ Bug Fixes since HDF5-1.12.0 release
==================================
Library
-------
+ - Streamline I/O to a single element, improving performance for record
+ appends to chunked datasets.
+
+ (QAK - 2020/06/11)
+
- Remove redundant tagging of metadata cache entries for some chunked
- dataset operations.
+ dataset operations, slightly improving performance for chunked
+ datasets.
(QAK - 2020/06/10)
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index a843d93..c5469c2 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -113,51 +113,38 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
HDassert(io_info->store);
HDassert(io_info->u.rbuf);
- /* Get info from API context */
- if(H5CX_get_vec_size(&dxpl_vec_size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size")
-
- /* Allocate the vector I/O arrays */
- if(dxpl_vec_size > H5D_IO_VECTOR_SIZE)
- vec_size = dxpl_vec_size;
- else
- vec_size = H5D_IO_VECTOR_SIZE;
- if(NULL == (mem_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
- if(NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
- if(NULL == (file_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
- if(NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
-
/* Check for only one element in selection */
if(nelmts == 1) {
+ hsize_t single_mem_off; /* Offset in memory */
+ hsize_t single_file_off; /* Offset in the file */
+ size_t single_mem_len; /* Length in memory */
+ size_t single_file_len; /* Length in the file */
+
/* Get offset of first element in selections */
- if(H5S_SELECT_OFFSET(file_space, file_off) < 0)
+ if(H5S_SELECT_OFFSET(file_space, &single_file_off) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve file selection offset")
- if(H5S_SELECT_OFFSET(mem_space, mem_off) < 0)
+ if(H5S_SELECT_OFFSET(mem_space, &single_mem_off) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve memory selection offset")
/* Set up necessary information for I/O operation */
file_nseq = mem_nseq = 1;
curr_mem_seq = curr_file_seq = 0;
- *file_off *= elmt_size;
- *mem_off *= elmt_size;
- *file_len = *mem_len = elmt_size;
+ single_file_off *= elmt_size;
+ single_mem_off *= elmt_size;
+ single_file_len = single_mem_len = elmt_size;
/* Perform I/O on memory and file sequences */
if(io_info->op_type == H5D_IO_OP_READ) {
if((tmp_file_len = (*io_info->layout_ops.readvv)(io_info,
- file_nseq, &curr_file_seq, file_len, file_off,
- mem_nseq, &curr_mem_seq, mem_len, mem_off)) < 0)
+ file_nseq, &curr_file_seq, &single_file_len, &single_file_off,
+ mem_nseq, &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error")
} /* end if */
else {
HDassert(io_info->op_type == H5D_IO_OP_WRITE);
if((tmp_file_len = (*io_info->layout_ops.writevv)(io_info,
- file_nseq, &curr_file_seq, file_len, file_off,
- mem_nseq, &curr_mem_seq, mem_len, mem_off)) < 0)
+ file_nseq, &curr_file_seq, &single_file_len, &single_file_off,
+ mem_nseq, &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error")
} /* end else */
@@ -168,6 +155,24 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
size_t mem_nelem; /* Number of elements used in memory sequences */
size_t file_nelem; /* Number of elements used in file sequences */
+ /* Get info from API context */
+ if(H5CX_get_vec_size(&dxpl_vec_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size")
+
+ /* Allocate the vector I/O arrays */
+ if(dxpl_vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = dxpl_vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (mem_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
+ if(NULL == (file_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
+
/* 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")