Add new API function H5Pget_actual_select_io_mode() (#2974)

This function allows the user to determine if the library performed selection I/O, vector I/O, or scalar (legacy) I/O during the last HDF5 operation performed with the provided DXPL. Expanded existing tests to check this functionality.
This commit is contained in:
Neil Fortner 2023-10-20 12:32:17 -05:00 committed by GitHub
parent b916ce2419
commit 630d6e27c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1485 additions and 811 deletions

View File

@ -711,6 +711,10 @@ of the library for reading or writing the actual data.</td>
<td>Gets the cause for not performing selection or vector I/O on the last parallel I/O call.</td>
</tr>
<tr>
<td>#H5Pget_actual_selection_io_mode</td>
<td>Gets the type(s) (scalar, vector, selection) of raw data I/O performed on the last I/O call.</td>
</tr>
<tr>
<td>#H5Pset_modify_write_buf/#H5Pget_modify_write_buf</td>
<td>Sets/gets a flag allowing the library to modify the contents of the write buffer.</td>
</tr>

View File

@ -228,6 +228,12 @@ New Features
Library:
--------
- Added new API function H5Pget_actual_selection_io_mode()
This function allows the user to determine if the library performed
selection I/O, vector I/O, or scalar (legacy) I/O during the last HDF5
operation performed with the provided DXPL.
- Added support for in-place type conversion in most cases
In-place type conversion allows the library to perform type conversion

View File

@ -299,6 +299,11 @@ typedef struct H5CX_t {
bool no_selection_io_cause_set; /* Whether reason for not performing selection I/O is set */
bool no_selection_io_cause_valid; /* Whether reason for not performing selection I/O is valid */
uint32_t
actual_selection_io_mode; /* Actual selection I/O mode used (H5D_ACTUAL_SELECTION_IO_MODE_NAME) */
hbool_t actual_selection_io_mode_set; /* Whether actual selection I/O mode is set */
hbool_t actual_selection_io_mode_valid; /* Whether actual selection I/O mode is valid */
/* Cached LCPL properties */
H5T_cset_t encoding; /* Link name character encoding */
bool encoding_valid; /* Whether link name character encoding is valid */
@ -380,6 +385,8 @@ typedef struct H5CX_dxpl_cache_t {
H5D_selection_io_mode_t selection_io_mode; /* Selection I/O mode (H5D_XFER_SELECTION_IO_MODE_NAME) */
uint32_t no_selection_io_cause; /* Reasons for not performing selection I/O
(H5D_XFER_NO_SELECTION_IO_CAUSE_NAME) */
uint32_t actual_selection_io_mode; /* Actual selection I/O mode
(H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME) */
bool modify_write_buf; /* Whether the library can modify write buffers */
} H5CX_dxpl_cache_t;
@ -571,13 +578,18 @@ H5CX_init(void)
/* Get the selection I/O mode */
if (H5P_get(dx_plist, H5D_XFER_SELECTION_IO_MODE_NAME, &H5CX_def_dxpl_cache.selection_io_mode) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method");
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve selection I/O mode");
/* Get the local & global reasons for breaking selection I/O values */
if (H5P_get(dx_plist, H5D_XFER_NO_SELECTION_IO_CAUSE_NAME, &H5CX_def_dxpl_cache.no_selection_io_cause) <
0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve cause for no selection I/O");
/* Get the actual selection I/O mode */
if (H5P_get(dx_plist, H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME,
&H5CX_def_dxpl_cache.actual_selection_io_mode) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve actual selection I/O mode");
/* Get the modify write buffer property */
if (H5P_get(dx_plist, H5D_XFER_MODIFY_WRITE_BUF_NAME, &H5CX_def_dxpl_cache.modify_write_buf) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve modify write buffer property");
@ -2514,6 +2526,47 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_no_selection_io_cause() */
/*-------------------------------------------------------------------------
* Function: H5CX_get_actual_selection_io_mode
*
* Purpose: Retrieves the actual I/O mode (scalar, vector, and/or selection) for the current API call
*context.
*
* Return: Non-negative on success / Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_get_actual_selection_io_mode(uint32_t *actual_selection_io_mode)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
assert(actual_selection_io_mode);
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
assert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
/* This property is a special case - we want to wipe out any previous setting. Copy the default setting
* if it has not been set yet. */
if ((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT && !(*head)->ctx.actual_selection_io_mode_set &&
!(*head)->ctx.actual_selection_io_mode_valid) {
(*head)->ctx.actual_selection_io_mode = H5CX_def_dxpl_cache.actual_selection_io_mode;
(*head)->ctx.actual_selection_io_mode_set = true;
}
H5CX_RETRIEVE_PROP_VALID_SET(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME,
actual_selection_io_mode)
/* Get the value */
*actual_selection_io_mode = (*head)->ctx.actual_selection_io_mode;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_actual_selection_io_mode() */
/*-------------------------------------------------------------------------
* Function: H5CX_get_modify_write_buf
*
@ -3443,7 +3496,7 @@ done:
#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
* Function: H5CX_set_no_selecction_io_cause
* Function: H5CX_set_no_selection_io_cause
*
* Purpose: Sets the reason for not performing selection I/O for
* the current API call context.
@ -3472,7 +3525,39 @@ H5CX_set_no_selection_io_cause(uint32_t no_selection_io_cause)
} /* end if */
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_no_selectiion_io_cause() */
} /* end H5CX_set_no_selection_io_cause() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_actual_selection_io_mode
*
* Purpose: Sets the actual selection I/O mode for the current API
* call context.
*
* Return: <none>
*
*-------------------------------------------------------------------------
*/
void
H5CX_set_actual_selection_io_mode(uint32_t actual_selection_io_mode)
{
H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
assert(head && *head);
assert((*head)->ctx.dxpl_id != H5P_DEFAULT);
/* If we're using the default DXPL, don't modify it */
if ((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT) {
/* Cache the value for later, marking it to set in DXPL when context popped */
(*head)->ctx.actual_selection_io_mode = actual_selection_io_mode;
(*head)->ctx.actual_selection_io_mode_set = true;
}
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_actual_selection_io_mode() */
/*-------------------------------------------------------------------------
* Function: H5CX_get_ohdr_flags
@ -3529,7 +3614,17 @@ H5CX__pop_common(bool update_dxpl_props)
/* Check for cached DXPL properties to return to application */
if (update_dxpl_props) {
/* actual_selection_io_mode is a special case - we always want to set it in the property list even if
* it was never set by the library, in that case it indicates no I/O was performed and we don't want
* to leave the (possibly incorrect) old value in the property list, so set from the default property
* list */
if ((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT && !(*head)->ctx.actual_selection_io_mode_set) {
(*head)->ctx.actual_selection_io_mode = H5CX_def_dxpl_cache.actual_selection_io_mode;
(*head)->ctx.actual_selection_io_mode_set = true;
}
H5CX_SET_PROP(H5D_XFER_NO_SELECTION_IO_CAUSE_NAME, no_selection_io_cause)
H5CX_SET_PROP(H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME, actual_selection_io_mode)
#ifdef H5_HAVE_PARALLEL
H5CX_SET_PROP(H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, mpio_actual_chunk_opt)
H5CX_SET_PROP(H5D_MPIO_ACTUAL_IO_MODE_NAME, mpio_actual_io_mode)

View File

@ -116,6 +116,7 @@ H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info);
H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
H5_DLL herr_t H5CX_get_selection_io_mode(H5D_selection_io_mode_t *selection_io_mode);
H5_DLL herr_t H5CX_get_no_selection_io_cause(uint32_t *no_selection_io_cause);
H5_DLL herr_t H5CX_get_actual_selection_io_mode(uint32_t *actual_selection_io_mode);
H5_DLL herr_t H5CX_get_modify_write_buf(bool *modify_write_buf);
/* "Getter" routines for LCPL properties cached in API context */
@ -162,6 +163,7 @@ H5_DLL herr_t H5CX_init(void);
/* "Setter" routines for cached DXPL properties that must be returned to application */
H5_DLL void H5CX_set_no_selection_io_cause(uint32_t no_selection_io_cause);
H5_DLL void H5CX_set_actual_selection_io_mode(uint32_t actual_selection_io_mode);
#ifdef H5_HAVE_PARALLEL
H5_DLL void H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t chunk_opt);

View File

@ -78,15 +78,16 @@
#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME \
"local_no_collective_cause" /* cause of broken collective I/O in each process */
#define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME \
"global_no_collective_cause" /* cause of broken collective I/O in all processes */
#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */
#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */
#define H5D_XFER_SELECTION_IO_MODE_NAME "selection_io_mode" /* Selection I/O mode */
#define H5D_XFER_NO_SELECTION_IO_CAUSE_NAME "no_selection_io_cause" /* Cause for no selection I/O */
#define H5D_XFER_MODIFY_WRITE_BUF_NAME "modify_write_buf" /* Modify write buffers */
"global_no_collective_cause" /* cause of broken collective I/O in all processes */
#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */
#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */
#define H5D_XFER_SELECTION_IO_MODE_NAME "selection_io_mode" /* Selection I/O mode */
#define H5D_XFER_NO_SELECTION_IO_CAUSE_NAME "no_selection_io_cause" /* Cause for no selection I/O */
#define H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME "actual_selection_io_mode" /* Actual selection I/O mode */
#define H5D_XFER_MODIFY_WRITE_BUF_NAME "modify_write_buf" /* Modify write buffers */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
/* Collective chunk instrumentation properties */
#define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard"

View File

@ -212,8 +212,9 @@ done:
herr_t
H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /*out*/)
{
hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */
herr_t ret_value = SUCCEED; /* Return value */
hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */
uint32_t actual_selection_io_mode;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@ -257,6 +258,13 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /*
if ((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed");
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SCALAR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_read() */
@ -273,9 +281,10 @@ done:
herr_t
H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf)
{
hid_t dxpl_id; /* DXPL for operation */
haddr_t eoa = HADDR_UNDEF; /* EOA for file */
herr_t ret_value = SUCCEED; /* Return value */
hid_t dxpl_id; /* DXPL for operation */
haddr_t eoa = HADDR_UNDEF; /* EOA for file */
uint32_t actual_selection_io_mode;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@ -308,6 +317,13 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void
if ((file->cls->write)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed");
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SCALAR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_write() */
@ -360,6 +376,7 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs
size_t size = 0;
H5FD_mem_t type = H5FD_MEM_DEFAULT;
hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */
hbool_t is_raw = FALSE; /* Does this include raw data */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@ -441,6 +458,10 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs
else {
type = types[i];
/* Check for raw data operation */
if (type == H5FD_MEM_DRAW)
is_raw = TRUE;
}
}
@ -455,13 +476,27 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs
(unsigned long long)eoa);
}
}
else
/* We must still check if this is a raw data read */
for (i = 0; i < count && types[i] != H5FD_MEM_NOLIST; i++)
if (types[i] == H5FD_MEM_DRAW) {
is_raw = true;
break;
}
/* if the underlying VFD supports vector read, make the call */
if (file->cls->read_vector) {
if ((file->cls->read_vector)(file, dxpl_id, count, types, addrs, sizes, bufs) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read vector request failed");
/* Set actual selection I/O mode, if this is a raw data operation */
if (is_raw) {
uint32_t actual_selection_io_mode;
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_VECTOR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
else {
@ -471,6 +506,7 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs
extend_sizes = false;
extend_types = false;
uint32_t no_selection_io_cause;
uint32_t actual_selection_io_mode;
for (i = 0; i < count; i++) {
@ -512,6 +548,13 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs
H5CX_get_no_selection_io_cause(&no_selection_io_cause);
no_selection_io_cause |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB;
H5CX_set_no_selection_io_cause(no_selection_io_cause);
/* Set actual selection I/O mode, if this is a raw data operation */
if (is_raw) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SCALAR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
done:
@ -575,6 +618,7 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr
H5FD_mem_t type = H5FD_MEM_DEFAULT;
hid_t dxpl_id; /* DXPL for operation */
haddr_t eoa = HADDR_UNDEF; /* EOA for file */
hbool_t is_raw = FALSE; /* Does this include raw data */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@ -646,6 +690,10 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr
else {
type = types[i];
/* Check for raw data operation */
if (type == H5FD_MEM_DRAW)
is_raw = true;
}
}
@ -663,10 +711,17 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr
/* if the underlying VFD supports vector write, make the call */
if (file->cls->write_vector) {
if ((file->cls->write_vector)(file, dxpl_id, count, types, addrs, sizes, bufs) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write vector request failed");
/* Set actual selection I/O mode, if this is a raw data operation */
if (is_raw) {
uint32_t actual_selection_io_mode;
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_VECTOR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
else {
/* otherwise, implement the vector write as a sequence of regular
@ -675,6 +730,7 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr
extend_sizes = false;
extend_types = false;
uint32_t no_selection_io_cause;
uint32_t actual_selection_io_mode;
for (i = 0; i < count; i++) {
@ -716,6 +772,13 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr
H5CX_get_no_selection_io_cause(&no_selection_io_cause);
no_selection_io_cause |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB;
H5CX_set_no_selection_io_cause(no_selection_io_cause);
/* Set actual selection I/O mode, if this is a raw data operation */
if (is_raw) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SCALAR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
done:
@ -996,18 +1059,35 @@ H5FD__read_selection_translate(uint32_t skip_vector_cb, H5FD_t *file, H5FD_mem_t
/* Issue vector read call if appropriate */
if (use_vector) {
uint32_t actual_selection_io_mode;
H5_CHECK_OVERFLOW(vec_arr_nused, size_t, uint32_t);
if ((file->cls->read_vector)(file, dxpl_id, (uint32_t)vec_arr_nused, types, addrs, sizes, vec_bufs) <
0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read vector request failed");
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW && count > 0) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_VECTOR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
else {
else if (count > 0) {
uint32_t no_selection_io_cause;
uint32_t actual_selection_io_mode;
/* Add H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB to no selection I/O cause */
H5CX_get_no_selection_io_cause(&no_selection_io_cause);
no_selection_io_cause |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB;
H5CX_set_no_selection_io_cause(no_selection_io_cause);
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SCALAR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
done:
@ -1161,6 +1241,8 @@ H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_s
/* if the underlying VFD supports selection read, make the call */
if (file->cls->read_selection) {
uint32_t actual_selection_io_mode;
/* Allocate array of space IDs if necessary, otherwise use local
* buffers */
if (count > sizeof(mem_space_ids_local) / sizeof(mem_space_ids_local[0])) {
@ -1186,6 +1268,13 @@ H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_s
if ((file->cls->read_selection)(file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets,
element_sizes, bufs) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read selection request failed");
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SELECTION_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
else
/* Otherwise, implement the selection read as a sequence of regular
@ -1337,9 +1426,18 @@ H5FD_read_selection_id(uint32_t skip_cb, H5FD_t *file, H5FD_mem_t type, uint32_t
/* if the underlying VFD supports selection read, make the call */
if (!skip_selection_cb && file->cls->read_selection) {
uint32_t actual_selection_io_mode;
if ((file->cls->read_selection)(file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets,
element_sizes, bufs) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read selection request failed");
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SELECTION_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
else {
/* Otherwise, implement the selection read as a sequence of regular
@ -1653,18 +1751,35 @@ H5FD__write_selection_translate(uint32_t skip_vector_cb, H5FD_t *file, H5FD_mem_
/* Issue vector write call if appropriate */
if (use_vector) {
uint32_t actual_selection_io_mode;
H5_CHECK_OVERFLOW(vec_arr_nused, size_t, uint32_t);
if ((file->cls->write_vector)(file, dxpl_id, (uint32_t)vec_arr_nused, types, addrs, sizes, vec_bufs) <
0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write vector request failed");
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW && count > 0) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_VECTOR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
else {
else if (count > 0) {
uint32_t no_selection_io_cause;
uint32_t actual_selection_io_mode;
/* Add H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB to no selection I/O cause */
H5CX_get_no_selection_io_cause(&no_selection_io_cause);
no_selection_io_cause |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB;
H5CX_set_no_selection_io_cause(no_selection_io_cause);
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SCALAR_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
done:
@ -1810,6 +1925,8 @@ H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_
/* if the underlying VFD supports selection write, make the call */
if (file->cls->write_selection) {
uint32_t actual_selection_io_mode;
/* Allocate array of space IDs if necessary, otherwise use local
* buffers */
if (count > sizeof(mem_space_ids_local) / sizeof(mem_space_ids_local[0])) {
@ -1835,6 +1952,13 @@ H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_
if ((file->cls->write_selection)(file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets,
element_sizes, bufs) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write selection request failed");
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SELECTION_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
else
/* Otherwise, implement the selection write as a sequence of regular
@ -1979,9 +2103,18 @@ H5FD_write_selection_id(uint32_t skip_cb, H5FD_t *file, H5FD_mem_t type, uint32_
/* if the underlying VFD supports selection write, make the call */
if (!skip_selection_cb && file->cls->write_selection) {
uint32_t actual_selection_io_mode;
if ((file->cls->write_selection)(file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets,
element_sizes, bufs) < 0)
HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write selection request failed");
/* Set actual selection I/O, if this is a raw data operation */
if (type == H5FD_MEM_DRAW) {
H5CX_get_actual_selection_io_mode(&actual_selection_io_mode);
actual_selection_io_mode |= H5D_SELECTION_IO;
H5CX_set_actual_selection_io_mode(actual_selection_io_mode);
}
}
else {
/* Otherwise, implement the selection write as a sequence of regular

View File

@ -893,9 +893,6 @@ H5Mget_count(hid_t map_id, hsize_t *count /*out*/, hid_t dxpl_id)
else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
/* Set up VOL callback arguments */
map_args.get.get_type = H5VL_MAP_GET_COUNT;
map_args.get.args.get_count.count = 0;
@ -952,9 +949,6 @@ H5M__put_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
/* Set up VOL callback arguments */
map_args.put.key_mem_type_id = key_mem_type_id;
map_args.put.key = key;
@ -1087,9 +1081,6 @@ H5M__get_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
/* Set up VOL callback arguments */
map_args.get_val.key_mem_type_id = key_mem_type_id;
map_args.get_val.key = key;
@ -1225,9 +1216,6 @@ H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists,
else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
/* Set up VOL callback arguments */
map_args.exists.key_mem_type_id = key_mem_type_id;
map_args.exists.key = key;
@ -1305,9 +1293,6 @@ H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op,
else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
/* Set up VOL callback arguments */
map_args.specific.specific_type = H5VL_MAP_ITER;
map_args.specific.args.iterate.loc_params.type = H5VL_OBJECT_BY_SELF;
@ -1394,9 +1379,6 @@ H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_m
else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
/* Set up VOL callback arguments */
map_args.specific.specific_type = H5VL_MAP_ITER;
map_args.specific.args.iterate.loc_params.type = H5VL_OBJECT_BY_NAME;
@ -1462,9 +1444,6 @@ H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id)
else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
/* Set up VOL callback arguments */
map_args.specific.specific_type = H5VL_MAP_DELETE;
map_args.specific.args.del.loc_params.type = H5VL_OBJECT_BY_SELF;

View File

@ -175,6 +175,9 @@
/* Definitions for cause of no selection I/O property */
#define H5D_XFER_NO_SELECTION_IO_CAUSE_SIZE sizeof(uint32_t)
#define H5D_XFER_NO_SELECTION_IO_CAUSE_DEF 0
/* Definitions for actual selection I/O mode property */
#define H5D_XFER_ACTUAL_SELECTION_IO_MODE_SIZE sizeof(uint32_t)
#define H5D_XFER_ACTUAL_SELECTION_IO_MODE_DEF 0
/* Definitions for modify write buffer property */
#define H5D_XFER_MODIFY_WRITE_BUF_SIZE sizeof(bool)
#define H5D_XFER_MODIFY_WRITE_BUF_DEF false
@ -295,7 +298,8 @@ static const H5S_t *H5D_def_dset_io_sel_g =
H5D_XFER_DSET_IO_SEL_DEF; /* Default value for dataset I/O selection */
static const H5D_selection_io_mode_t H5D_def_selection_io_mode_g = H5D_XFER_SELECTION_IO_MODE_DEF;
static const uint32_t H5D_def_no_selection_io_cause_g = H5D_XFER_NO_SELECTION_IO_CAUSE_DEF;
static const bool H5D_def_modify_write_buf_g = H5D_XFER_MODIFY_WRITE_BUF_DEF;
static const uint32_t H5D_def_actual_selection_io_mode_g = H5D_XFER_ACTUAL_SELECTION_IO_MODE_DEF;
static const bool H5D_def_modify_write_buf_g = H5D_XFER_MODIFY_WRITE_BUF_DEF;
/*-------------------------------------------------------------------------
* Function: H5P__dxfr_reg_prop
@ -470,6 +474,13 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the actual selection I/O mode property */
/* (Note: this property should not have an encode/decode callback) */
if (H5P__register_real(pclass, H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME,
H5D_XFER_ACTUAL_SELECTION_IO_MODE_SIZE, &H5D_def_actual_selection_io_mode_g, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class");
/* Register the modify write buffer property */
if (H5P__register_real(pclass, H5D_XFER_MODIFY_WRITE_BUF_NAME, H5D_XFER_MODIFY_WRITE_BUF_SIZE,
&H5D_def_modify_write_buf_g, NULL, NULL, NULL, H5D_XFER_MODIFY_WRITE_BUF_ENC,
@ -2456,6 +2467,39 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_no_selection_io_cause() */
/*-------------------------------------------------------------------------
* Function: H5Pget_actual_selection_io_mode
*
* Purpose: Retrieves actual selection I/O mode
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi
* April 27, 2023
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_actual_selection_io_mode(hid_t plist_id, uint32_t *actual_selection_io_mode /*out*/)
{
H5P_genplist_t *plist;
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", plist_id, actual_selection_io_mode);
/* Get the plist structure */
if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
/* Return values */
if (actual_selection_io_mode)
if (H5P_get(plist, H5D_XFER_ACTUAL_SELECTION_IO_MODE_NAME, actual_selection_io_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get actual_selection_io_mode value");
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_actual_selection_io_mode() */
/*-------------------------------------------------------------------------
* Function: H5P__dxfr_modify_write_buf_enc
*

View File

@ -420,6 +420,13 @@ typedef enum H5D_selection_io_mode_t {
} H5D_selection_io_mode_t;
//! <!--[H5D_selection_io_mode_t_snip] -->
/**
* Causes for H5Pget_actual_selection_io_mode() property
*/
#define H5D_SCALAR_IO (0x0001u) /**< Scalar (or legacy MPIO) I/O was performed */
#define H5D_VECTOR_IO (0x0002u) /**< Vector I/O was performed */
#define H5D_SELECTION_IO (0x0004u) /**< Selection I/O was performed */
/********************/
/* Public Variables */
/********************/
@ -5811,7 +5818,7 @@ H5_DLL int H5Pget_external_count(hid_t plist_id);
* \note H5Pget_fill_time() is designed to work in coordination with the
* dataset fill value and dataset storage allocation time properties,
* retrieved with the functions H5Pget_fill_value() and
* H5Pget_alloc_time().
* H5Pget_alloc_time().type == H5FD_MEM_DRAW
*
* \since 1.6.0
*
@ -8299,6 +8306,61 @@ H5_DLL herr_t H5Pget_selection_io(hid_t plist_id, H5D_selection_io_mode_t *selec
*/
H5_DLL herr_t H5Pget_no_selection_io_cause(hid_t plist_id, uint32_t *no_selection_io_cause);
/**
* \ingroup DXPL
*
* \brief Retrieves the type(s) of I/O that HDF5 actually performed on raw data
* during the last I/O call
*
* \dxpl_id{plist_id}
* \param[out] actual_selection_io_mode A bitwise set value indicating the
* type(s) of I/O performed
* \return \herr_t
*
* \par Motivation:
* A user can request selection I/O to be performed via a data transfer
* property list (DXPL). This can be used to enable collective I/O with
* type conversion, or with custom VFDs that support vector or selection
* I/O. However, there are conditions that can cause HDF5 to forgo
* selection or vector I/O and perform legacy (scalar) I/O instead.
* This function allows the user to determine which type or types of
* I/O were actually performed.
*
* \details H5Pget_actual_selection_io_mode() allows the user to determine which
* type(s) of I/O were actually performed on raw data during the last
* I/O operation which used \p plist_id. This property is set after
* all I/O is completed; if I/O fails, it will not be set.
*
* H5Pget_no_selection_io_cause() can be used to determine the reason
* why selection or vector I/O was not performed.
*
* Valid bitflags returned in \p actual_selection_io_mode are listed
* as follows.
*
* - #H5D_SCALAR_IO
* Scalar (or legacy MPIO) I/O was performed
* - #H5D_VECTOR_IO
* Vector I/O was performed
* - #H5D_SELECTION_IO
* Selection I/O was performed
*
* 0 or more of these can be present in \p actual_selection_io_mode in
* a bitwise fashion, since a single operation can trigger multiple
* instances of I/O, possibly with different types. A value of \p 0
* indicates no raw data I/O was performed during the operation.
*
* Be aware that this function will only include raw data I/O performed
* to/from disk as part of the last I/O operation. Any metadata
* I/O, including attribute and compact dataset I/O, is disregarded.
* It is also possible that data was cached in the dataset chunk cache
* or sieve buffer, which may prevent I/O from hitting the disk, and
* thereby prevent it from being counted by this function.
*
* \since 1.14.3
*
*/
H5_DLL herr_t H5Pget_actual_selection_io_mode(hid_t plist_id, uint32_t *actual_selection_io_mode);
/**
*
* \ingroup DXPL

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff