diff --git a/doxygen/examples/tables/propertyLists.dox b/doxygen/examples/tables/propertyLists.dox index 2f74c03770f..340e13c26a5 100644 --- a/doxygen/examples/tables/propertyLists.dox +++ b/doxygen/examples/tables/propertyLists.dox @@ -711,6 +711,10 @@ of the library for reading or writing the actual data. Gets the cause for not performing selection or vector I/O on the last parallel I/O call. +#H5Pget_actual_selection_io_mode +Gets the type(s) (scalar, vector, selection) of raw data I/O performed on the last I/O call. + + #H5Pset_modify_write_buf/#H5Pget_modify_write_buf Sets/gets a flag allowing the library to modify the contents of the write buffer. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index d2411d9a111..0239a9e356f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -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 diff --git a/src/H5CX.c b/src/H5CX.c index b3b2fca41b9..c46c58af35e 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -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 @@ H5CX_get_no_selection_io_cause(uint32_t *no_selection_io_cause) 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 @@ H5CX_test_set_mpio_coll_rank0_bcast(bool mpio_coll_rank0_bcast) #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: + * + *------------------------------------------------------------------------- + */ +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) diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index aa6883b62ef..76812ee55ef 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -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); diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 118c6cd4224..fa8b0770359 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -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" diff --git a/src/H5FDint.c b/src/H5FDint.c index 082b6021332..5d3a80212ef 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -212,8 +212,9 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) 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 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /* 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 diff --git a/src/H5M.c b/src/H5M.c index e2fd2025a9b..f59e02fa3ee 100644 --- a/src/H5M.c +++ b/src/H5M.c @@ -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; diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index b6130f5117d..9adb2d60d3f 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -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 @@ H5Pget_no_selection_io_cause(hid_t plist_id, uint32_t *no_selection_io_cause /*o 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 * diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index a58d97ffd22..d822925bc0d 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -420,6 +420,13 @@ typedef enum H5D_selection_io_mode_t { } H5D_selection_io_mode_t; //! +/** + * 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 diff --git a/test/select_io_dset.c b/test/select_io_dset.c index 79449aac070..33b1c843d09 100644 --- a/test/select_io_dset.c +++ b/test/select_io_dset.c @@ -104,13 +104,28 @@ typedef enum { #define TEST_TCONV_BUF_TOO_SMALL 0x100 #define TEST_IN_PLACE_TCONV 0x200 +static herr_t +check_actual_selection_io_mode(hid_t dxpl, uint32_t sel_io_mode_expected) +{ + uint32_t actual_sel_io_mode; + + if (H5Pget_actual_selection_io_mode(dxpl, &actual_sel_io_mode) < 0) + TEST_ERROR; + if (actual_sel_io_mode != sel_io_mode_expected) + TEST_ERROR; + + return SUCCEED; +error: + return FAIL; +} + /* * Case 1: single dataset read/write, no type conversion (null case) * --create dataset with H5T_NATIVE_INT * --write/read dataset with H5T_NATIVE_INT */ static herr_t -test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_no_type_conv(hid_t fid, unsigned set_cache, unsigned chunked, unsigned dtrans, unsigned mwbuf) { int i; hid_t did = H5I_INVALID_HID; @@ -130,14 +145,14 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) /* Create 1d data space */ dims[0] = DSET_SELECT_DIM; if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Generate dataset name */ @@ -146,7 +161,7 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) /* Create dataset */ if ((did = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize data */ for (i = 0; i < DSET_SELECT_DIM; i++) { @@ -156,23 +171,23 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set modify write buffer if requested */ if (mwbuf) if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set data transform */ if (dtrans) if (H5Pset_data_transform(dxpl, expr) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Copy wbuf if the library will be modifying it */ if (mwbuf) @@ -180,7 +195,11 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) /* Write data to the dataset with/without data transform */ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; + + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; /* Restore wbuf from backup if the library modified it */ if (mwbuf) @@ -188,7 +207,11 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) /* Read data from the dataset without data transform set in dxpl */ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, ntrans_dxpl, rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; + + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; /* Verify data or transformed data read */ for (i = 0; i < DSET_SELECT_DIM; i++) @@ -203,7 +226,7 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) /* Read the data from the dataset with data transform set in dxpl */ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Verify data read is transformed a second time */ for (i = 0; i < DSET_SELECT_DIM; i++) @@ -216,15 +239,15 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) } if (H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Dclose(did) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(ntrans_dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; PASSED(); @@ -252,7 +275,7 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) * --read again with H5T_STD_I32BE */ static herr_t -test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) +test_no_size_change_no_bkg(hid_t fid, unsigned set_cache, unsigned chunked, unsigned mwbuf) { int i; hid_t did = H5I_INVALID_HID; @@ -268,39 +291,39 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) int fillvalue = (-1); if ((wbuf = (char *)malloc((size_t)(4 * DSET_SELECT_DIM))) == NULL) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && (wbuf_bak = (char *)malloc((size_t)(4 * DSET_SELECT_DIM))) == NULL) - FAIL_STACK_ERROR; + TEST_ERROR; if ((rbuf = (char *)malloc((size_t)(4 * DSET_SELECT_DIM))) == NULL) - FAIL_STACK_ERROR; + TEST_ERROR; /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set modify write buffer if requested */ if (mwbuf) if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Create 1d data space */ dims[0] = DSET_SELECT_DIM; if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Generate dataset name */ @@ -309,7 +332,7 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create 1d dataset */ if ((did = H5Dcreate2(fid, dset_name, H5T_STD_I32BE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize data */ for (i = 0; i < DSET_SELECT_DIM; i++) { @@ -325,7 +348,11 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Write the data to the dataset with little endian */ if (H5Dwrite(did, H5T_STD_I32LE, H5S_ALL, H5S_ALL, dxpl, wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; + + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; /* Restore wbuf from backup if the library modified it */ if (mwbuf) @@ -333,7 +360,11 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Read the data from the dataset with little endian */ if (H5Dread(did, H5T_STD_I32LE, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; + + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; /* Verify data read little endian */ for (i = 0; i < DSET_SELECT_DIM; i++) @@ -347,7 +378,7 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Read the data from the dataset with big endian */ if (H5Dread(did, H5T_STD_I32BE, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Verify data read in big endian */ for (i = 0; i < DSET_SELECT_DIM; i++) @@ -360,13 +391,13 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) } if (H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Dclose(did) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; free(wbuf); free(wbuf_bak); @@ -405,7 +436,7 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) * */ static herr_t -test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_larger_mem_type_no_bkg(hid_t fid, unsigned set_cache, unsigned chunked, unsigned dtrans, unsigned mwbuf) { int i; hid_t did = H5I_INVALID_HID; @@ -425,14 +456,14 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign /* Create 1d data space */ dims[0] = DSET_SELECT_DIM; if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Generate dataset name */ @@ -441,7 +472,7 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign /* Create dataset */ if ((did = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize data */ for (i = 0; i < DSET_SELECT_DIM; i++) { @@ -451,23 +482,23 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set modify write buffer if requested */ if (mwbuf) if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set data transform */ if (dtrans) if (H5Pset_data_transform(dxpl, expr) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Copy wbuf if the library will be modifying it */ if (mwbuf) @@ -475,7 +506,11 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign /* Write data to the dataset with/without data transform set in dxpl */ if (H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, dxpl, wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; + + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; /* Restore wbuf from backup if the library modified it */ if (mwbuf) @@ -483,7 +518,11 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign /* Read the data from the dataset without data transform in dxpl */ if (H5Dread(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, ntrans_dxpl, rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; + + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; /* Verify data or transformed data read */ for (i = 0; i < DSET_SELECT_DIM; i++) @@ -498,7 +537,7 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign /* Read data from the dataset with data transform set in dxpl */ if (H5Dread(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Verify data read is transformed a second time */ for (i = 0; i < DSET_SELECT_DIM; i++) @@ -511,15 +550,15 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign } if (H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Dclose(did) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(ntrans_dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; PASSED(); @@ -547,7 +586,7 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign * --read dataset with H5T_NATIVE_SHORT */ static herr_t -test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_smaller_mem_type_no_bkg(hid_t fid, unsigned set_cache, unsigned chunked, unsigned dtrans, unsigned mwbuf) { int i; hid_t did = H5I_INVALID_HID; @@ -567,14 +606,14 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig /* Create 1d data space */ dims[0] = DSET_SELECT_DIM; if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Generate dataset name */ @@ -583,7 +622,7 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig /* Create 1d chunked dataset with/without data transform */ if ((did = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize data */ for (i = 0; i < DSET_SELECT_DIM; i++) { @@ -593,23 +632,23 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set modify write buffer if requested */ if (mwbuf) if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set data transform */ if (dtrans) { if (H5Pset_data_transform(dxpl, expr) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Copy wbuf if the library will be modifying it */ @@ -618,7 +657,11 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig /* Write data to the dataset with/without data transform in dxpl */ if (H5Dwrite(did, H5T_NATIVE_SHORT, H5S_ALL, H5S_ALL, dxpl, wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; + + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; /* Restore wbuf from backup if the library modified it */ if (mwbuf) @@ -626,7 +669,11 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig /* Read data from the dataset without data transform in dxpl */ if (H5Dread(did, H5T_NATIVE_SHORT, H5S_ALL, H5S_ALL, ntrans_dxpl, rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; + + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; /* Verify data or transformed data read */ for (i = 0; i < DSET_SELECT_DIM; i++) @@ -641,7 +688,7 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig /* Read data from the dataset with data transform set in dxpl */ if (H5Dread(did, H5T_NATIVE_SHORT, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Verify data read is transformed a second time */ for (i = 0; i < DSET_SELECT_DIM; i++) @@ -654,15 +701,15 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig } if (H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Dclose(did) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(ntrans_dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; PASSED(); @@ -730,55 +777,55 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set modify write buffer if requested */ if (mwbuf) if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Allocate buffers for datasets */ if (NULL == (s1_wbuf = (s1_t *)malloc(sizeof(s1_t) * DSET_SELECT_DIM))) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && NULL == (s1_wbuf_bak = (s1_t *)malloc(sizeof(s1_t) * DSET_SELECT_DIM))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (s1_rbuf = (s1_t *)malloc(sizeof(s1_t) * DSET_SELECT_DIM))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (s2_wbuf = (s2_t *)malloc(sizeof(s2_t) * DSET_SELECT_DIM))) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && NULL == (s2_wbuf_bak = (s2_t *)malloc(sizeof(s2_t) * DSET_SELECT_DIM))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (s2_rbuf = (s2_t *)malloc(sizeof(s2_t) * DSET_SELECT_DIM))) - FAIL_STACK_ERROR; + TEST_ERROR; /* Create the memory data type */ if ((s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tinsert(s1_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "d", HOFFSET(s1_t, d), H5T_NATIVE_INT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Create 1d data space */ dims[0] = DSET_SELECT_DIM; if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_fill_value(dcpl, s1_tid, &fillvalue) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Case 5(a) */ @@ -789,7 +836,7 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create 1d dataset */ if ((did = H5Dcreate2(fid, dset_name, s1_tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize data */ for (i = 0; i < DSET_SELECT_DIM; i++) { @@ -805,7 +852,7 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Write all the data to the dataset */ if (H5Dwrite(did, s1_tid, H5S_ALL, H5S_ALL, dxpl, s1_wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Restore wbuf from backup if the library modified it */ if (mwbuf) @@ -813,7 +860,7 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Read all the data from the dataset */ if (H5Dread(did, s1_tid, H5S_ALL, H5S_ALL, dxpl, s1_rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Verify data read */ for (i = 0; i < DSET_SELECT_DIM; i++) { @@ -838,12 +885,12 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create a compound type same size as s1_t */ if ((ss_ac_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* but contains only subset members of s1_t */ if (H5Tinsert(ss_ac_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(ss_ac_tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_INT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Copy wbuf if the library will be modifying it */ if (mwbuf) @@ -851,7 +898,7 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Write s1_wbuf to the dataset with only subset members in ss_tid */ if (H5Dwrite(did, ss_ac_tid, H5S_ALL, H5S_ALL, dxpl, s1_wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Restore wbuf from backup if the library modified it */ if (mwbuf) @@ -859,7 +906,7 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Read the whole compound back */ if (H5Dread(did, ss_ac_tid, H5S_ALL, H5S_ALL, dxpl, s1_rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Verify the compound fields have the correct (old or new) values */ for (i = 0; i < DSET_SELECT_DIM; i++) { @@ -884,16 +931,16 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create a compound type same size as s1_t */ if ((ss_bc_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* but contains only subset members of s1_t */ if (H5Tinsert(ss_bc_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0 || H5Tinsert(ss_bc_tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_INT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Read the dataset: will read only what is set in */ if (H5Dread(did, ss_bc_tid, H5S_ALL, H5S_ALL, dxpl, s1_rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Verify data read */ for (i = 0; i < DSET_SELECT_DIM; i++) { @@ -915,13 +962,13 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) * --1 smaller mem type */ if ((s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tinsert(s2_tid, "a", HOFFSET(s2_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(s2_tid, "b", HOFFSET(s2_t, b), H5T_NATIVE_LONG) < 0 || H5Tinsert(s2_tid, "c", HOFFSET(s2_t, c), H5T_NATIVE_INT) < 0 || H5Tinsert(s2_tid, "d", HOFFSET(s2_t, d), H5T_NATIVE_SHORT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Update s2_wbuf with unique values */ for (i = 0; i < DSET_SELECT_DIM; i++) { @@ -936,7 +983,7 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) memcpy(s2_wbuf_bak, s2_wbuf, sizeof(s2_t) * DSET_SELECT_DIM); if (H5Dwrite(did, s2_tid, H5S_ALL, H5S_ALL, dxpl, s2_wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Restore wbuf from backup if the library modified it */ if (mwbuf) @@ -959,21 +1006,21 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) } if (H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tclose(s1_tid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tclose(s2_tid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tclose(ss_ac_tid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tclose(ss_bc_tid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Dclose(did) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Release buffers */ free(s1_wbuf); @@ -1030,7 +1077,7 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) * Datatype for all datasets: H5T_NATIVE_LONG */ static herr_t -test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_multi_dsets_no_bkg(hid_t fid, unsigned set_cache, unsigned chunked, unsigned dtrans, unsigned mwbuf) { size_t ndsets; int i, j; @@ -1074,41 +1121,41 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m dims[0] = DSET_SELECT_DIM; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set modify write buffer if requested */ if (mwbuf) if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set data transform */ if (dtrans) if (H5Pset_data_transform(dxpl, expr) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set up file space ids, mem space ids, and dataset ids */ for (i = 0; i < (int)ndsets; i++) { if ((file_sids[i] = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((mem_sids[i] = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Generate dataset name */ snprintf(dset_names[i], sizeof(dset_names[i]), "multi_dset%d_%s_%s_%s", i, @@ -1118,31 +1165,31 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], ((HDrandom() % 2) ? H5T_NATIVE_LONG : H5T_NATIVE_INT), file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } buf_size = ndsets * DSET_SELECT_DIM * sizeof(int); /* Allocate buffers for all datasets */ if (NULL == (total_wbuf = (int *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && NULL == (total_wbuf_bak = (int *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_trans_wbuf = (int *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_rbuf = (int *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; buf_size = ndsets * DSET_SELECT_DIM * sizeof(long); if (NULL == (total_lwbuf = (long *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && NULL == (total_lwbuf_bak = (long *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_trans_lwbuf = (long *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_lrbuf = (long *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize buffer indices */ for (i = 0; i < (int)ndsets; i++) { @@ -1175,6 +1222,10 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m if (H5Dwrite_multi(ndsets, dset_dids, mem_tids, mem_sids, file_sids, dxpl, wbufs) < 0) TEST_ERROR; + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; + /* Restore wbuf from backup if the library modified it */ if (mwbuf) memcpy(total_wbuf, total_wbuf_bak, ndsets * DSET_SELECT_DIM * sizeof(int)); @@ -1183,6 +1234,10 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m if (H5Dread_multi(ndsets, dset_dids, mem_tids, mem_sids, file_sids, ntrans_dxpl, rbufs) < 0) TEST_ERROR; + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; + /* Verify */ for (i = 0; i < (int)ndsets; i++) for (j = 0; j < DSET_SELECT_DIM; j++) @@ -1199,6 +1254,10 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m if (H5Dread_multi(ndsets, dset_dids, mem_tids, mem_sids, file_sids, dxpl, rbufs) < 0) TEST_ERROR; + /* Verify selection I/O mode */ + if (check_actual_selection_io_mode(dxpl, chunked && !set_cache ? 0 : H5D_SCALAR_IO) < 0) + TEST_ERROR; + /* Verify */ for (i = 0; i < (int)ndsets; i++) for (j = 0; j < DSET_SELECT_DIM; j++) @@ -1260,19 +1319,19 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m } if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(ntrans_dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; for (i = 0; i < (int)ndsets; i++) { if (H5Sclose(file_sids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Sclose(mem_sids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Dclose(dset_dids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } free(total_wbuf); @@ -1315,7 +1374,7 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m if (total_lrbuf) free(total_lrbuf); if (total_trans_lwbuf) - free(total_lrbuf); + free(total_trans_lwbuf); return FAIL; @@ -1404,41 +1463,41 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set modify write buffer if requested */ if (mwbuf) if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; dims[0] = DSET_SELECT_DIM; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Create the memory data type */ if ((s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tinsert(s1_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "d", HOFFSET(s1_t, d), H5T_NATIVE_INT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; for (i = 0; i < (int)ndsets; i++) { if ((file_sids[i] = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((mem_sids[i] = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Generate dataset name */ snprintf(dset_names[i], sizeof(dset_names[i]), "multi_cmpd_dset%d_%s_%s", i, @@ -1447,7 +1506,7 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create ith dataset */ if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], s1_tid, file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } buf_size = ndsets * DSET_SELECT_DIM * sizeof(s1_t); @@ -1530,12 +1589,12 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create a compound type same size as s1_t */ if ((ss_ac_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* but contains only subset members of s1_t */ if (H5Tinsert(ss_ac_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(ss_ac_tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_INT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Untouched memory and file spaces for other datasets */ for (i = 0; i < (int)ndsets; i++) { @@ -1603,18 +1662,18 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create a compound type same size as s1_t */ if ((ss_bc_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* but contains only subset members of s1_t */ if (H5Tinsert(ss_bc_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0 || H5Tinsert(ss_bc_tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_INT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Reset memory and file space for dataset */ if (H5Sselect_all(mem_sids[mm]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Sselect_all(file_sids[mm]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Untouched memory and file space for other datasets */ for (i = 0; i < (int)ndsets; i++) { @@ -1677,13 +1736,13 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) * --1 smaller mem type */ if ((s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tinsert(s2_tid, "a", HOFFSET(s2_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(s2_tid, "b", HOFFSET(s2_t, b), H5T_NATIVE_LONG) < 0 || H5Tinsert(s2_tid, "c", HOFFSET(s2_t, c), H5T_NATIVE_INT) < 0 || H5Tinsert(s2_tid, "d", HOFFSET(s2_t, d), H5T_NATIVE_SHORT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; for (i = 0; i < (int)ndsets; i++) { s2_wbufi[i] = s2_total_wbuf + (i * DSET_SELECT_DIM); @@ -1735,17 +1794,17 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) } if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; for (i = 0; i < (int)ndsets; i++) { if (H5Sclose(file_sids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Sclose(mem_sids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Dclose(dset_dids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } free(total_wbuf); @@ -1845,34 +1904,34 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set modify write buffer if requested */ if (mwbuf) if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; dims[0] = DSET_SELECT_DIM; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Set up file space ids, mem space ids, and dataset ids */ for (i = 0; i < (int)ndsets; i++) { if ((file_sids[i] = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((mem_sids[i] = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Generate dataset name */ snprintf(dset_names[i], sizeof(dset_names[i]), "multi_size_dset%d_%s_%s", i, @@ -1881,7 +1940,7 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Create ith dataset */ if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], H5T_STD_I32BE, file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Case a */ @@ -1891,11 +1950,11 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Allocate buffers for all datasets */ if (NULL == (total_wbuf = (uint8_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_wbuf_bak = (uint8_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_rbuf = (uint8_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize buffer indices */ for (i = 0; i < (int)ndsets; i++) { @@ -1958,11 +2017,11 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Allocate buffers for all datasets */ if (NULL == (total_lwbuf = (uint8_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_lwbuf_bak = (uint8_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_lrbuf = (uint8_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize buffer indices */ for (i = 0; i < (int)ndsets; i++) { @@ -2033,11 +2092,11 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Allocate buffers for all datasets */ if (NULL == (total_swbuf = (uint8_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_swbuf_bak = (uint8_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_srbuf = (uint8_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize buffer indices */ for (i = 0; i < (int)ndsets; i++) { @@ -2088,17 +2147,17 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) } if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; for (i = 0; i < (int)ndsets; i++) { if (H5Sclose(file_sids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Sclose(mem_sids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Dclose(dset_dids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } free(total_wbuf); @@ -2278,66 +2337,66 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) /* Create dataset transfer property list */ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Enable selection I/O */ if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set modify write buffer if requested */ if (mwbuf) if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Set dataset layout: contiguous or chunked */ dims[0] = DSET_SELECT_DIM; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Create compound data type: s1_t */ if ((s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tinsert(s1_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "c", HOFFSET(s1_t, c), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "d", HOFFSET(s1_t, d), H5T_NATIVE_INT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Create compound data type: s3_t */ if ((s3_tid = H5Tcreate(H5T_COMPOUND, sizeof(s3_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tinsert(s3_tid, "a", HOFFSET(s3_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(s3_tid, "b", HOFFSET(s3_t, b), H5T_NATIVE_INT) < 0 || H5Tinsert(s3_tid, "c", HOFFSET(s3_t, c), H5T_NATIVE_INT) < 0 || H5Tinsert(s3_tid, "d", HOFFSET(s3_t, d), H5T_NATIVE_INT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Create compound data type: s4_t */ if ((s4_tid = H5Tcreate(H5T_COMPOUND, sizeof(s4_t))) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tinsert(s4_tid, "b", HOFFSET(s4_t, b), H5T_NATIVE_UINT) < 0 || H5Tinsert(s4_tid, "d", HOFFSET(s4_t, d), H5T_NATIVE_UINT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Create dataset for i ndsets */ for (i = 0; i < (int)ndsets; i++) { /* File space ids */ if ((file_sids[i] = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Memory space ids */ if ((mem_sids[i] = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; mm = HDrandom() % (int)ndsets; if (mm == 0) { @@ -2346,7 +2405,7 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) chunked ? "chunked" : "contig", mwbuf ? "mwbuf" : "nomwbuf"); if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], H5T_NATIVE_INT, file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } else if (mm == 1) { dset_types[i] = DSET_WITH_CONV_AND_NO_BKG; @@ -2354,7 +2413,7 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) chunked ? "chunked" : "contig", mwbuf ? "mwbuf" : "nomwbuf"); if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], H5T_NATIVE_LONG, file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } else { dset_types[i] = DSET_WITH_CONV_AND_BKG; @@ -2362,7 +2421,7 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) chunked ? "chunked" : "contig", mwbuf ? "mwbuf" : "nomwbuf"); if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], s1_tid, file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } } /* end for i ndsets */ @@ -2372,49 +2431,49 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) /* DSET_WITH_NO_CONV */ buf_size = ndsets * DSET_SELECT_DIM * sizeof(int); if (NULL == (total_wbuf1 = (int *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && NULL == (total_wbuf1_bak = (int *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (NULL == (total_rbuf1 = (int *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; /* DSET_WITH_CONV_AND_NO_BKG */ buf_size = ndsets * DSET_SELECT_DIM * sizeof(unsigned long); if (NULL == (ul_total_wbuf2 = (unsigned long *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && NULL == (ul_total_wbuf2_bak = (unsigned long *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; buf_size = ndsets * DSET_SELECT_DIM * sizeof(long); if (NULL == (l_total_rbuf2 = (long *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; buf_size = ndsets * DSET_SELECT_DIM * sizeof(long); if (NULL == (l_total_wbuf2 = (long *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && NULL == (l_total_wbuf2_bak = (long *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; buf_size = ndsets * DSET_SELECT_DIM * sizeof(short); if (NULL == (s_total_rbuf2 = (short *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; /* DSET_WITH_CONV_AND_BKG */ buf_size = ndsets * DSET_SELECT_DIM * sizeof(s1_t); if (NULL == (s1_total_wbuf3 = (s1_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && NULL == (s1_total_wbuf3_bak = (s1_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; buf_size = ndsets * DSET_SELECT_DIM * sizeof(s3_t); if (NULL == (s3_total_rbuf3 = (s3_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; buf_size = ndsets * DSET_SELECT_DIM * sizeof(s4_t); if (NULL == (s4_total_wbuf3 = (s4_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; if (mwbuf && NULL == (s4_total_wbuf3_bak = (s4_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; buf_size = ndsets * DSET_SELECT_DIM * sizeof(s1_t); if (NULL == (s1_total_rbuf3 = (s1_t *)malloc(buf_size))) - FAIL_STACK_ERROR; + TEST_ERROR; /* Test with s settings for ndsets */ for (s = SETTING_A; s <= SETTING_B; s++) { @@ -2622,26 +2681,26 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) /* Closing */ if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tclose(s1_tid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tclose(s3_tid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Tclose(s4_tid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; for (i = 0; i < (int)ndsets; i++) { if (H5Sclose(file_sids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Dclose(dset_dids[i]) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Don't delete the last set of datasets */ if ((n + 1) != niter) if (H5Ldelete(fid, dset_names[i], H5P_DEFAULT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } /* Freeing */ @@ -2756,7 +2815,7 @@ test_set_get_select_io_mode(const char *filename, hid_t fapl) TESTING("H5Pget/set_selection_io_mode()"); if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; @@ -2788,16 +2847,16 @@ test_set_get_select_io_mode(const char *filename, hid_t fapl) /* Create 1d data space */ dims[0] = DSET_SELECT_DIM; if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((did = H5Dcreate2(fid, "test_chk_dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize data */ for (i = 0; i < DSET_SELECT_DIM; i++) @@ -2805,7 +2864,7 @@ test_set_get_select_io_mode(const char *filename, hid_t fapl) /* May change the selection io actually performed */ if (H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, dxpl, wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pget_selection_io(dxpl, &selection_io_mode) < 0) TEST_ERROR; @@ -2815,15 +2874,15 @@ test_set_get_select_io_mode(const char *filename, hid_t fapl) TEST_ERROR; if (H5Dclose(did) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; PASSED(); @@ -2882,34 +2941,31 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ } if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Enable page buffering to trigger H5D_PAGE_BUFFER */ if (test_mode & TEST_PAGE_BUFFER) { if (H5Pset_page_buffer_size(fapl, 4096, 0, 0) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } else { /* Not page buffer test, reset to default */ if (H5Pset_page_buffer_size(fapl, 0, 0, 0) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 0, (hsize_t)1) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; - /* If default mode, 1st write will trigger cb, 2nd write will trigger sieve */ - /* If on mode, will trigger nothing because the on mode path is different */ - /* Need 2 writes */ if (test_mode & TEST_CONTIGUOUS_SIEVE_BUFFER) { no_selection_io_cause_write_expected |= H5D_SEL_IO_CONTIGUOUS_SIEVE_BUFFER; no_selection_io_cause_read_expected |= H5D_SEL_IO_CONTIGUOUS_SIEVE_BUFFER; @@ -2917,14 +2973,14 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ if (test_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET) { if (H5Pset_layout(dcpl, H5D_COMPACT) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; no_selection_io_cause_write_expected |= H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; no_selection_io_cause_read_expected |= H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; } if (test_mode == TEST_DATASET_FILTER) { if (H5Pset_deflate(dcpl, 9) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; is_chunked = true; no_selection_io_cause_write_expected |= H5D_SEL_IO_DATASET_FILTER; no_selection_io_cause_read_expected |= H5D_SEL_IO_DATASET_FILTER; @@ -2938,7 +2994,7 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ if (test_mode == TEST_DISABLE_BY_API) { if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_OFF) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; no_selection_io_cause_write_expected |= H5D_SEL_IO_DISABLE_BY_API; no_selection_io_cause_read_expected |= H5D_SEL_IO_DISABLE_BY_API; } @@ -2951,19 +3007,19 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ /* Datatype conversion */ if (test_mode & TEST_DATATYPE_CONVERSION) { if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; tid = H5T_NATIVE_UINT; /* If we're testing a too small tconv buffer, set the buffer to be too small */ if (test_mode & TEST_TCONV_BUF_TOO_SMALL) { if (H5Pset_buffer(dxpl, sizeof(int), NULL, NULL) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* If we're using in-place type conversion sel io will succeed and only switch to scalar at the * VFL */ if (test_mode & TEST_IN_PLACE_TCONV) { if (H5Pset_modify_write_buf(dxpl, true) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; no_selection_io_cause_write_expected |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB; } else @@ -2987,28 +3043,28 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ /* Create 1d data space */ dims[0] = DSET_SELECT_DIM; if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (is_chunked) { cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } if ((did = H5Dcreate2(fid, "no_selection_io_cause", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Initialize data */ for (i = 0; i < DSET_SELECT_DIM; i++) wbuf[i] = i; if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, dxpl, wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (test_mode & TEST_CONTIGUOUS_SIEVE_BUFFER) { if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, dxpl, wbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } if (H5Pget_no_selection_io_cause(dxpl, &no_selection_io_cause_write) < 0) @@ -3023,11 +3079,11 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ test_mode & TEST_PAGE_BUFFER) { if (H5Dflush(did) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; } if (H5Dread(did, tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* Verify causes of no selection I/O for write is as expected */ if (H5Pget_no_selection_io_cause(dxpl, &no_selection_io_cause_read) < 0) @@ -3038,20 +3094,20 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ TEST_ERROR; if (H5Dclose(did) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pclose(fcpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; return SUCCEED; @@ -3085,13 +3141,13 @@ test_get_no_selection_io_cause(const char *filename, hid_t fapl) TESTING("H5Pget_no_selection_io_cause()"); if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; if (H5Pget_selection_io(dxpl, &selection_io_mode) < 0) TEST_ERROR; if (H5Pclose(dxpl) < 0) - FAIL_STACK_ERROR; + TEST_ERROR; /* The following tests are based on H5D_SELECTION_IO_MODE_DEFAULT as the default setting in the library; skip the tests if that is not true */ @@ -3208,7 +3264,8 @@ main(void) case TEST_NO_TYPE_CONV: /* case 1 */ TESTING_2("No type conversion (null case)"); - nerrors += (test_no_type_conv(fid, chunked, dtrans, mwbuf) < 0 ? 1 : 0); + nerrors += + (test_no_type_conv(fid, set_cache, chunked, dtrans, mwbuf) < 0 ? 1 : 0); break; @@ -3219,7 +3276,9 @@ main(void) if (dtrans) SKIPPED(); else - nerrors += (test_no_size_change_no_bkg(fid, chunked, mwbuf) < 0 ? 1 : 0); + nerrors += + (test_no_size_change_no_bkg(fid, set_cache, chunked, mwbuf) < 0 ? 1 + : 0); break; @@ -3227,7 +3286,9 @@ main(void) TESTING_2("Larger memory type, no background buffer"); nerrors += - (test_larger_mem_type_no_bkg(fid, chunked, dtrans, mwbuf) < 0 ? 1 : 0); + (test_larger_mem_type_no_bkg(fid, set_cache, chunked, dtrans, mwbuf) < 0 + ? 1 + : 0); break; @@ -3235,7 +3296,9 @@ main(void) TESTING_2("Smaller memory type, no background buffer"); nerrors += - (test_smaller_mem_type_no_bkg(fid, chunked, dtrans, mwbuf) < 0 ? 1 : 0); + (test_smaller_mem_type_no_bkg(fid, set_cache, chunked, dtrans, mwbuf) < 0 + ? 1 + : 0); break; @@ -3253,7 +3316,7 @@ main(void) case TEST_MULTI_CONV_NO_BKG: /* case 6 */ TESTING_2("multi-datasets: type conv + no bkg buffer"); - nerrors += test_multi_dsets_no_bkg(fid, chunked, dtrans, mwbuf); + nerrors += test_multi_dsets_no_bkg(fid, set_cache, chunked, dtrans, mwbuf); break; diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index 7dfb8bc93b4..6c054085ed7 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -69,10 +69,11 @@ typedef enum num_chunks_written_t { typedef void (*test_func)(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id, hid_t dcpl_id, hid_t dxpl_id, test_mode_t test_mode); -static herr_t set_dcpl_filter(hid_t dcpl_id, H5Z_filter_t filter_id, filter_options_t *filter_options); -static void verify_space_alloc_status(size_t num_dsets, hid_t *dset_ids, hid_t dcpl_id, - num_chunks_written_t chunks_written); -static void verify_chunk_opt_status(size_t num_dsets, hid_t dxpl_id); +static herr_t set_dcpl_filter(hid_t dcpl_id, H5Z_filter_t filter_id, filter_options_t *filter_options); +static void verify_space_alloc_status(size_t num_dsets, hid_t *dset_ids, hid_t dcpl_id, + num_chunks_written_t chunks_written); +static void verify_chunk_opt_status(size_t num_dsets, test_mode_t test_mode, bool any_io, bool any_filters, + bool collective, bool unalloc_read, bool did_alloc, hid_t dxpl_id); static const char *test_mode_to_string(test_mode_t test_mode); static void create_datasets(hid_t parent_obj_id, const char *dset_name, hid_t type_id, hid_t filespace_id, @@ -80,9 +81,11 @@ static void create_datasets(hid_t parent_obj_id, const char *dset_name, hid_t ty static void open_datasets(hid_t parent_obj_id, const char *dset_name, size_t num_dsets, test_mode_t test_mode, hid_t *dset_ids); static void write_datasets(size_t num_dsets, hid_t *dset_ids, hid_t type_id, hid_t mspace_id, - hid_t *fspace_ids, hid_t dxpl_id, const void **bufs, test_mode_t test_mode); + hid_t *fspace_ids, hid_t dcpl_id, hid_t dxpl_id, const void **bufs, + test_mode_t test_mode, bool any_io, bool collective, bool overwrite); static void read_datasets(size_t num_dsets, hid_t *dset_ids, hid_t type_id, hid_t mspace_id, hid_t fspace_id, - hid_t dxpl_id, void **bufs, test_mode_t test_mode); + hid_t dcpl_id, hid_t dxpl_id, void **bufs, test_mode_t test_mode, bool any_io, + bool collective, bool all_uninit_read); static void select_hyperslab(size_t num_dsets, hid_t *dset_ids, hsize_t *start, hsize_t *stride, hsize_t *count, hsize_t *block, hid_t *fspace_ids); @@ -471,11 +474,15 @@ verify_space_alloc_status(size_t num_dsets, hid_t *dset_ids, hid_t dcpl_id, * I/O was performed. */ static void -verify_chunk_opt_status(size_t num_dsets, hid_t dxpl_id) +verify_chunk_opt_status(size_t num_dsets, test_mode_t test_mode, bool any_io, bool any_filters, + bool collective, bool unalloc_read, bool did_alloc, hid_t dxpl_id) { H5D_mpio_actual_chunk_opt_mode_t chunk_opt_mode; H5D_selection_io_mode_t sel_io_mode; + uint32_t actual_sel_io_mode; + uint32_t actual_sel_io_mode_reduced; uint32_t no_sel_io_cause = 0; + int mpi_code; herr_t ret; if (H5P_DEFAULT != dxpl_id) { @@ -528,6 +535,95 @@ verify_chunk_opt_status(size_t num_dsets, hid_t dxpl_id) "verified I/O optimization was linked-chunk I/O"); } } + + /* Verify actual selection I/O mode */ + ret = H5Pget_actual_selection_io_mode(dxpl_id, &actual_sel_io_mode); + VRFY((ret >= 0), "H5Pget_actual_selection_io_mode succeeded"); + + /* Reduce results to process 0 (bitwise OR so we get all I/O types) */ + mpi_code = + MPI_Reduce(&actual_sel_io_mode, &actual_sel_io_mode_reduced, 1, MPI_UINT32_T, MPI_BOR, 0, comm); + VRFY((MPI_SUCCESS == mpi_code), "MPI_Reduce succeeded"); + + /* Verify selection I/O mode on rank 0 */ + if (mpi_rank == 0) { + /* No actual I/O performed, only reported I/O will be from allocation, even if "no" datasets were + * involved (num_dsets == 0 implies the call was expected to fail, but it fails after allocation). + * Also if the test mode is mixed filtered and unfiltered and the call did not fail, then there + * will always be an I/O callback made with raw data. This is because unfiltered datasets fall + * back to scalar I/O when mixed with filtered, and scalar I/O reports an I/O call was made even + * with a size of 0 bytes, while vector I/O does not report I/O was made if passed 0 vector + * elements (because no elements were raw data), which is what happens when performing I/O on a + * filtered dataset with no selection. Vector I/O does report an I/O call was made if passed a raw + * data element of size 0, so this is consistent. */ + if (!any_io) { + if (did_alloc || (num_dsets > 0 && test_mode == USE_MULTIPLE_DATASETS_MIXED_FILTERED)) + VRFY(H5D_SCALAR_IO == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was scalar I/O"); + else + VRFY(0 == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was 0 (no I/O)"); + } + /* No filters, library should have used selection I/O if enabled, scalar I/O otherwise */ + else if (!any_filters) { + assert(!unalloc_read && !did_alloc); + if (sel_io_mode == H5D_SELECTION_IO_MODE_DEFAULT || sel_io_mode == H5D_SELECTION_IO_MODE_ON) + VRFY(H5D_SELECTION_IO == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was selection I/O"); + else + VRFY(H5D_SCALAR_IO == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was scalar I/O"); + } + /* Independent I/O, library should have done no I/O if reading from unallocated datasets, scalar + * I/O otherwise, since filtered I/O is only supported with scalar I/O in independent/serial */ + else if (!collective) { + if (unalloc_read) + VRFY(0 == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was 0 (no I/O)"); + else + VRFY(H5D_SCALAR_IO == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was scalar I/O"); + } + else + switch (test_mode) { + case USE_SINGLE_DATASET: + case USE_MULTIPLE_DATASETS: + /* Collective case with only filtered datasets. If we performed allocation then there + * should be scalar I/O for allocation in addition to vector I/O for the actual data. + * If we're reading from an unallocated dataset then there should be no actual I/O. + * Otherwise there should only be vector I/O. */ + if (did_alloc) + VRFY((H5D_SCALAR_IO | H5D_VECTOR_IO) == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was scalar and vector I/O"); + else if (unalloc_read) + VRFY(0 == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was 0 (no I/O)"); + else + VRFY(H5D_VECTOR_IO == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was vector I/O"); + break; + + case USE_MULTIPLE_DATASETS_MIXED_FILTERED: + /* Collective case with mixed filtered and unfiltered datasets. If we're reading from + * a unallocated datasets then there should be scalar I/O from reading the unfilitered + * datasets, since they are always allocated in parallel. Otherwise there should be + * vector I/O from the filtered datasets and scalar I/O from the unfiltered datasets. + */ + if (unalloc_read) + VRFY(H5D_SCALAR_IO == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was scalar I/O"); + else + VRFY((H5D_SCALAR_IO | H5D_VECTOR_IO) == actual_sel_io_mode_reduced, + "verified actual selection I/O mode was scalar and vector I/O"); + break; + + case TEST_MODE_SENTINEL: + default: + printf("Invalid test mode\n"); + fflush(stdout); + MPI_Abort(MPI_COMM_WORLD, -1); + } + } } } @@ -707,10 +803,12 @@ open_datasets(hid_t parent_obj_id, const char *dset_name, size_t num_dsets, test */ static void write_datasets(size_t num_dsets, hid_t *dset_ids, hid_t type_id, hid_t mspace_id, hid_t *fspace_ids, - hid_t dxpl_id, const void **bufs, test_mode_t test_mode) + hid_t dcpl_id, hid_t dxpl_id, const void **bufs, test_mode_t test_mode, bool any_io, + bool collective, bool overwrite) { - hid_t mem_type_ids[MAX_NUM_DSETS_MULTI]; - hid_t mem_space_ids[MAX_NUM_DSETS_MULTI]; + hid_t mem_type_ids[MAX_NUM_DSETS_MULTI]; + hid_t mem_space_ids[MAX_NUM_DSETS_MULTI]; + H5D_alloc_time_t alloc_time = H5D_ALLOC_TIME_DEFAULT; for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { mem_type_ids[dset_idx] = type_id; @@ -738,7 +836,11 @@ write_datasets(size_t num_dsets, hid_t *dset_ids, hid_t type_id, hid_t mspace_id MPI_Abort(MPI_COMM_WORLD, -1); } - verify_chunk_opt_status(num_dsets, dxpl_id); + if (!overwrite) + VRFY(H5Pget_alloc_time(dcpl_id, &alloc_time) >= 0, "H5Pget_alloc_time succeeded"); + + verify_chunk_opt_status(num_dsets, test_mode, any_io, true, collective, false, + !overwrite && (alloc_time == H5D_ALLOC_TIME_LATE), dxpl_id); } /* @@ -747,11 +849,13 @@ write_datasets(size_t num_dsets, hid_t *dset_ids, hid_t type_id, hid_t mspace_id */ static void read_datasets(size_t num_dsets, hid_t *dset_ids, hid_t type_id, hid_t mspace_id, hid_t fspace_id, - hid_t dxpl_id, void **bufs, test_mode_t test_mode) + hid_t dcpl_id, hid_t dxpl_id, void **bufs, test_mode_t test_mode, bool any_io, bool collective, + bool all_uninit_read) { - hid_t mem_type_ids[MAX_NUM_DSETS_MULTI]; - hid_t mem_space_ids[MAX_NUM_DSETS_MULTI]; - hid_t file_space_ids[MAX_NUM_DSETS_MULTI]; + hid_t mem_type_ids[MAX_NUM_DSETS_MULTI]; + hid_t mem_space_ids[MAX_NUM_DSETS_MULTI]; + hid_t file_space_ids[MAX_NUM_DSETS_MULTI]; + H5D_alloc_time_t alloc_time = H5D_ALLOC_TIME_DEFAULT; for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { mem_type_ids[dset_idx] = type_id; @@ -780,7 +884,13 @@ read_datasets(size_t num_dsets, hid_t *dset_ids, hid_t type_id, hid_t mspace_id, MPI_Abort(MPI_COMM_WORLD, -1); } - verify_chunk_opt_status(num_dsets, dxpl_id); + if (all_uninit_read) + VRFY(H5Pget_alloc_time(dcpl_id, &alloc_time) >= 0, "H5Pget_alloc_time succeeded"); + + verify_chunk_opt_status(num_dsets, test_mode, any_io, true, collective, + all_uninit_read && + (alloc_time == H5D_ALLOC_TIME_INCR || alloc_time == H5D_ALLOC_TIME_LATE), + false, dxpl_id); } static void @@ -954,8 +1064,8 @@ test_write_one_chunk_filtered_dataset(const char *parent_group, H5Z_filter_t fil data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -987,7 +1097,8 @@ test_write_one_chunk_filtered_dataset(const char *parent_group, H5Z_filter_t fil (C_DATATYPE)dset_idx; } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -1108,8 +1219,8 @@ test_write_filtered_dataset_no_overlap(const char *parent_group, H5Z_filter_t fi data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -1138,7 +1249,8 @@ test_write_filtered_dataset_no_overlap(const char *parent_group, H5Z_filter_t fi (j / (dataset_dims[0] / (hsize_t)mpi_size * dataset_dims[1])) + dset_idx); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -1265,8 +1377,8 @@ test_write_filtered_dataset_no_overlap_partial(const char *parent_group, H5Z_fil data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -1303,7 +1415,8 @@ test_write_filtered_dataset_no_overlap_partial(const char *parent_group, H5Z_fil } } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -1424,8 +1537,8 @@ test_write_filtered_dataset_overlap(const char *parent_group, H5Z_filter_t filte data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -1456,7 +1569,8 @@ test_write_filtered_dataset_overlap(const char *parent_group, H5Z_filter_t filte dset_idx); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -1593,8 +1707,8 @@ test_write_filtered_dataset_single_unlim_dim_no_overlap(const char *parent_group select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, i > 0); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, ALL_CHUNKS_WRITTEN); @@ -1608,8 +1722,8 @@ test_write_filtered_dataset_single_unlim_dim_no_overlap(const char *parent_group for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) memset(read_bufs[dset_idx], 255, data_size); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Verify the correct data was written */ for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) @@ -1759,8 +1873,8 @@ test_write_filtered_dataset_single_unlim_dim_overlap(const char *parent_group, H select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, i > 0); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, ALL_CHUNKS_WRITTEN); @@ -1774,8 +1888,8 @@ test_write_filtered_dataset_single_unlim_dim_overlap(const char *parent_group, H for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) memset(read_bufs[dset_idx], 255, data_size); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Verify the correct data was written */ for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) @@ -1931,8 +2045,8 @@ test_write_filtered_dataset_multi_unlim_dim_no_overlap(const char *parent_group, select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, i > 0); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, ALL_CHUNKS_WRITTEN); @@ -1946,8 +2060,8 @@ test_write_filtered_dataset_multi_unlim_dim_no_overlap(const char *parent_group, for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) memset(read_bufs[dset_idx], 255, data_size); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Verify the correct data was written */ for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) @@ -2106,8 +2220,8 @@ test_write_filtered_dataset_multi_unlim_dim_overlap(const char *parent_group, H5 select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, i > 0); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, ALL_CHUNKS_WRITTEN); @@ -2121,8 +2235,8 @@ test_write_filtered_dataset_multi_unlim_dim_overlap(const char *parent_group, H5 for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) memset(read_bufs[dset_idx], 255, data_size); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Verify the correct data was written */ for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) @@ -2175,28 +2289,31 @@ test_write_filtered_dataset_single_no_selection(const char *parent_group, H5Z_fi hid_t fapl_id, hid_t dcpl_id, hid_t dxpl_id, test_mode_t test_mode) { - C_DATATYPE *correct_bufs[MAX_NUM_DSETS_MULTI] = {0}; - const void *data_bufs[MAX_NUM_DSETS_MULTI] = {0}; - void *data_bufs_nc[MAX_NUM_DSETS_MULTI] = {0}; /* non-const buffer pointers for freeing */ - void *read_bufs[MAX_NUM_DSETS_MULTI] = {0}; - hsize_t dataset_dims[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; - hsize_t chunk_dims[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; - hsize_t sel_dims[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; - hsize_t start[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; - hsize_t stride[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; - hsize_t count[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; - hsize_t block[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; - size_t data_size, correct_buf_size; - size_t num_dsets; - hid_t dset_ids[MAX_NUM_DSETS_MULTI]; - hid_t fspace_ids[MAX_NUM_DSETS_MULTI]; - hid_t file_id = H5I_INVALID_HID, plist_id = H5I_INVALID_HID; - hid_t group_id = H5I_INVALID_HID; - hid_t filespace = H5I_INVALID_HID; + H5D_alloc_time_t alloc_time; + C_DATATYPE *correct_bufs[MAX_NUM_DSETS_MULTI] = {0}; + const void *data_bufs[MAX_NUM_DSETS_MULTI] = {0}; + void *data_bufs_nc[MAX_NUM_DSETS_MULTI] = {0}; /* non-const buffer pointers for freeing */ + void *read_bufs[MAX_NUM_DSETS_MULTI] = {0}; + hsize_t dataset_dims[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t chunk_dims[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t sel_dims[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t start[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t stride[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t count[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t block[WRITE_SINGLE_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; + size_t data_size, correct_buf_size; + size_t num_dsets; + hid_t dset_ids[MAX_NUM_DSETS_MULTI]; + hid_t fspace_ids[MAX_NUM_DSETS_MULTI]; + hid_t file_id = H5I_INVALID_HID, plist_id = H5I_INVALID_HID; + hid_t group_id = H5I_INVALID_HID; + hid_t filespace = H5I_INVALID_HID; if (MAINPROCESS) puts("Testing write to filtered chunks with a single process having no selection"); + VRFY((H5Pget_alloc_time(dcpl_id, &alloc_time) >= 0), "H5Pget_alloc_time succeeded"); + file_id = H5Fopen(filenames[0], H5F_ACC_RDWR, fapl_id); VRFY((file_id >= 0), "Test file open succeeded"); @@ -2276,8 +2393,8 @@ test_write_filtered_dataset_single_no_selection(const char *parent_group, H5Z_fi } } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, mpi_size > 1, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -2317,7 +2434,8 @@ test_write_filtered_dataset_single_no_selection(const char *parent_group, H5Z_fi } } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, mpi_size == 1 && alloc_time == H5D_ALLOC_TIME_INCR); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -2355,23 +2473,26 @@ static void test_write_filtered_dataset_all_no_selection(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id, hid_t dcpl_id, hid_t dxpl_id, test_mode_t test_mode) { - C_DATATYPE *correct_bufs[MAX_NUM_DSETS_MULTI] = {0}; - const void *data_bufs[MAX_NUM_DSETS_MULTI] = {0}; - void *data_bufs_nc[MAX_NUM_DSETS_MULTI] = {0}; /* non-const buffer pointers for freeing */ - void *read_bufs[MAX_NUM_DSETS_MULTI] = {0}; - hsize_t dataset_dims[WRITE_ALL_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; - hsize_t chunk_dims[WRITE_ALL_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; - size_t data_size, correct_buf_size; - size_t num_dsets; - hid_t dset_ids[MAX_NUM_DSETS_MULTI]; - hid_t fspace_ids[MAX_NUM_DSETS_MULTI]; - hid_t file_id = H5I_INVALID_HID, plist_id = H5I_INVALID_HID; - hid_t group_id = H5I_INVALID_HID; - hid_t filespace = H5I_INVALID_HID; + H5D_alloc_time_t alloc_time; + C_DATATYPE *correct_bufs[MAX_NUM_DSETS_MULTI] = {0}; + const void *data_bufs[MAX_NUM_DSETS_MULTI] = {0}; + void *data_bufs_nc[MAX_NUM_DSETS_MULTI] = {0}; /* non-const buffer pointers for freeing */ + void *read_bufs[MAX_NUM_DSETS_MULTI] = {0}; + hsize_t dataset_dims[WRITE_ALL_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; + hsize_t chunk_dims[WRITE_ALL_NO_SELECTION_FILTERED_CHUNKS_DATASET_DIMS]; + size_t data_size, correct_buf_size; + size_t num_dsets; + hid_t dset_ids[MAX_NUM_DSETS_MULTI]; + hid_t fspace_ids[MAX_NUM_DSETS_MULTI]; + hid_t file_id = H5I_INVALID_HID, plist_id = H5I_INVALID_HID; + hid_t group_id = H5I_INVALID_HID; + hid_t filespace = H5I_INVALID_HID; if (MAINPROCESS) puts("Testing write to filtered chunks with all processes having no selection"); + VRFY((H5Pget_alloc_time(dcpl_id, &alloc_time) >= 0), "H5Pget_alloc_time succeeded"); + file_id = H5Fopen(filenames[0], H5F_ACC_RDWR, fapl_id); VRFY((file_id >= 0), "Test file open succeeded"); @@ -2428,8 +2549,8 @@ test_write_filtered_dataset_all_no_selection(const char *parent_group, H5Z_filte data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, false, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -2453,7 +2574,8 @@ test_write_filtered_dataset_all_no_selection(const char *parent_group, H5Z_filte VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, alloc_time == H5D_ALLOC_TIME_INCR); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -2570,8 +2692,8 @@ test_write_filtered_dataset_point_selection(const char *parent_group, H5Z_filter data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -2603,7 +2725,8 @@ test_write_filtered_dataset_point_selection(const char *parent_group, H5Z_filter dset_idx); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -2729,8 +2852,8 @@ test_write_filtered_dataset_interleaved_write(const char *parent_group, H5Z_filt data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -2771,7 +2894,8 @@ test_write_filtered_dataset_interleaved_write(const char *parent_group, H5Z_filt + dset_idx); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -2908,8 +3032,8 @@ test_write_transformed_filtered_dataset_no_overlap(const char *parent_group, H5Z /* Set data transform expression */ VRFY((H5Pset_data_transform(plist_id, "x") >= 0), "Set data transform expression succeeded"); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, plist_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, plist_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -2943,7 +3067,8 @@ test_write_transformed_filtered_dataset_no_overlap(const char *parent_group, H5Z (j / (dataset_dims[0] / (hsize_t)mpi_size * dataset_dims[1])) + dset_idx); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -3072,8 +3197,8 @@ test_write_3d_filtered_dataset_no_overlap_separate_pages(const char *parent_grou data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -3102,7 +3227,8 @@ test_write_3d_filtered_dataset_no_overlap_separate_pages(const char *parent_grou (C_DATATYPE)((j % (hsize_t)mpi_size) + (j / (hsize_t)mpi_size) + dset_idx); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -3232,8 +3358,8 @@ test_write_3d_filtered_dataset_no_overlap_same_pages(const char *parent_group, H data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -3262,7 +3388,8 @@ test_write_3d_filtered_dataset_no_overlap_same_pages(const char *parent_group, H (j / (dataset_dims[0] * dataset_dims[1])) + dset_idx); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -3389,8 +3516,8 @@ test_write_3d_filtered_dataset_overlap(const char *parent_group, H5Z_filter_t fi data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -3436,7 +3563,8 @@ test_write_3d_filtered_dataset_overlap(const char *parent_group, H5Z_filter_t fi + dset_idx); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -3580,7 +3708,8 @@ test_write_cmpd_filtered_dataset_no_conversion_unshared(const char *parent_group data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, test_mode); + write_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, data_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -3613,7 +3742,8 @@ test_write_cmpd_filtered_dataset_no_conversion_unshared(const char *parent_group } } - read_datasets(num_dsets, dset_ids, memtype, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, memtype, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, test_mode, + true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -3758,7 +3888,8 @@ test_write_cmpd_filtered_dataset_no_conversion_shared(const char *parent_group, data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, test_mode); + write_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, data_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -3794,7 +3925,8 @@ test_write_cmpd_filtered_dataset_no_conversion_shared(const char *parent_group, } } - read_datasets(num_dsets, dset_ids, memtype, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, memtype, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, test_mode, + true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -3853,6 +3985,7 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(const char *parent_gro hid_t group_id = H5I_INVALID_HID; hid_t filetype = H5I_INVALID_HID, memtype = H5I_INVALID_HID; hid_t filespace = H5I_INVALID_HID; + H5D_alloc_time_t alloc_time; if (MAINPROCESS) puts("Testing write to unshared filtered chunks in Compound Datatype dataset with Datatype " @@ -3887,6 +4020,9 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(const char *parent_gro dataset_dims, NULL); VRFY((filespace >= 0), "File dataspace creation succeeded"); + /* Retrieve allocation time */ + VRFY((H5Pget_alloc_time(dcpl_id, &alloc_time) >= 0), "H5Pget_alloc_time succeeded"); + /* Create chunked dataset */ plist_id = H5Pcopy(dcpl_id); VRFY((plist_id >= 0), "DCPL copy succeeded"); @@ -3971,7 +4107,7 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(const char *parent_gro * of the H5Dwrite loop: */ /* write_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids, - dxpl_id, data_bufs, test_mode); */ + dcpl_id, dxpl_id, data_bufs, test_mode, true, true, false); */ for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { herr_t expected = FAIL; herr_t ret; @@ -4014,9 +4150,10 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(const char *parent_gro VRFY((ret == expected), "Dataset write"); if (expected == SUCCEED) - verify_chunk_opt_status(1, dxpl_id); + verify_chunk_opt_status(1, test_mode, true, false, true, false, false, dxpl_id); else - verify_chunk_opt_status(0, dxpl_id); + verify_chunk_opt_status(0, test_mode, false, true, true, false, alloc_time == H5D_ALLOC_TIME_LATE, + dxpl_id); } for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) @@ -4042,7 +4179,11 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(const char *parent_gro VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, memtype, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + /* If some writes succeeded (due to mixed filtered mode) or if allocation time is late, then there is data + * on disk to be read */ + read_datasets(num_dsets, dset_ids, memtype, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, test_mode, + true, false, + !(test_mode == USE_MULTIPLE_DATASETS_MIXED_FILTERED || alloc_time == H5D_ALLOC_TIME_LATE)); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { hid_t dset_dcpl; @@ -4122,6 +4263,7 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(const char *parent_group hid_t group_id = H5I_INVALID_HID; hid_t filetype = H5I_INVALID_HID, memtype = H5I_INVALID_HID; hid_t filespace = H5I_INVALID_HID; + H5D_alloc_time_t alloc_time; if (MAINPROCESS) puts("Testing write to shared filtered chunks in Compound Datatype dataset with Datatype conversion"); @@ -4155,6 +4297,9 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(const char *parent_group dataset_dims, NULL); VRFY((filespace >= 0), "File dataspace creation succeeded"); + /* Retrieve allocation time */ + VRFY((H5Pget_alloc_time(dcpl_id, &alloc_time) >= 0), "H5Pget_alloc_time succeeded"); + /* Create chunked dataset */ plist_id = H5Pcopy(dcpl_id); VRFY((plist_id >= 0), "DCPL copy succeeded"); @@ -4239,7 +4384,7 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(const char *parent_group * of the H5Dwrite loop: */ /* write_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids, - dxpl_id, data_bufs, test_mode); */ + dcpl_id, dxpl_id, data_bufs, test_mode, true, true, false); */ for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { herr_t expected = FAIL; herr_t ret; @@ -4282,9 +4427,10 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(const char *parent_group VRFY((ret == expected), "Dataset write"); if (expected == SUCCEED) - verify_chunk_opt_status(1, dxpl_id); + verify_chunk_opt_status(1, test_mode, true, false, true, false, false, dxpl_id); else - verify_chunk_opt_status(0, dxpl_id); + verify_chunk_opt_status(0, test_mode, false, true, true, false, alloc_time == H5D_ALLOC_TIME_LATE, + dxpl_id); } for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) @@ -4310,7 +4456,11 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(const char *parent_group VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, memtype, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + /* If some writes succeeded (due to mixed filtered mode) or if allocation time is late, then there is data + * on disk to be read */ + read_datasets(num_dsets, dset_ids, memtype, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, test_mode, + true, false, + !(test_mode == USE_MULTIPLE_DATASETS_MIXED_FILTERED || alloc_time == H5D_ALLOC_TIME_LATE)); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { hid_t dset_dcpl; @@ -4475,8 +4625,8 @@ test_read_one_chunk_filtered_dataset(const char *parent_group, H5Z_filter_t filt select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -4531,8 +4681,8 @@ test_read_one_chunk_filtered_dataset(const char *parent_group, H5Z_filter_t filt VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -4695,8 +4845,8 @@ test_read_filtered_dataset_no_overlap(const char *parent_group, H5Z_filter_t fil select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -4751,8 +4901,8 @@ test_read_filtered_dataset_no_overlap(const char *parent_group, H5Z_filter_t fil VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -4917,8 +5067,8 @@ test_read_filtered_dataset_overlap(const char *parent_group, H5Z_filter_t filter select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -4973,8 +5123,8 @@ test_read_filtered_dataset_overlap(const char *parent_group, H5Z_filter_t filter VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -5163,8 +5313,8 @@ test_read_filtered_dataset_single_no_selection(const char *parent_group, H5Z_fil select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -5229,8 +5379,8 @@ test_read_filtered_dataset_single_no_selection(const char *parent_group, H5Z_fil } } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, mpi_size > 1 ? true : false, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -5394,8 +5544,8 @@ test_read_filtered_dataset_all_no_selection(const char *parent_group, H5Z_filter select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -5438,8 +5588,8 @@ test_read_filtered_dataset_all_no_selection(const char *parent_group, H5Z_filter for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) memset(data_bufs_nc[dset_idx], 0, data_size); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, false, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], data_bufs[dset_idx], data_size)), @@ -5582,8 +5732,8 @@ test_read_filtered_dataset_point_selection(const char *parent_group, H5Z_filter_ select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -5639,8 +5789,8 @@ test_read_filtered_dataset_point_selection(const char *parent_group, H5Z_filter_ VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -5837,8 +5987,8 @@ test_read_filtered_dataset_interleaved_read(const char *parent_group, H5Z_filter select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -5895,8 +6045,8 @@ test_read_filtered_dataset_interleaved_read(const char *parent_group, H5Z_filter VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -6078,8 +6228,8 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(const char *parent_group select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -6142,8 +6292,8 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(const char *parent_group VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -6335,8 +6485,8 @@ test_read_transformed_filtered_dataset_no_overlap(const char *parent_group, H5Z_ select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); VRFY((H5Pclose(plist_id) >= 0), "DXPL close succeeded"); @@ -6402,8 +6552,8 @@ test_read_transformed_filtered_dataset_no_overlap(const char *parent_group, H5Z_ VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -6571,8 +6721,8 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(const char *parent_group, H5 select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -6634,8 +6784,8 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(const char *parent_group, H5 VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -6818,8 +6968,8 @@ test_read_3d_filtered_dataset_overlap(const char *parent_group, H5Z_filter_t fil select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -6879,8 +7029,8 @@ test_read_3d_filtered_dataset_overlap(const char *parent_group, H5Z_filter_t fil VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -7088,7 +7238,8 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(const char *parent_group, select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, memtype, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, test_mode); + write_datasets(num_dsets, dset_ids, memtype, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, data_bufs, + test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -7144,7 +7295,8 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(const char *parent_group, VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -7338,7 +7490,8 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(const char *parent_group, H select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, memtype, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, test_mode); + write_datasets(num_dsets, dset_ids, memtype, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, data_bufs, + test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -7394,7 +7547,8 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(const char *parent_group, H VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -7591,7 +7745,8 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(const char *parent_grou select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, memtype, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, test_mode); + write_datasets(num_dsets, dset_ids, memtype, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, data_bufs, + test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -7647,7 +7802,8 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(const char *parent_grou VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, read_bufs, + test_mode, true, false, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -7850,7 +8006,8 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(const char *parent_group, select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, memtype, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, test_mode); + write_datasets(num_dsets, dset_ids, memtype, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, data_bufs, + test_mode, true, false, false); /* Verify space allocation status */ plist_id = H5Dget_create_plist(dset_ids[0]); @@ -7906,7 +8063,8 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(const char *parent_group, VRFY((NULL != read_bufs[dset_idx]), "calloc succeeded"); } - read_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, memtype, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, read_bufs, + test_mode, true, false, false); /* Collect each piece of data from all ranks into a global buffer on all ranks */ global_buf = calloc(1, data_size); @@ -8059,8 +8217,8 @@ test_write_serial_read_parallel(const char *parent_group, H5Z_filter_t filter_id select_all(num_dsets, dset_ids, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, H5P_DEFAULT, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, fspace_ids, dcpl_id, H5P_DEFAULT, + data_bufs, test_mode, true, false, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -8104,7 +8262,8 @@ test_write_serial_read_parallel(const char *parent_group, H5Z_filter_t filter_id open_datasets(group_id, WRITE_SERIAL_READ_PARALLEL_DATASET_NAME, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -8230,8 +8389,8 @@ test_write_parallel_read_serial(const char *parent_group, H5Z_filter_t filter_id data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) free(data_bufs_nc[dset_idx]); @@ -8281,8 +8440,8 @@ test_write_parallel_read_serial(const char *parent_group, H5Z_filter_t filter_id (j / (dataset_dims[0] * dataset_dims[1])) + dset_idx); } - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, H5P_DEFAULT, + read_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], correct_bufs[dset_idx], correct_buf_size)), @@ -8425,8 +8584,8 @@ test_shrinking_growing_chunks(const char *parent_group, H5Z_filter_t filter_id, } } - write_datasets(num_dsets, dset_ids, H5T_NATIVE_DOUBLE, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, H5T_NATIVE_DOUBLE, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, i > 0); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, ALL_CHUNKS_WRITTEN); @@ -8440,8 +8599,8 @@ test_shrinking_growing_chunks(const char *parent_group, H5Z_filter_t filter_id, } } - read_datasets(num_dsets, dset_ids, H5T_NATIVE_DOUBLE, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, H5T_NATIVE_DOUBLE, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], data_bufs[dset_idx], data_size)), @@ -8570,8 +8729,8 @@ test_edge_chunks_no_overlap(const char *parent_group, H5Z_filter_t filter_id, hi read_bufs[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, @@ -8584,8 +8743,8 @@ test_edge_chunks_no_overlap(const char *parent_group, H5Z_filter_t filter_id, hi /* Verify the correct data was written */ open_datasets(group_id, WRITE_UNSHARED_FILTERED_EDGE_CHUNKS_DATASET_NAME, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], data_bufs[dset_idx], data_size)), @@ -8635,8 +8794,8 @@ test_edge_chunks_no_overlap(const char *parent_group, H5Z_filter_t filter_id, hi select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, @@ -8652,8 +8811,8 @@ test_edge_chunks_no_overlap(const char *parent_group, H5Z_filter_t filter_id, hi for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) memset(read_bufs[dset_idx], 255, data_size); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], data_bufs[dset_idx], data_size)), @@ -8782,8 +8941,8 @@ test_edge_chunks_overlap(const char *parent_group, H5Z_filter_t filter_id, hid_t read_bufs[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, SOME_CHUNKS_WRITTEN); @@ -8794,8 +8953,8 @@ test_edge_chunks_overlap(const char *parent_group, H5Z_filter_t filter_id, hid_t /* Verify the correct data was written */ open_datasets(group_id, WRITE_SHARED_FILTERED_EDGE_CHUNKS_DATASET_NAME, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], data_bufs[dset_idx], data_size)), @@ -8846,8 +9005,8 @@ test_edge_chunks_overlap(const char *parent_group, H5Z_filter_t filter_id, hid_t select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, SOME_CHUNKS_WRITTEN); @@ -8861,8 +9020,8 @@ test_edge_chunks_overlap(const char *parent_group, H5Z_filter_t filter_id, hid_t for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) memset(read_bufs[dset_idx], 255, data_size); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids[0], dcpl_id, dxpl_id, + read_bufs, test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((0 == memcmp(read_bufs[dset_idx], data_bufs[dset_idx], data_size)), @@ -8973,7 +9132,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id } /* Read entire dataset and verify that the fill value is returned */ - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, true); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { for (size_t j = 0; j < read_buf_size / sizeof(C_DATATYPE); j++) @@ -9015,8 +9175,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, SOME_CHUNKS_WRITTEN); @@ -9027,7 +9187,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id /* Verify correct data was written */ open_datasets(group_id, FILL_VALUES_TEST_DATASET_NAME, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); /* * Each MPI rank communicates their written piece of data @@ -9075,8 +9236,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, true); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, ALL_CHUNKS_WRITTEN); @@ -9087,7 +9248,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id /* Verify correct data was written */ open_datasets(group_id, FILL_VALUES_TEST_DATASET_NAME, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { C_DATATYPE *tmp_buf = read_bufs[dset_idx]; @@ -9120,7 +9282,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded"); /* Read entire dataset and verify that the fill value is returned */ - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, true); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { for (size_t j = 0; j < read_buf_size / sizeof(C_DATATYPE); j++) @@ -9155,8 +9318,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id tmp_buf[j] = (C_DATATYPE)(GEN_DATA(j) + dset_idx); } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, SOME_CHUNKS_WRITTEN); @@ -9167,7 +9330,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id /* Verify correct data was written */ open_datasets(group_id, FILL_VALUES_TEST_DATASET_NAME2, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t i = 0; i < (size_t)mpi_size; i++) { recvcounts[i] = (int)(count[1] * block[1]); @@ -9209,8 +9373,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, true); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, ALL_CHUNKS_WRITTEN); @@ -9221,7 +9385,8 @@ test_fill_values(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id /* Verify correct data was written */ open_datasets(group_id, FILL_VALUES_TEST_DATASET_NAME2, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { C_DATATYPE *tmp_buf = read_bufs[dset_idx]; @@ -9360,8 +9525,8 @@ test_fill_value_undefined(const char *parent_group, H5Z_filter_t filter_id, hid_ * allocation in parallel, so the read should succeed in that case. */ if (alloc_time == H5D_ALLOC_TIME_EARLY) { - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, - test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, true); } else { for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { @@ -9399,9 +9564,11 @@ test_fill_value_undefined(const char *parent_group, H5Z_filter_t filter_id, hid_ VRFY((ret == expected), "Dataset write"); if (expected == SUCCEED) - verify_chunk_opt_status(1, dxpl_id); + verify_chunk_opt_status(1, test_mode, true, false, true, false, false, dxpl_id); else - verify_chunk_opt_status(0, dxpl_id); + verify_chunk_opt_status( + 0, test_mode, false, true, true, + alloc_time == H5D_ALLOC_TIME_INCR || alloc_time == H5D_ALLOC_TIME_LATE, false, dxpl_id); } } @@ -9435,8 +9602,8 @@ test_fill_value_undefined(const char *parent_group, H5Z_filter_t filter_id, hid_ data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, SOME_CHUNKS_WRITTEN); @@ -9446,7 +9613,8 @@ test_fill_value_undefined(const char *parent_group, H5Z_filter_t filter_id, hid_ open_datasets(group_id, FILL_VALUE_UNDEFINED_TEST_DATASET_NAME, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((H5Sclose(fspace_ids[dset_idx]) >= 0), "File dataspace close succeeded"); @@ -9470,8 +9638,8 @@ test_fill_value_undefined(const char *parent_group, H5Z_filter_t filter_id, hid_ select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, true); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, ALL_CHUNKS_WRITTEN); @@ -9482,7 +9650,8 @@ test_fill_value_undefined(const char *parent_group, H5Z_filter_t filter_id, hid_ /* Verify correct data was written */ open_datasets(group_id, FILL_VALUE_UNDEFINED_TEST_DATASET_NAME, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { free(data_bufs_nc[dset_idx]); @@ -9634,7 +9803,8 @@ test_fill_time_never(const char *parent_group, H5Z_filter_t filter_id, hid_t fap * yet, because there's no guarantee as to what may have been * read from the dataset. */ - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, true); /* * Write to part of the first chunk in the dataset with @@ -9669,8 +9839,8 @@ test_fill_time_never(const char *parent_group, H5Z_filter_t filter_id, hid_t fap data_bufs_nc[dset_idx] = tmp_buf; } - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, SOME_CHUNKS_WRITTEN); @@ -9681,7 +9851,8 @@ test_fill_time_never(const char *parent_group, H5Z_filter_t filter_id, hid_t fap /* Verify correct data was written */ open_datasets(group_id, FILL_TIME_NEVER_TEST_DATASET_NAME, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) VRFY((H5Sclose(fspace_ids[dset_idx]) >= 0), "File dataspace close succeeded"); @@ -9705,8 +9876,8 @@ test_fill_time_never(const char *parent_group, H5Z_filter_t filter_id, hid_t fap select_hyperslab(num_dsets, dset_ids, start, stride, count, block, fspace_ids); - write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dxpl_id, data_bufs, - test_mode); + write_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_BLOCK, fspace_ids, dcpl_id, dxpl_id, + data_bufs, test_mode, true, true, false); /* Verify space allocation status */ verify_space_alloc_status(num_dsets, dset_ids, plist_id, ALL_CHUNKS_WRITTEN); @@ -9717,7 +9888,8 @@ test_fill_time_never(const char *parent_group, H5Z_filter_t filter_id, hid_t fap /* Verify correct data was written */ open_datasets(group_id, FILL_TIME_NEVER_TEST_DATASET_NAME, num_dsets, test_mode, dset_ids); - read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dxpl_id, read_bufs, test_mode); + read_datasets(num_dsets, dset_ids, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, dcpl_id, dxpl_id, read_bufs, + test_mode, true, true, false); for (size_t dset_idx = 0; dset_idx < num_dsets; dset_idx++) { C_DATATYPE *tmp_buf = read_bufs[dset_idx]; diff --git a/testpar/t_select_io_dset.c b/testpar/t_select_io_dset.c index 2e6839efcec..2be2b407236 100644 --- a/testpar/t_select_io_dset.c +++ b/testpar/t_select_io_dset.c @@ -159,7 +159,7 @@ set_dxpl(hid_t dxpl, H5D_selection_io_mode_t select_io_mode, H5FD_mpio_xfer_t mp } /* set_dxpl() */ /* - * Helper routine to check actual I/O mode on a dxpl + * Helper routine to check actual parallel I/O mode on a dxpl */ static void check_io_mode(hid_t dxpl, unsigned chunked) @@ -186,29 +186,65 @@ check_io_mode(hid_t dxpl, unsigned chunked) } /* check_io_mode() */ +static void +testing_check_io_mode(hid_t dxpl, H5D_mpio_actual_io_mode_t exp_io_mode) +{ + H5D_mpio_actual_io_mode_t actual_io_mode; + + if (H5Pget_mpio_actual_io_mode(dxpl, &actual_io_mode) < 0) + P_TEST_ERROR; + + if (actual_io_mode != exp_io_mode) { + nerrors++; + if (MAINPROCESS) + printf("\n Failed: Incorrect I/O mode (expected/actual) %u:%u", (unsigned)exp_io_mode, + (unsigned)actual_io_mode); + } + +} /* testing_check_io_mode() */ + +/* + * Helper routine to check actual selection I/O mode on a dxpl + */ +static void +check_actual_selection_io_mode(hid_t dxpl, uint32_t sel_io_mode_expected) +{ + uint32_t actual_sel_io_mode; + + if (H5Pget_actual_selection_io_mode(dxpl, &actual_sel_io_mode) < 0) + P_TEST_ERROR; + if (actual_sel_io_mode != sel_io_mode_expected) { + if (MAINPROCESS) + printf("\n Failed: Incorrect selection I/O mode (expected/actual) %u:%u", + (unsigned)sel_io_mode_expected, (unsigned)actual_sel_io_mode); + P_TEST_ERROR; + } +} + /* * Case 1: single dataset read/write, no type conversion (null case) */ static void -test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned select, unsigned mwbuf) { - int i; - hid_t did = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hid_t dcpl = H5I_INVALID_HID; - hid_t dxpl = H5I_INVALID_HID; - hid_t ntrans_dxpl = H5I_INVALID_HID; - hid_t fspace_id = H5I_INVALID_HID; - hid_t mspace_id = H5I_INVALID_HID; - hsize_t dims[1]; - hsize_t cdims[1]; - hsize_t start[1], stride[1], count[1], block[1]; - int wbuf[DSET_SELECT_DIM]; - int wbuf_bak[DSET_SELECT_DIM]; - int trans_wbuf[DSET_SELECT_DIM]; - int rbuf[DSET_SELECT_DIM]; - char dset_name[DSET_NAME_LEN]; - const char *expr = "2*x"; + int i; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + hid_t dxpl = H5I_INVALID_HID; + hid_t ntrans_dxpl = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + hid_t mspace_id = H5I_INVALID_HID; + hsize_t dims[1]; + hsize_t cdims[1]; + hsize_t start[1], stride[1], count[1], block[1]; + int wbuf[DSET_SELECT_DIM]; + int wbuf_bak[DSET_SELECT_DIM]; + int trans_wbuf[DSET_SELECT_DIM]; + int rbuf[DSET_SELECT_DIM]; + char dset_name[DSET_NAME_LEN]; + const char *expr = "2*x"; + H5D_mpio_actual_io_mode_t exp_io_mode = H5D_MPIO_NO_COLLECTIVE; curr_nerrors = nerrors; @@ -224,11 +260,13 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) cdims[0] = DSET_SELECT_CHUNK_DIM; if (H5Pset_chunk(dcpl, 1, cdims) < 0) P_TEST_ERROR; + if (!dtrans && H5Pset_deflate(dcpl, 2) < 0) + P_TEST_ERROR; } /* Generate dataset name */ - snprintf(dset_name, sizeof(dset_name), "no_tconv_%s_%s_%s", chunked ? "chunked" : "contig", - dtrans ? "xform" : "noxform", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_name, sizeof(dset_name), "no_tconv_%s_%s_%s_%s", chunked ? "chunked" : "contig", + dtrans ? "xform" : "noxform", select ? "sel" : "nosel", mwbuf ? "mwbuf" : "nomwbuf"); /* Create dataset */ if ((did = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -262,7 +300,8 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) P_TEST_ERROR; @@ -284,7 +323,14 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) if (mwbuf) memcpy(wbuf, wbuf_bak, sizeof(wbuf)); - check_io_mode(dxpl, chunked); + if (!dtrans || select) + exp_io_mode = chunked ? H5D_MPIO_CHUNK_COLLECTIVE : H5D_MPIO_CONTIGUOUS_COLLECTIVE; + testing_check_io_mode(dxpl, exp_io_mode); + + if (chunked && !dtrans) + check_actual_selection_io_mode(dxpl, H5D_VECTOR_IO); + else + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : H5D_SCALAR_IO); /* Read data from the dataset (if dtrans, without data transform set in dxpl) */ if (H5Dread(did, H5T_NATIVE_INT, mspace_id, fspace_id, ntrans_dxpl, rbuf) < 0) @@ -327,6 +373,8 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) P_TEST_ERROR; if (H5Pclose(dxpl) < 0) P_TEST_ERROR; + if (H5Pclose(dcpl) < 0) + P_TEST_ERROR; if (H5Pclose(ntrans_dxpl) < 0) P_TEST_ERROR; @@ -339,7 +387,7 @@ test_no_type_conv(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) * Case 2: single dataset read/write, no size change, no background buffer */ static void -test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) +test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned select, unsigned mwbuf) { int i; hid_t did = H5I_INVALID_HID; @@ -356,6 +404,8 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) char *rbuf = NULL; char dset_name[DSET_NAME_LEN]; + H5D_mpio_actual_io_mode_t exp_io_mode = H5D_MPIO_NO_COLLECTIVE; + curr_nerrors = nerrors; if ((wbuf = (char *)malloc((size_t)(4 * DSET_SELECT_DIM))) == NULL) @@ -379,8 +429,8 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) } /* Generate dataset name */ - snprintf(dset_name, sizeof(dset_name), "no_size_change_%s_%s", chunked ? "chunked" : "contig", - mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_name, sizeof(dset_name), "no_size_change_%s_%s_%s", chunked ? "chunked" : "contig", + select ? "sel" : "nosel", mwbuf ? "mwbuf" : "nomwbuf"); /* Create 1d dataset */ if ((did = H5Dcreate2(fid, dset_name, H5T_STD_I32BE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -416,7 +466,8 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); /* Copy wbuf if the library will be modifying it */ if (mwbuf) @@ -430,7 +481,11 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) if (mwbuf) memcpy(wbuf, wbuf_bak, (size_t)(4 * DSET_SELECT_DIM)); - check_io_mode(dxpl, chunked); + if (select) + exp_io_mode = chunked ? H5D_MPIO_CHUNK_COLLECTIVE : H5D_MPIO_CONTIGUOUS_COLLECTIVE; + + testing_check_io_mode(dxpl, exp_io_mode); + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : H5D_SCALAR_IO); /* Read the data from the dataset with little endian */ if (H5Dread(did, H5T_STD_I32LE, mspace_id, fspace_id, dxpl, rbuf) < 0) @@ -489,25 +544,26 @@ test_no_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) * Case 3: single dataset read/write, larger mem type, no background buffer */ static void -test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned select, unsigned mwbuf) { - int i; - hid_t did = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hid_t dcpl = H5I_INVALID_HID; - hid_t dxpl = H5I_INVALID_HID; - hid_t ntrans_dxpl = H5I_INVALID_HID; - hid_t fspace_id = H5I_INVALID_HID; - hid_t mspace_id = H5I_INVALID_HID; - hsize_t dims[1]; - hsize_t cdims[1]; - hsize_t start[1], stride[1], count[1], block[1]; - long wbuf[DSET_SELECT_DIM]; - long wbuf_bak[DSET_SELECT_DIM]; - long trans_wbuf[DSET_SELECT_DIM]; - long long rbuf[DSET_SELECT_DIM]; - char dset_name[DSET_NAME_LEN]; - const char *expr = "100 - x"; + int i; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + hid_t dxpl = H5I_INVALID_HID; + hid_t ntrans_dxpl = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + hid_t mspace_id = H5I_INVALID_HID; + hsize_t dims[1]; + hsize_t cdims[1]; + hsize_t start[1], stride[1], count[1], block[1]; + long wbuf[DSET_SELECT_DIM]; + long wbuf_bak[DSET_SELECT_DIM]; + long trans_wbuf[DSET_SELECT_DIM]; + long long rbuf[DSET_SELECT_DIM]; + char dset_name[DSET_NAME_LEN]; + const char *expr = "100 - x"; + H5D_mpio_actual_io_mode_t exp_io_mode = H5D_MPIO_NO_COLLECTIVE; curr_nerrors = nerrors; @@ -525,8 +581,8 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign } /* Generate dataset name */ - snprintf(dset_name, sizeof(dset_name), "larger_no_bkg_%s_%s_%s", chunked ? "chunked" : "contig", - dtrans ? "xform" : "noxform", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_name, sizeof(dset_name), "larger_no_bkg_%s_%s_%s_%s", chunked ? "chunked" : "contig", + dtrans ? "xform" : "noxform", select ? "sel" : "nosel", mwbuf ? "mwbuf" : "nomwbuf"); /* Create 1d chunked dataset with/without data transform */ if ((did = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -560,7 +616,8 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) P_TEST_ERROR; @@ -582,7 +639,11 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign if (mwbuf) memcpy(wbuf, wbuf_bak, sizeof(wbuf)); - check_io_mode(dxpl, chunked); + if (select) + exp_io_mode = chunked ? H5D_MPIO_CHUNK_COLLECTIVE : H5D_MPIO_CONTIGUOUS_COLLECTIVE; + + testing_check_io_mode(dxpl, exp_io_mode); + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : H5D_SCALAR_IO); /* Read data from the dataset (if dtrans, without data transform set in dxpl) */ if (H5Dread(did, H5T_NATIVE_LLONG, mspace_id, fspace_id, ntrans_dxpl, rbuf) < 0) @@ -637,25 +698,26 @@ test_larger_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsign * Case 4: single dataset reader/write, smaller mem type, no background buffer */ static void -test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned select, unsigned mwbuf) { - int i; - hid_t did = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hid_t dcpl = H5I_INVALID_HID; - hid_t dxpl = H5I_INVALID_HID; - hid_t ntrans_dxpl = H5I_INVALID_HID; - hid_t fspace_id = H5I_INVALID_HID; - hid_t mspace_id = H5I_INVALID_HID; - hsize_t dims[1]; - hsize_t cdims[1]; - hsize_t start[1], stride[1], count[1], block[1]; - short wbuf[DSET_SELECT_DIM]; - int wbuf_bak[DSET_SELECT_DIM]; - short trans_wbuf[DSET_SELECT_DIM]; - short rbuf[DSET_SELECT_DIM]; - char dset_name[DSET_NAME_LEN]; - const char *expr = "2 * (10 + x)"; + int i; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + hid_t dxpl = H5I_INVALID_HID; + hid_t ntrans_dxpl = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + hid_t mspace_id = H5I_INVALID_HID; + hsize_t dims[1]; + hsize_t cdims[1]; + hsize_t start[1], stride[1], count[1], block[1]; + short wbuf[DSET_SELECT_DIM]; + int wbuf_bak[DSET_SELECT_DIM]; + short trans_wbuf[DSET_SELECT_DIM]; + short rbuf[DSET_SELECT_DIM]; + char dset_name[DSET_NAME_LEN]; + const char *expr = "2 * (10 + x)"; + H5D_mpio_actual_io_mode_t exp_io_mode = H5D_MPIO_NO_COLLECTIVE; curr_nerrors = nerrors; @@ -673,8 +735,8 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig } /* Generate dataset name */ - snprintf(dset_name, sizeof(dset_name), "smaller_no_bkg_%s_%s_%s", chunked ? "chunked" : "contig", - dtrans ? "xform" : "noxform", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_name, sizeof(dset_name), "smaller_no_bkg_%s_%s_%s_%s", chunked ? "chunked" : "contig", + dtrans ? "xform" : "noxform", select ? "sel" : "nosel", mwbuf ? "mwbuf" : "nomwbuf"); /* Create 1d chunked dataset with/without data transform */ if ((did = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -708,7 +770,8 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) P_TEST_ERROR; @@ -731,7 +794,11 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig if (mwbuf) memcpy(wbuf, wbuf_bak, sizeof(wbuf)); - check_io_mode(dxpl, chunked); + if (select) + exp_io_mode = chunked ? H5D_MPIO_CHUNK_COLLECTIVE : H5D_MPIO_CONTIGUOUS_COLLECTIVE; + + testing_check_io_mode(dxpl, exp_io_mode); + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : H5D_SCALAR_IO); /* Read data from the dataset (if dtrans, without data transform set in dxpl) */ if (H5Dread(did, H5T_NATIVE_SHORT, mspace_id, fspace_id, ntrans_dxpl, rbuf) < 0) @@ -804,7 +871,7 @@ test_smaller_mem_type_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsig * Verify the values read */ static void -test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) +test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned select, unsigned mwbuf) { int i; hid_t did = H5I_INVALID_HID; @@ -870,8 +937,8 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) /* Case 5(a) */ /* Generate dataset name */ - snprintf(dset_name, sizeof(dset_name), "cmpd_with_bkg_%s_%s", chunked ? "chunked" : "contig", - mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_name, sizeof(dset_name), "cmpd_with_bkg_%s_%s_%s", chunked ? "chunked" : "contig", + select ? "sel" : "nosel", mwbuf ? "mwbuf" : "nomwbuf"); /* Create 1d dataset */ if ((did = H5Dcreate2(fid, dset_name, s1_tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -907,7 +974,8 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); /* Copy wbuf if the library will be modifying it */ if (mwbuf) @@ -917,12 +985,12 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) if (H5Dwrite(did, s1_tid, mspace_id, fspace_id, dxpl, s1_wbuf) < 0) P_TEST_ERROR; + check_io_mode(dxpl, chunked); + /* Restore wbuf from backup if the library modified it */ if (mwbuf) memcpy(s1_wbuf, s1_wbuf_bak, sizeof(s1_t) * DSET_SELECT_DIM); - check_io_mode(dxpl, chunked); - /* Read all the data from the dataset */ memset(s1_rbuf, 0, sizeof(s1_t) * DSET_SELECT_DIM); if (H5Dread(did, s1_tid, mspace_id, fspace_id, dxpl, s1_rbuf) < 0) @@ -1094,6 +1162,10 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) P_TEST_ERROR; if (H5Tclose(ss_bc_tid) < 0) P_TEST_ERROR; + if (H5Pclose(dxpl) < 0) + P_TEST_ERROR; + if (H5Pclose(dcpl) < 0) + P_TEST_ERROR; if (H5Dclose(did) < 0) P_TEST_ERROR; @@ -1115,7 +1187,7 @@ test_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) * Case 6: Type conversions + some processes have null/empty selections in datasets */ static void -test_type_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_type_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, unsigned select, unsigned mwbuf) { int i; hid_t did = H5I_INVALID_HID; @@ -1158,8 +1230,8 @@ test_type_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, unsigned } /* Generate dataset name */ - snprintf(dset_name, sizeof(dset_name), "tconv_sel_empty_%s_%s_%s", chunked ? "chunked" : "contig", - dtrans ? "xform" : "noxform", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_name, sizeof(dset_name), "tconv_sel_empty_%s_%s_%s_%s", chunked ? "chunked" : "contig", + dtrans ? "xform" : "noxform", select ? "sel" : "nosel", mwbuf ? "mwbuf" : "nomwbuf"); /* Create dataset */ if ((did = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -1170,7 +1242,8 @@ test_type_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, unsigned P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) P_TEST_ERROR; @@ -1210,7 +1283,7 @@ test_type_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, unsigned /* Create a memory dataspace */ if ((mspace_id = H5Screate_simple(1, block, NULL)) < 0) P_TEST_ERROR; - if (mpi_rank) { + if (!MAINPROCESS) { if (H5Sselect_none(mspace_id) < 0) P_TEST_ERROR; } @@ -1227,7 +1300,13 @@ test_type_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, unsigned if (mwbuf) memcpy(lwbuf, lwbuf_bak, sizeof(lwbuf)); - check_io_mode(dxpl, chunked); + /* If not using selection I/O there will be no collective I/O, since type conversion is unsupported by + * legacy collective I/O */ + testing_check_io_mode( + dxpl, select ? (chunked ? H5D_MPIO_CHUNK_COLLECTIVE : H5D_MPIO_CONTIGUOUS_COLLECTIVE) : 0); + + /* If not using selection I/O then the main process will do scalar I/O and others will do none */ + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : (MAINPROCESS ? H5D_SCALAR_IO : 0)); /* Read the data from the dataset: type conversion int-->long */ /* If dtrans, without data transform set in dxpl */ @@ -1395,7 +1474,7 @@ test_type_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, unsigned * Datatype for all datasets: H5T_NATIVE_LONG */ static void -test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned select, unsigned mwbuf) { size_t ndsets; int i, j; @@ -1410,6 +1489,8 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m hid_t mem_sids[MULTI_NUM_DSETS]; hid_t mem_tids[MULTI_NUM_DSETS]; + bool any_tconv = false; + char dset_names[MULTI_NUM_DSETS][DSET_NAME_LEN]; hid_t dset_dids[MULTI_NUM_DSETS]; @@ -1457,7 +1538,8 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) P_TEST_ERROR; @@ -1469,17 +1551,24 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m /* Set up file space ids and dataset ids */ for (i = 0; i < (int)ndsets; i++) { + bool tconv; + if ((file_sids[i] = H5Screate_simple(1, dims, NULL)) < 0) P_TEST_ERROR; /* Generate dataset name */ - snprintf(dset_names[i], sizeof(dset_names[i]), "multi_dset%d_%s_%s_%s", i, - chunked ? "chunked" : "contig", dtrans ? "xform" : "noxform", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_names[i], sizeof(dset_names[i]), "multi_dset%d_%s_%s_%s_%s", i, + chunked ? "chunked" : "contig", dtrans ? "xform" : "noxform", select ? "select" : "noselect", + mwbuf ? "mwbuf" : "nomwbuf"); + + /* Flip a coin to see if we're doing type conversion */ + tconv = HDrandom() % 2; + if (tconv) + any_tconv = true; /* Create ith dataset */ - if ((dset_dids[i] = - H5Dcreate2(fid, dset_names[i], ((HDrandom() % 2) ? H5T_NATIVE_LONG : H5T_NATIVE_INT), - file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], (tconv ? H5T_NATIVE_LONG : H5T_NATIVE_INT), + file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) P_TEST_ERROR; } @@ -1555,7 +1644,12 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m if (mwbuf) memcpy(total_wbuf, total_wbuf_bak, ndsets * DSET_SELECT_DIM * sizeof(int)); - check_io_mode(dxpl, chunked); + /* If doing type conversion or transform and not using selection I/O there will be no collective I/O, + * since type conversion is unsupported by legacy collective I/O */ + testing_check_io_mode(dxpl, ((any_tconv || dtrans) && !select) + ? 0 + : (chunked ? H5D_MPIO_CHUNK_COLLECTIVE : H5D_MPIO_CONTIGUOUS_COLLECTIVE)); + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : H5D_SCALAR_IO); /* Read data from the dataset (if dtrans, without data transform set in dxpl) */ if (H5Dread_multi(ndsets, dset_dids, mem_tids, mem_sids, file_sids, ntrans_dxpl, rbufs) < 0) @@ -1708,7 +1802,7 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned m * --Verify values read */ static void -test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) +test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned select, unsigned mwbuf) { size_t ndsets; int i, j, mm; @@ -1769,7 +1863,8 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); /* Each process takes x number of elements */ block[0] = dims[0] / (hsize_t)mpi_size; @@ -1794,8 +1889,8 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) P_TEST_ERROR; /* Generate dataset name */ - snprintf(dset_names[i], sizeof(dset_names[i]), "multi_cmpd_dset%d_%s_%s", i, - chunked ? "chunked" : "contig", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_names[i], sizeof(dset_names[i]), "multi_cmpd_dset%d_%s_%s_%s", i, + chunked ? "chunked" : "contig", select ? "select" : "noselect", mwbuf ? "mwbuf" : "nomwbuf"); /* Create ith dataset */ if ((dset_dids[i] = @@ -1860,6 +1955,7 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) memcpy(total_wbuf, total_wbuf_bak, buf_size); check_io_mode(dxpl, chunked); + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : H5D_SCALAR_IO); if (H5Dread_multi(ndsets, dset_dids, mem_tids, mem_sids, file_sids, dxpl, rbufs) < 0) P_TEST_ERROR; @@ -2164,7 +2260,7 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) * Datatype for all datasets: H5T_STD_I16BE */ static void -test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) +test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned select, unsigned mwbuf) { size_t ndsets; int i, j; @@ -2222,7 +2318,8 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); /* Set up file space ids, mem space ids, and dataset ids */ for (i = 0; i < (int)ndsets; i++) { @@ -2230,8 +2327,8 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) P_TEST_ERROR; /* Generate dataset name */ - snprintf(dset_names[i], sizeof(dset_names[i]), "multi_size_dset%d_%s_%s", i, - chunked ? "chunked" : "contig", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_names[i], sizeof(dset_names[i]), "multi_size_dset%d_%s_%s_%s", i, + chunked ? "chunked" : "contig", select ? "select" : "noselect", mwbuf ? "mwbuf" : "nomwbuf"); /* Create ith dataset */ if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], H5T_STD_I32BE, file_sids[i], H5P_DEFAULT, dcpl, @@ -2301,6 +2398,7 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) memcpy(total_wbuf, total_wbuf_bak, buf_size); check_io_mode(dxpl, chunked); + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : H5D_SCALAR_IO); /* Read data from the dataset */ if (H5Dread_multi(ndsets, dset_dids, mem_tids, mem_sids, file_sids, dxpl, rbufs) < 0) @@ -2510,7 +2608,7 @@ test_multi_dsets_size_change_no_bkg(hid_t fid, unsigned chunked, unsigned mwbuf) * --this will trigger type conversion for (a), (b) & (c) */ static void -test_multi_dsets_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, unsigned mwbuf) +test_multi_dsets_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, unsigned select, unsigned mwbuf) { size_t ndsets; int i, j; @@ -2568,7 +2666,8 @@ test_multi_dsets_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, un P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); if ((ntrans_dxpl = H5Pcopy(dxpl)) < 0) P_TEST_ERROR; @@ -2584,8 +2683,9 @@ test_multi_dsets_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, un P_TEST_ERROR; /* Generate dataset name */ - snprintf(dset_names[i], sizeof(dset_names[i]), "multi_sel_dset%d_%s_%s_%s", i, - chunked ? "chunked" : "contig", dtrans ? "xform" : "noxform", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_names[i], sizeof(dset_names[i]), "multi_sel_dset%d_%s_%s_%s_%s", i, + chunked ? "chunked" : "contig", dtrans ? "xform" : "noxform", select ? "select" : "noselect", + mwbuf ? "mwbuf" : "nomwbuf"); if (i == 0) { if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], H5T_NATIVE_INT, file_sids[i], H5P_DEFAULT, @@ -2769,7 +2869,11 @@ test_multi_dsets_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, un if (mwbuf) memcpy(total_wbuf, total_wbuf_bak, buf_size); - check_io_mode(dxpl, chunked); + /* If not using selection I/O there will be no collective I/O, since type conversion is unsupported by + * legacy collective I/O */ + testing_check_io_mode( + dxpl, select ? (chunked ? H5D_MPIO_CHUNK_COLLECTIVE : H5D_MPIO_CONTIGUOUS_COLLECTIVE) : 0); + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : H5D_SCALAR_IO); /* Initialize buffer indices */ for (i = 0; i < (int)ndsets; i++) { @@ -2903,7 +3007,7 @@ test_multi_dsets_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, un * --fields 'b' and 'd' are (DSET_SELECT_DIM + j + start[0]) */ static void -test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) +test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned select, unsigned mwbuf) { size_t ndsets; int i, j, mm; @@ -2920,6 +3024,8 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) hid_t mem_tids[MULTI_NUM_DSETS]; hid_t r_mem_tids[MULTI_NUM_DSETS]; + bool any_tconv; + multi_dset_type_t dset_types[MULTI_NUM_DSETS]; hid_t s1_tid = H5I_INVALID_HID; @@ -2978,7 +3084,8 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) P_TEST_ERROR; /* Set selection I/O mode, type of I/O and type of collective I/O */ - set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, mwbuf); + set_dxpl(dxpl, select ? H5D_SELECTION_IO_MODE_ON : H5D_SELECTION_IO_MODE_OFF, H5FD_MPIO_COLLECTIVE, + H5FD_MPIO_COLLECTIVE_IO, mwbuf); /* Set dataset layout: contiguous or chunked */ dims[0] = DSET_SELECT_DIM; @@ -3039,24 +3146,27 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) mm = HDrandom() % (int)ndsets; if (mm == 0) { dset_types[i] = DSET_WITH_NO_CONV; - snprintf(dset_names[i], sizeof(dset_names[i]), "multi_all_nconv_dset%d_%s_%s", i, - chunked ? "chunked" : "contig", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_names[i], sizeof(dset_names[i]), "multi_all_nconv_dset%d_%s_%s_%s", i, + chunked ? "chunked" : "contig", select ? "select" : "noselect", + mwbuf ? "mwbuf" : "nomwbuf"); if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], H5T_NATIVE_INT, file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) P_TEST_ERROR; } else if (mm == 1) { dset_types[i] = DSET_WITH_CONV_AND_NO_BKG; - snprintf(dset_names[i], sizeof(dset_names[i]), "multi_all_conv_nbkg_dset%d_%s_%s", i, - chunked ? "chunked" : "contig", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_names[i], sizeof(dset_names[i]), "multi_all_conv_nbkg_dset%d_%s_%s_%s", i, + chunked ? "chunked" : "contig", select ? "select" : "noselect", + mwbuf ? "mwbuf" : "nomwbuf"); if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], H5T_NATIVE_LONG, file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) P_TEST_ERROR; } else { dset_types[i] = DSET_WITH_CONV_AND_BKG; - snprintf(dset_names[i], sizeof(dset_names[i]), "multi_all_conv_bkg_dset%d_%s_%s", i, - chunked ? "chunked" : "contig", mwbuf ? "mwbuf" : "nomwbuf"); + snprintf(dset_names[i], sizeof(dset_names[i]), "multi_all_conv_bkg_dset%d_%s_%s_%s", i, + chunked ? "chunked" : "contig", select ? "select" : "noselect", + mwbuf ? "mwbuf" : "nomwbuf"); if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], s1_tid, file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) P_TEST_ERROR; @@ -3119,6 +3229,8 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) /* Test with s settings for ndsets */ for (s = SETTING_A; s <= SETTING_B; s++) { + any_tconv = false; + /* for i ndsets */ for (i = 0; i < (int)ndsets; i++) { @@ -3171,6 +3283,9 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) mem_tids[i] = H5T_NATIVE_LONG; r_mem_tids[i] = H5T_NATIVE_SHORT; + + /* There is type conversion in the read op */ + any_tconv = true; } break; @@ -3194,6 +3309,9 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) } mem_tids[i] = s1_tid; r_mem_tids[i] = s3_tid; + + /* There is type conversion in the read op */ + any_tconv = true; } else if (s == SETTING_B) { /* Initialize buffer indices */ @@ -3246,7 +3364,12 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned mwbuf) if (H5Dread_multi(ndsets, dset_dids, r_mem_tids, mem_sids, file_sids, dxpl, rbufs) < 0) P_TEST_ERROR; - check_io_mode(dxpl, chunked); + /* If doing type conversion and not using selection I/O there will be no collective I/O, since + * type conversion is unsupported by legacy collective I/O */ + testing_check_io_mode(dxpl, (any_tconv && !select) ? 0 + : (chunked ? H5D_MPIO_CHUNK_COLLECTIVE + : H5D_MPIO_CONTIGUOUS_COLLECTIVE)); + check_actual_selection_io_mode(dxpl, select ? H5D_SELECTION_IO : H5D_SCALAR_IO); /* Verify result read */ /* for i ndsets */ @@ -3422,6 +3545,8 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) P_TEST_ERROR; + set_dxpl(dxpl, H5D_SELECTION_IO_MODE_ON, H5FD_MPIO_COLLECTIVE, H5FD_MPIO_COLLECTIVE_IO, false); + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) P_TEST_ERROR; @@ -3442,20 +3567,12 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ /* Datatype conversion */ if (test_mode & TEST_DATATYPE_CONVERSION) { - /* With one exception, all will land at H5FD__mpio_read/write_selection(). - * As the xfer mode is H5FD_MPIO_INDEPENDENT, this will call - * H5FD__read/write_from_selection() triggering H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB. - */ - no_selection_io_cause_read_expected |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB; + /* With one exception, all will land at H5FD__mpio_read/write_selection() */ - /* Exception case: This will turn off selection I/O landing at H5FD__mpio_write() */ - if ((test_mode & TEST_TCONV_BUF_TOO_SMALL) && !(test_mode & TEST_IN_PLACE_TCONV)) - no_selection_io_cause_write_expected |= H5D_SEL_IO_TCONV_BUF_TOO_SMALL; - else - no_selection_io_cause_write_expected |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB; + if (test_mode & TEST_IN_PLACE_TCONV) + if (H5Pset_modify_write_buf(dxpl, true) < 0) + P_TEST_ERROR; - if (H5Pset_selection_io(dxpl, H5D_SELECTION_IO_MODE_ON) < 0) - P_TEST_ERROR; tid = H5T_NATIVE_UINT; /* If we're testing a too small tconv buffer, set the buffer to be too small */ @@ -3463,11 +3580,13 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ if (H5Pset_buffer(dxpl, sizeof(int), NULL, NULL) < 0) P_TEST_ERROR; - if (test_mode & TEST_IN_PLACE_TCONV) { - if (H5Pset_modify_write_buf(dxpl, true) < 0) - P_TEST_ERROR; - } - /* In-place type conversion for read doesn't require modify_write_buf */ + /* Exception case: When the type conversion buffer is too small and we're not allowing the library + * to modify the write buffer, the library will fall back to scalar independent I/O since the + * selection I/O path with type conversion requires a full size conversion buffer */ + if (!(test_mode & TEST_IN_PLACE_TCONV)) + /* In-place type conversion for read doesn't require modify_write_buf, so the read will still + * use selection I/O */ + no_selection_io_cause_write_expected |= H5D_SEL_IO_TCONV_BUF_TOO_SMALL; } } @@ -3493,6 +3612,10 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, dxpl, wbuf) < 0) P_TEST_ERROR; + if (!(test_mode & TEST_DISABLE_BY_API || test_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET || + ((test_mode & TEST_TCONV_BUF_TOO_SMALL) && !(test_mode & TEST_IN_PLACE_TCONV)))) + check_actual_selection_io_mode(dxpl, H5D_SELECTION_IO); + if (H5Pget_no_selection_io_cause(dxpl, &no_selection_io_cause_write) < 0) P_TEST_ERROR; @@ -3535,9 +3658,6 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ static void test_get_no_selection_io_cause(const char *filename, hid_t fapl) { - hid_t dxpl = H5I_INVALID_HID; - H5D_selection_io_mode_t selection_io_mode; - if (MAINPROCESS) { printf("\n"); TESTING("for H5Pget_no_selection_io_cause()"); @@ -3545,21 +3665,6 @@ test_get_no_selection_io_cause(const char *filename, hid_t fapl) curr_nerrors = nerrors; - if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - P_TEST_ERROR; - if (H5Pget_selection_io(dxpl, &selection_io_mode) < 0) - P_TEST_ERROR; - if (H5Pclose(dxpl) < 0) - P_TEST_ERROR; - - /* The following tests are based on H5D_SELECTION_IO_MODE_DEFAULT as the - * default setting in the library; skip the tests if that is not true */ - if (selection_io_mode != H5D_SELECTION_IO_MODE_DEFAULT) { - if (MAINPROCESS) - SKIPPED(); - return; - } - test_no_selection_io_cause_mode(filename, fapl, TEST_DISABLE_BY_API); test_no_selection_io_cause_mode(filename, fapl, TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET); test_no_selection_io_cause_mode(filename, fapl, TEST_DATATYPE_CONVERSION); @@ -3952,6 +4057,7 @@ main(int argc, char *argv[]) int test_select_config; unsigned chunked; unsigned dtrans; + unsigned select; unsigned mwbuf; h5_reset(); @@ -3978,163 +4084,170 @@ main(int argc, char *argv[]) /* therefore, not all tests are run with data transform */ for (dtrans = false; dtrans <= true; dtrans++) { - /* Test with and without modify_write_buf turned on */ - for (mwbuf = false; mwbuf <= true; mwbuf++) { - - if (MAINPROCESS) { - /* Print configuration message */ - printf("Testing for selection I/O "); - if (chunked) - printf("with chunked dataset, "); - else - printf("with contiguous dataset, "); - if (dtrans) - printf("data transform, "); - else - printf("without data transform, "); - if (mwbuf) - printf("and with modifying write buffers\n"); - else - printf("and without modifying write buffers\n"); - } + for (select = false; select <= true; select++) { + + /* Test with and without modify_write_buf turned on */ + for (mwbuf = false; mwbuf <= true; mwbuf++) { + + if (MAINPROCESS) { + /* Print configuration message */ + printf("Testing for selection I/O "); + if (chunked) + printf("with chunked dataset, "); + else + printf("with contiguous dataset, "); + if (dtrans) + printf("data transform, "); + else + printf("without data transform, "); + if (select) + printf("selection I/O ON, "); + else + printf("selection I/O OFF, "); + if (mwbuf) + printf("and with modifying write buffers\n"); + else + printf("and without modifying write buffers\n"); + } + + for (test_select_config = (int)TEST_NO_TYPE_CONV; + test_select_config < (int)TEST_SELECT_NTESTS; test_select_config++) { + + switch (test_select_config) { + + case TEST_NO_TYPE_CONV: /* case 1 */ + if (MAINPROCESS) + TESTING_2("No type conversion (null case)"); - for (test_select_config = (int)TEST_NO_TYPE_CONV; - test_select_config < (int)TEST_SELECT_NTESTS; test_select_config++) { + test_no_type_conv(fid, chunked, dtrans, select, mwbuf); - switch (test_select_config) { + break; - case TEST_NO_TYPE_CONV: /* case 1 */ - if (MAINPROCESS) - TESTING_2("No type conversion (null case)"); + case TEST_NO_SIZE_CHANGE_NO_BKG: /* case 2 */ + if (MAINPROCESS) + TESTING_2("No size change, no background buffer"); - test_no_type_conv(fid, chunked, dtrans, mwbuf); + /* Data transforms does not apply to the dataset datatype for this test */ + if (dtrans) { + if (MAINPROCESS) + SKIPPED(); + continue; + } - break; + test_no_size_change_no_bkg(fid, chunked, select, mwbuf); - case TEST_NO_SIZE_CHANGE_NO_BKG: /* case 2 */ - if (MAINPROCESS) - TESTING_2("No size change, no background buffer"); + break; - /* Data transforms does not apply to the dataset datatype for this test */ - if (dtrans) { + case TEST_LARGER_MEM_NO_BKG: /* case 3 */ if (MAINPROCESS) - SKIPPED(); - continue; - } - - test_no_size_change_no_bkg(fid, chunked, mwbuf); + TESTING_2("Larger memory type, no background buffer"); - break; + test_larger_mem_type_no_bkg(fid, chunked, dtrans, select, mwbuf); - case TEST_LARGER_MEM_NO_BKG: /* case 3 */ - if (MAINPROCESS) - TESTING_2("Larger memory type, no background buffer"); - - test_larger_mem_type_no_bkg(fid, chunked, dtrans, mwbuf); - - break; + break; - case TEST_SMALLER_MEM_NO_BKG: /* case 4 */ - if (MAINPROCESS) - TESTING_2("Smaller memory type, no background buffer"); + case TEST_SMALLER_MEM_NO_BKG: /* case 4 */ + if (MAINPROCESS) + TESTING_2("Smaller memory type, no background buffer"); - test_smaller_mem_type_no_bkg(fid, chunked, dtrans, mwbuf); + test_smaller_mem_type_no_bkg(fid, chunked, dtrans, select, mwbuf); - break; + break; - case TEST_CMPD_WITH_BKG: /* case 5 */ - if (MAINPROCESS) - TESTING_2("Compound types with background buffer"); - /* Data transforms does not apply to the dataset datatype for this test */ - if (dtrans) { + case TEST_CMPD_WITH_BKG: /* case 5 */ if (MAINPROCESS) - SKIPPED(); - continue; - } - - test_cmpd_with_bkg(fid, chunked, mwbuf); + TESTING_2("Compound types with background buffer"); + /* Data transforms does not apply to the dataset datatype for this test */ + if (dtrans) { + if (MAINPROCESS) + SKIPPED(); + continue; + } - break; + test_cmpd_with_bkg(fid, chunked, select, mwbuf); - case TEST_TYPE_CONV_SEL_EMPTY: /* case 6 */ - if (MAINPROCESS) - TESTING_2("Empty selections + Type conversion"); + break; - test_type_conv_sel_empty(fid, chunked, dtrans, mwbuf); + case TEST_TYPE_CONV_SEL_EMPTY: /* case 6 */ + if (MAINPROCESS) + TESTING_2("Empty selections + Type conversion"); - break; + test_type_conv_sel_empty(fid, chunked, dtrans, select, mwbuf); - case TEST_MULTI_CONV_NO_BKG: /* case 7 */ - if (MAINPROCESS) - TESTING_2("multi-datasets: type conv + no bkg buffer"); + break; - test_multi_dsets_no_bkg(fid, chunked, dtrans, mwbuf); + case TEST_MULTI_CONV_NO_BKG: /* case 7 */ + if (MAINPROCESS) + TESTING_2("multi-datasets: type conv + no bkg buffer"); - break; + test_multi_dsets_no_bkg(fid, chunked, dtrans, select, mwbuf); - case TEST_MULTI_CONV_BKG: /* case 8 */ - if (MAINPROCESS) - TESTING_2("multi-datasets: type conv + bkg buffer"); + break; - /* Data transforms does not apply to the dataset datatype for this test */ - if (dtrans) { + case TEST_MULTI_CONV_BKG: /* case 8 */ if (MAINPROCESS) - SKIPPED(); - } - else - test_multi_dsets_cmpd_with_bkg(fid, chunked, mwbuf); + TESTING_2("multi-datasets: type conv + bkg buffer"); - break; + /* Data transforms does not apply to the dataset datatype for this test */ + if (dtrans) { + if (MAINPROCESS) + SKIPPED(); + } + else + test_multi_dsets_cmpd_with_bkg(fid, chunked, select, mwbuf); - case TEST_MULTI_CONV_SIZE_CHANGE: /* case 9 */ - if (MAINPROCESS) - TESTING_2("multi-datasets: type conv + size change + no bkg buffer"); + break; - /* Data transforms does not apply to the dataset datatype for this test */ - if (dtrans) { + case TEST_MULTI_CONV_SIZE_CHANGE: /* case 9 */ if (MAINPROCESS) - SKIPPED(); - } - else - test_multi_dsets_size_change_no_bkg(fid, chunked, mwbuf); + TESTING_2("multi-datasets: type conv + size change + no bkg buffer"); - break; + /* Data transforms does not apply to the dataset datatype for this test */ + if (dtrans) { + if (MAINPROCESS) + SKIPPED(); + } + else + test_multi_dsets_size_change_no_bkg(fid, chunked, select, mwbuf); - case TEST_MULTI_CONV_SEL_EMPTY: /* case 10 */ - if (MAINPROCESS) - TESTING_2("multi-datasets: type conv + empty selections"); + break; - test_multi_dsets_conv_sel_empty(fid, chunked, dtrans, mwbuf); + case TEST_MULTI_CONV_SEL_EMPTY: /* case 10 */ + if (MAINPROCESS) + TESTING_2("multi-datasets: type conv + empty selections"); - break; + test_multi_dsets_conv_sel_empty(fid, chunked, dtrans, select, mwbuf); - case TEST_MULTI_ALL: /* case 11 */ - if (MAINPROCESS) - TESTING_2("multi-datasets: no conv + conv without bkg + conv with bkg"); + break; - /* Data transforms does not apply to the dataset datatype for this test */ - if (dtrans) { + case TEST_MULTI_ALL: /* case 11 */ if (MAINPROCESS) - SKIPPED(); - } - else - test_multi_dsets_all(2, fid, chunked, mwbuf); + TESTING_2("multi-datasets: no conv + conv without bkg + conv with bkg"); + + /* Data transforms does not apply to the dataset datatype for this test */ + if (dtrans) { + if (MAINPROCESS) + SKIPPED(); + } + else + test_multi_dsets_all(2, fid, chunked, select, mwbuf); - break; + break; - case TEST_SELECT_NTESTS: - default: - P_TEST_ERROR; - break; + case TEST_SELECT_NTESTS: + default: + P_TEST_ERROR; + break; - } /* end switch */ + } /* end switch */ - } /* end for test_select_config */ + } /* end for test_select_config */ - } /* end mwbuf */ + } /* end mwbuf */ - } /* end dtrans */ - } /* end chunked */ + } /* end select */ + } /* end dtrans */ + } /* end chunked */ if (H5Fclose(fid) < 0) P_TEST_ERROR;