summaryrefslogtreecommitdiffstats
path: root/src/H5Dmpio.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-05-02 05:25:48 (GMT)
committerGitHub <noreply@github.com>2023-05-02 05:25:48 (GMT)
commit6eb021b68a8b46bbc89844713f014e6ba729ca7d (patch)
tree25a971cb952841ac796db4f72a4be850ac2ce437 /src/H5Dmpio.c
parentda46fdbf50984636aeac936386068939a3760fe4 (diff)
downloadhdf5-6eb021b68a8b46bbc89844713f014e6ba729ca7d.zip
hdf5-6eb021b68a8b46bbc89844713f014e6ba729ca7d.tar.gz
hdf5-6eb021b68a8b46bbc89844713f014e6ba729ca7d.tar.bz2
Sync with develop (#2871)
Diffstat (limited to 'src/H5Dmpio.c')
-rw-r--r--src/H5Dmpio.c60
1 files changed, 46 insertions, 14 deletions
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 8e413c1..77edfc4 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -626,13 +626,17 @@ H5D__mpio_opt_possible(H5D_io_info_t *io_info)
if (!H5FD_mpi_opt_types_g)
local_cause[0] |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED;
- /* Don't allow collective operations if datatype conversions need to happen */
- if (!type_info->is_conv_noop)
- local_cause[0] |= H5D_MPIO_DATATYPE_CONVERSION;
-
- /* Don't allow collective operations if data transform operations should occur */
- if (!type_info->is_xform_noop)
- local_cause[0] |= H5D_MPIO_DATA_TRANSFORMS;
+ /* Datatype conversions and transformations are allowed with selection I/O. If the selection I/O mode
+ * is auto (default), disable collective for now and re-enable later if we can */
+ if (io_info->use_select_io != H5D_SELECTION_IO_MODE_ON) {
+ /* Don't allow collective operations if datatype conversions need to happen */
+ if (!type_info->is_conv_noop)
+ local_cause[0] |= H5D_MPIO_DATATYPE_CONVERSION;
+
+ /* Don't allow collective operations if data transform operations should occur */
+ if (!type_info->is_xform_noop)
+ local_cause[0] |= H5D_MPIO_DATA_TRANSFORMS;
+ }
/* Check whether these are both simple or scalar dataspaces */
if (!((H5S_SIMPLE == H5S_GET_EXTENT_TYPE(mem_space) ||
@@ -662,6 +666,15 @@ H5D__mpio_opt_possible(H5D_io_info_t *io_info)
local_cause[0] |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED;
#endif
+ /* Check if we would be able to perform collective if we could use selection I/O. If so add reasons
+ * for not using selection I/O to local_cause[0] */
+ if ((io_info->use_select_io == H5D_SELECTION_IO_MODE_OFF) && local_cause[0] &&
+ !(local_cause[0] &
+ ~((unsigned)H5D_MPIO_DATATYPE_CONVERSION | (unsigned)H5D_MPIO_DATA_TRANSFORMS))) {
+ HDassert(io_info->no_selection_io_cause & H5D_MPIO_NO_SELECTION_IO_CAUSES);
+ local_cause[0] |= H5D_MPIO_NO_SELECTION_IO;
+ }
+
/* Check if we are able to do a MPI_Bcast of the data from one rank
* instead of having all the processes involved in the collective I/O call.
*/
@@ -722,6 +735,25 @@ H5D__mpio_opt_possible(H5D_io_info_t *io_info)
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
} /* end else */
+ /* If the selection I/O mode is default (auto), decide here whether it should be on or off */
+ if (io_info->use_select_io == H5D_SELECTION_IO_MODE_DEFAULT) {
+ /* If the only reason(s) we've disabled collective are type conversions and/or transforms, enable
+ * selection I/O and re-enable collective I/O since it's supported by selection I/O */
+ if (global_cause[0] && !(global_cause[0] & ~((unsigned)H5D_MPIO_DATATYPE_CONVERSION |
+ (unsigned)H5D_MPIO_DATA_TRANSFORMS))) {
+ HDassert(!(local_cause[0] &
+ ~((unsigned)H5D_MPIO_DATATYPE_CONVERSION | (unsigned)H5D_MPIO_DATA_TRANSFORMS)));
+ local_cause[0] = 0;
+ global_cause[0] = 0;
+ io_info->use_select_io = H5D_SELECTION_IO_MODE_ON;
+ }
+ else {
+ /* Otherwise, there's currently no benefit to selection I/O, so leave it off */
+ io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF;
+ io_info->no_selection_io_cause |= H5D_SEL_IO_DEFAULT_OFF;
+ }
+ }
+
/* Set the local & global values of no-collective-cause in the API context */
H5CX_set_mpio_local_no_coll_cause(local_cause[0]);
H5CX_set_mpio_global_no_coll_cause(global_cause[0]);
@@ -774,7 +806,7 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c
* Use compile-time assertion so this routine is updated
* when any new "no collective cause" values are added
*/
- HDcompile_assert(H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE == (H5D_mpio_no_collective_cause_t)256);
+ HDcompile_assert(H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE == (H5D_mpio_no_collective_cause_t)0x200);
/* Initialize output buffers */
if (local_cause)
@@ -827,6 +859,11 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c
case H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE:
cause_str = "an error occurred while checking if collective I/O was possible";
break;
+ case H5D_MPIO_NO_SELECTION_IO:
+ cause_str = "collective I/O may be supported by selection or vector I/O but that feature was "
+ "not possible (see causes via H5Pget_no_selection_io_cause())";
+ break;
+
case H5D_MPIO_COLLECTIVE:
case H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE:
default:
@@ -1438,13 +1475,8 @@ H5D__link_piece_collective_io(H5D_io_info_t *io_info, int H5_ATTR_UNUSED mpi_ran
HDassert(io_info->dsets_info[i].dset->shared->dcpl_cache.pline.nused == 0);
if (io_info->dsets_info[i].layout->type == H5D_CHUNKED)
actual_io_mode |= H5D_MPIO_CHUNK_COLLECTIVE;
- else if (io_info->dsets_info[i].layout->type == H5D_CONTIGUOUS) {
+ else if (io_info->dsets_info[i].layout->type == H5D_CONTIGUOUS)
actual_io_mode |= H5D_MPIO_CONTIGUOUS_COLLECTIVE;
-
- /* if only single-dset */
- if (1 == io_info->count)
- actual_chunk_opt_mode = H5D_MPIO_NO_CHUNK_OPTIMIZATION;
- }
else
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
}