summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-02-20 14:49:34 (GMT)
committerGitHub <noreply@github.com>2023-02-20 14:49:34 (GMT)
commitb3da28b731e50f63bb1004b016bdf7ef33c5328b (patch)
tree0ffc25aeb981c462ab935ee7183f5af68a47aa6b /testpar
parentbfef9945a88d52ad449b2f871c6d0a80ab94170f (diff)
downloadhdf5-b3da28b731e50f63bb1004b016bdf7ef33c5328b.zip
hdf5-b3da28b731e50f63bb1004b016bdf7ef33c5328b.tar.gz
hdf5-b3da28b731e50f63bb1004b016bdf7ef33c5328b.tar.bz2
Fix issue with collective metadata writes of global heap data (#2480)
Diffstat (limited to 'testpar')
-rw-r--r--testpar/CMakeLists.txt2
-rw-r--r--testpar/Makefile.am2
-rw-r--r--testpar/t_coll_md.c (renamed from testpar/t_coll_md_read.c)79
-rw-r--r--testpar/testphdf5.c2
-rw-r--r--testpar/testphdf5.h1
5 files changed, 82 insertions, 4 deletions
diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt
index c950b1b..d876a21 100644
--- a/testpar/CMakeLists.txt
+++ b/testpar/CMakeLists.txt
@@ -17,7 +17,7 @@ set (testphdf5_SOURCES
${HDF5_TEST_PAR_SOURCE_DIR}/t_chunk_alloc.c
${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c
${HDF5_TEST_PAR_SOURCE_DIR}/t_prop.c
- ${HDF5_TEST_PAR_SOURCE_DIR}/t_coll_md_read.c
+ ${HDF5_TEST_PAR_SOURCE_DIR}/t_coll_md.c
${HDF5_TEST_PAR_SOURCE_DIR}/t_oflush.c
)
diff --git a/testpar/Makefile.am b/testpar/Makefile.am
index 0506961..539750a 100644
--- a/testpar/Makefile.am
+++ b/testpar/Makefile.am
@@ -44,7 +44,7 @@ check_PROGRAMS = $(TEST_PROG_PARA) t_pflush1 t_pflush2
testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \
t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \
- t_prop.c t_coll_md_read.c t_oflush.c
+ t_prop.c t_coll_md.c t_oflush.c
# The tests all depend on the hdf5 library and the test library
LDADD = $(LIBH5TEST) $(LIBHDF5)
diff --git a/testpar/t_coll_md_read.c b/testpar/t_coll_md.c
index e402428..aa72486 100644
--- a/testpar/t_coll_md_read.c
+++ b/testpar/t_coll_md.c
@@ -11,8 +11,9 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * A test suite to test HDF5's collective metadata read capabilities, as enabled
- * by making a call to H5Pset_all_coll_metadata_ops().
+ * A test suite to test HDF5's collective metadata read and write capabilities,
+ * as enabled by making a call to H5Pset_all_coll_metadata_ops() and/or
+ * H5Pset_coll_metadata_write().
*/
#include "testphdf5.h"
@@ -38,6 +39,10 @@
#define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DATASET_NAME "linked_chunk_io_sort_chunk_issue"
#define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS 1
+#define COLL_GHEAP_WRITE_ATTR_NELEMS 10
+#define COLL_GHEAP_WRITE_ATTR_NAME "coll_gheap_write_attr"
+#define COLL_GHEAP_WRITE_ATTR_DIMS 1
+
/*
* A test for issue HDFFV-10501. A parallel hang was reported which occurred
* in linked-chunk I/O when collective metadata reads are enabled and some ranks
@@ -524,3 +529,73 @@ test_link_chunk_io_sort_chunk_issue(void)
VRFY((H5Pclose(fapl_id) >= 0), "H5Pclose succeeded");
VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded");
}
+
+/*
+ * A test for GitHub issue #2433 which causes a collective metadata write
+ * of global heap data. This test is meant to ensure that global heap data
+ * gets correctly mapped as raw data during a collective metadata write
+ * using vector I/O.
+ *
+ * An assertion exists in the library that should be triggered if global
+ * heap data is not correctly mapped as raw data.
+ */
+void
+test_collective_global_heap_write(void)
+{
+ const char *filename;
+ hsize_t attr_dims[COLL_GHEAP_WRITE_ATTR_DIMS];
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
+ hid_t vl_type = H5I_INVALID_HID;
+ hid_t fspace_id = H5I_INVALID_HID;
+ hvl_t vl_data;
+ int mpi_rank, mpi_size;
+ int data_buf[COLL_GHEAP_WRITE_ATTR_NELEMS];
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+
+ filename = GetTestParameters();
+
+ fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
+ VRFY((fapl_id >= 0), "create_faccess_plist succeeded");
+
+ /*
+ * Even though the testphdf5 framework currently sets collective metadata
+ * writes on the FAPL, we call it here just to be sure this is futureproof,
+ * since demonstrating this issue relies upon it.
+ */
+ VRFY((H5Pset_coll_metadata_write(fapl_id, true) >= 0), "Set collective metadata writes succeeded");
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ VRFY((file_id >= 0), "H5Fcreate succeeded");
+
+ attr_dims[0] = 1;
+
+ fspace_id = H5Screate_simple(COLL_GHEAP_WRITE_ATTR_DIMS, attr_dims, NULL);
+ VRFY((fspace_id >= 0), "H5Screate_simple succeeded");
+
+ vl_type = H5Tvlen_create(H5T_NATIVE_INT);
+ VRFY((vl_type >= 0), "H5Tvlen_create succeeded");
+
+ vl_data.len = COLL_GHEAP_WRITE_ATTR_NELEMS;
+ vl_data.p = data_buf;
+
+ /*
+ * Create a variable-length attribute that will get written to the global heap
+ */
+ attr_id = H5Acreate2(file_id, COLL_GHEAP_WRITE_ATTR_NAME, vl_type, fspace_id, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((attr_id >= 0), "H5Acreate2 succeeded");
+
+ for (size_t i = 0; i < COLL_GHEAP_WRITE_ATTR_NELEMS; i++)
+ data_buf[i] = (int)i;
+
+ VRFY((H5Awrite(attr_id, vl_type, &vl_data) >= 0), "H5Awrite succeeded");
+
+ VRFY((H5Sclose(fspace_id) >= 0), "H5Sclose succeeded");
+ VRFY((H5Tclose(vl_type) >= 0), "H5Sclose succeeded");
+ VRFY((H5Aclose(attr_id) >= 0), "H5Aclose succeeded");
+ VRFY((H5Pclose(fapl_id) >= 0), "H5Pclose succeeded");
+ VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded");
+}
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index cc32dee..e7befd6 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -502,6 +502,8 @@ main(int argc, char **argv)
"Collective MD read with multi chunk I/O (H5D__chunk_addrmap)", PARATESTFILE);
AddTest("LC_coll_MD_read", test_link_chunk_io_sort_chunk_issue, NULL,
"Collective MD read with link chunk I/O (H5D__sort_chunk)", PARATESTFILE);
+ AddTest("GH_coll_MD_wr", test_collective_global_heap_write, NULL,
+ "Collective MD write of global heap data", PARATESTFILE);
/* Display testing information */
TestInfo(argv[0]);
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index 14b8297..2a21ee6 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -293,6 +293,7 @@ void test_dense_attr(void);
void test_partial_no_selection_coll_md_read(void);
void test_multi_chunk_io_addrmap_issue(void);
void test_link_chunk_io_sort_chunk_issue(void);
+void test_collective_global_heap_write(void);
void test_oflush(void);
/* commonly used prototypes */