summaryrefslogtreecommitdiffstats
path: root/src/H5Dio.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-04-14 14:05:40 (GMT)
committerGitHub <noreply@github.com>2022-04-14 14:05:40 (GMT)
commit3961f6500d8303ff03bdd8fb38b0edc618b128ab (patch)
treee5866d374dfb2151e58d1ec1a64e9449fe6be504 /src/H5Dio.c
parent1a1e59172dc6312808981baeca4bc1772e126ff3 (diff)
downloadhdf5-3961f6500d8303ff03bdd8fb38b0edc618b128ab.zip
hdf5-3961f6500d8303ff03bdd8fb38b0edc618b128ab.tar.gz
hdf5-3961f6500d8303ff03bdd8fb38b0edc618b128ab.tar.bz2
Hdf5 1 10 merges (#1633)
Diffstat (limited to 'src/H5Dio.c')
-rw-r--r--src/H5Dio.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 45efbd7..3853a2e 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -1135,11 +1135,19 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_
io_info->io_ops.single_write = H5D__mpio_select_write;
} /* end if */
else {
+ int comm_size = 0;
+
+ /* Retrieve size of MPI communicator used for file */
+ if ((comm_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator size")
+
/* Check if there are any filters in the pipeline. If there are,
- * we cannot break to independent I/O if this is a write operation;
- * otherwise there will be metadata inconsistencies in the file.
+ * we cannot break to independent I/O if this is a write operation
+ * with multiple ranks involved; otherwise, there will be metadata
+ * inconsistencies in the file.
*/
- if (io_info->op_type == H5D_IO_OP_WRITE && io_info->dset->shared->dcpl_cache.pline.nused > 0) {
+ if (comm_size > 1 && io_info->op_type == H5D_IO_OP_WRITE &&
+ io_info->dset->shared->dcpl_cache.pline.nused > 0) {
H5D_mpio_no_collective_cause_t cause;
uint32_t local_no_collective_cause;
uint32_t global_no_collective_cause;
@@ -1173,28 +1181,40 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_
for (cause = 1, idx = 0;
(cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (idx < cause_strings_len);
cause <<= 1, idx++) {
- size_t cause_strlen = HDstrlen(cause_strings[idx]);
-
if (cause & local_no_collective_cause) {
+ size_t local_buffer_space = sizeof(local_no_collective_cause_string) -
+ HDstrlen(local_no_collective_cause_string) - 1;
+
/* Check if there were any previous error messages included. If so, prepend a
* semicolon to separate the messages.
*/
- if (local_error_message_previously_written)
- HDstrncat(local_no_collective_cause_string, "; ", 2);
+ if (local_buffer_space && local_error_message_previously_written) {
+ HDstrncat(local_no_collective_cause_string, "; ", local_buffer_space);
+ local_buffer_space -= MIN(local_buffer_space, 2);
+ }
- HDstrncat(local_no_collective_cause_string, cause_strings[idx], cause_strlen);
+ if (local_buffer_space)
+ HDstrncat(local_no_collective_cause_string, cause_strings[idx],
+ local_buffer_space);
local_error_message_previously_written = TRUE;
} /* end if */
if (cause & global_no_collective_cause) {
+ size_t global_buffer_space = sizeof(global_no_collective_cause_string) -
+ HDstrlen(global_no_collective_cause_string) - 1;
+
/* Check if there were any previous error messages included. If so, prepend a
* semicolon to separate the messages.
*/
- if (global_error_message_previously_written)
- HDstrncat(global_no_collective_cause_string, "; ", 2);
-
- HDstrncat(global_no_collective_cause_string, cause_strings[idx], cause_strlen);
+ if (global_buffer_space && global_error_message_previously_written) {
+ HDstrncat(global_no_collective_cause_string, "; ", global_buffer_space);
+ global_buffer_space -= MIN(global_buffer_space, 2);
+ }
+
+ if (global_buffer_space)
+ HDstrncat(global_no_collective_cause_string, cause_strings[idx],
+ global_buffer_space);
global_error_message_previously_written = TRUE;
} /* end if */