summaryrefslogtreecommitdiffstats
path: root/src/H5Fio.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-07-22 20:03:44 (GMT)
committerGitHub <noreply@github.com>2022-07-22 20:03:44 (GMT)
commit7983a584a0242f687efcd2dbd0deedfc0e960307 (patch)
tree71b3f44265e031288b871b33ec44d23c074ad2d4 /src/H5Fio.c
parent27bb358f7ab1d23f3f8ce081c6b4f1602033e4d7 (diff)
downloadhdf5-7983a584a0242f687efcd2dbd0deedfc0e960307.zip
hdf5-7983a584a0242f687efcd2dbd0deedfc0e960307.tar.gz
hdf5-7983a584a0242f687efcd2dbd0deedfc0e960307.tar.bz2
Switch to vector I/O for collective metadata writes (#1911)
* Switch to vector I/O for collective metadata writes * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5Fio.c')
-rw-r--r--src/H5Fio.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/H5Fio.c b/src/H5Fio.c
index 53fec97..287dd61 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -327,6 +327,85 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_shared_select_write() */
+herr_t
+H5F_shared_vector_read(H5F_shared_t *f_sh, uint32_t count, H5FD_mem_t types[], haddr_t addrs[],
+ size_t sizes[], void *bufs[])
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(f_sh);
+ HDassert((types) || (count == 0));
+ HDassert((addrs) || (count == 0));
+ HDassert((sizes) || (count == 0));
+ HDassert((bufs) || (count == 0));
+
+ /*
+ * Note that we don't try to map global heap data to raw
+ * data here, as it may become expensive to check for when
+ * I/O vectors are large. This may change in the future, but,
+ * for now, assume the caller has done this already.
+ */
+#ifndef NDEBUG
+ for (uint32_t i = 0; i < count; i++)
+ HDassert(types[i] != H5FD_MEM_GHEAP);
+#endif
+
+ /* Pass down to file driver layer (bypass page buffer for now) */
+ if (H5FD_read_vector(f_sh->lf, count, types, addrs, sizes, bufs) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vector read through file driver failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_shared_vector_write
+ *
+ * Purpose: Writes data from `count` buffers (from the `bufs` array) to
+ * a file/server/etc. at the offsets provided in the `addrs`
+ * array, with the data sizes specified in the `sizes` array
+ * and data memory types specified in the `types` array. The
+ * addresses are relative to the base address for the file.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_shared_vector_write(H5F_shared_t *f_sh, uint32_t count, H5FD_mem_t types[], haddr_t addrs[],
+ size_t sizes[], const void *bufs[])
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(f_sh);
+ HDassert((types) || (count == 0));
+ HDassert((addrs) || (count == 0));
+ HDassert((sizes) || (count == 0));
+ HDassert((bufs) || (count == 0));
+
+ /*
+ * Note that we don't try to map global heap data to raw
+ * data here, as it may become expensive to check for when
+ * I/O vectors are large. This may change in the future, but,
+ * for now, assume the caller has done this already.
+ */
+#ifndef NDEBUG
+ for (uint32_t i = 0; i < count; i++)
+ HDassert(types[i] != H5FD_MEM_GHEAP);
+#endif
+
+ /* Pass down to file driver layer (bypass page buffer for now) */
+ if (H5FD_write_vector(f_sh->lf, count, types, addrs, sizes, bufs) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write through file driver failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
/*-------------------------------------------------------------------------
* Function: H5F_flush_tagged_metadata
*