summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testpar/t_filters_parallel.c281
-rw-r--r--testpar/t_filters_parallel.h2
2 files changed, 241 insertions, 42 deletions
diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c
index 3df5560..0dc040d 100644
--- a/testpar/t_filters_parallel.c
+++ b/testpar/t_filters_parallel.c
@@ -21,8 +21,6 @@
* datasets in parallel with filters applied to the data.
*/
-/* XXX: Add data verification macro/function and check all data in all tests */
-
#include "t_filters_parallel.h"
const char *FILENAME[] = {
@@ -326,7 +324,7 @@ test_filtered_dataset_no_overlap(void)
VRFY((NULL != correct_buf), "malloc succeeded");
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
correct_buf[i] = (C_DATATYPE) ((i % (NUM_MPI_RANKS * dataset_dims[1])) + (i / (NUM_MPI_RANKS * dataset_dims[1])));
@@ -472,10 +470,12 @@ test_filtered_dataset_overlap(void)
VRFY((NULL != correct_buf), "malloc succeeded");
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
- correct_buf[i] = (dataset_dims[1] * (i / (NUM_MPI_RANKS * dataset_dims[1]))) + (i % dataset_dims[1]) + (((i % (NUM_MPI_RANKS * dataset_dims[1])) / dataset_dims[1]) % dataset_dims[1]);
+ correct_buf[i] = (C_DATATYPE) ((dataset_dims[1] * (i / (NUM_MPI_RANKS * dataset_dims[1])))
+ + (i % dataset_dims[1])
+ + (((i % (NUM_MPI_RANKS * dataset_dims[1])) / dataset_dims[1]) % dataset_dims[1]));
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -626,10 +626,10 @@ test_filtered_dataset_single_no_selection(void)
VRFY((NULL != correct_buf), "malloc succeeded");
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
for (i = 0; i < (correct_buf_size / sizeof(*correct_buf)) - (NUM_MPI_RANKS * dataset_dims[1]); i++)
- correct_buf[i] = (i % (NUM_MPI_RANKS * dataset_dims[1])) + (i / (NUM_MPI_RANKS * dataset_dims[1]));
+ correct_buf[i] = (C_DATATYPE) ((i % (NUM_MPI_RANKS * dataset_dims[1])) + (i / (NUM_MPI_RANKS * dataset_dims[1])));
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -753,7 +753,7 @@ test_filtered_dataset_all_no_selection(void)
VRFY((NULL != data), "malloc succeeded");
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -883,10 +883,12 @@ test_filtered_dataset_point_selection(void)
VRFY((NULL != correct_buf), "malloc succeeded");
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
- correct_buf[i] = (dataset_dims[1] * (i / (NUM_MPI_RANKS * dataset_dims[1]))) + (i % dataset_dims[1]) + (((i % (NUM_MPI_RANKS * dataset_dims[1])) / dataset_dims[1]) % dataset_dims[1]);
+ correct_buf[i] = (C_DATATYPE) ((dataset_dims[1] * (i / (NUM_MPI_RANKS * dataset_dims[1])))
+ + (i % dataset_dims[1])
+ + (((i % (NUM_MPI_RANKS * dataset_dims[1])) / dataset_dims[1]) % dataset_dims[1]));
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -934,10 +936,13 @@ test_filtered_dataset_point_selection(void)
* Programmer: Jordan Henderson
* 02/02/2017
*/
+/* XXX: Done */
static void
test_filtered_dataset_interleaved_write(void)
{
C_DATATYPE *data = NULL;
+ C_DATATYPE *read_buf = NULL;
+ C_DATATYPE *correct_buf = NULL;
hsize_t dataset_dims[INTERLEAVED_WRITE_FILTERED_DATASET_DIMS];
hsize_t chunk_dims[INTERLEAVED_WRITE_FILTERED_DATASET_DIMS];
hsize_t sel_dims[INTERLEAVED_WRITE_FILTERED_DATASET_DIMS];
@@ -945,7 +950,7 @@ test_filtered_dataset_interleaved_write(void)
hsize_t stride[INTERLEAVED_WRITE_FILTERED_DATASET_DIMS];
hsize_t block[INTERLEAVED_WRITE_FILTERED_DATASET_DIMS];
hsize_t offset[INTERLEAVED_WRITE_FILTERED_DATASET_DIMS];
- size_t i, data_size;
+ size_t i, data_size, correct_buf_size;
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
@@ -1018,12 +1023,21 @@ test_filtered_dataset_interleaved_write(void)
/* Fill data buffer */
data_size = sel_dims[0] * sel_dims[1] * sizeof(*data);
+ correct_buf_size = dataset_dims[0] * dataset_dims[1] * sizeof(*correct_buf);
data = (C_DATATYPE *) malloc(data_size);
VRFY((NULL != data), "malloc succeeded");
+ correct_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != correct_buf), "malloc succeeded");
+
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
+
+ for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
+ correct_buf[i] = (C_DATATYPE) (((i % SHARED_FILTERED_CHUNKS_NCOLS) / SHARED_FILTERED_CHUNKS_CH_NCOLS)
+ + ((i % SHARED_FILTERED_CHUNKS_NCOLS) % SHARED_FILTERED_CHUNKS_CH_NCOLS)
+ + (SHARED_FILTERED_CHUNKS_CH_NCOLS * (i / SHARED_FILTERED_CHUNKS_NCOLS)));
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -1036,6 +1050,22 @@ test_filtered_dataset_interleaved_write(void)
if (data) free(data);
VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
+
+ /* Verify the correct data was written */
+ read_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != read_buf), "malloc succeeded");
+
+ dset_id = H5Dopen(file_id, "/" INTERLEAVED_WRITE_FILTERED_DATASET_NAME, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "Dataset open succeeded");
+
+ VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded");
+
+ VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded");
+
+ if (correct_buf) free(correct_buf);
+ if (read_buf) free(read_buf);
+
+ VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded");
VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded");
VRFY((H5Pclose(plist_id) >= 0), "DXPL close succeeded");
@@ -1052,10 +1082,13 @@ test_filtered_dataset_interleaved_write(void)
* Programmer: Jordan Henderson
* 02/06/2017
*/
+/* XXX: Done */
static void
test_3d_filtered_dataset_no_overlap_separate_pages(void)
{
C_DATATYPE *data = NULL;
+ C_DATATYPE *read_buf = NULL;
+ C_DATATYPE *correct_buf = NULL;
hsize_t dataset_dims[UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DATASET_DIMS];
hsize_t chunk_dims[UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DATASET_DIMS];
hsize_t sel_dims[UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DATASET_DIMS];
@@ -1063,7 +1096,7 @@ test_3d_filtered_dataset_no_overlap_separate_pages(void)
hsize_t stride[UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DATASET_DIMS];
hsize_t block[UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DATASET_DIMS];
hsize_t offset[UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DATASET_DIMS];
- size_t i, data_size;
+ size_t i, data_size, correct_buf_size;
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
@@ -1143,12 +1176,19 @@ test_3d_filtered_dataset_no_overlap_separate_pages(void)
/* Fill data buffer */
data_size = sel_dims[0] * sel_dims[1] * sel_dims[2] * sizeof(*data);
+ correct_buf_size = dataset_dims[0] * dataset_dims[1] * dataset_dims[2] * sizeof(*correct_buf);
data = (C_DATATYPE *) malloc(data_size);
VRFY((NULL != data), "malloc succeeded");
+ correct_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != correct_buf), "malloc succeeded");
+
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
+
+ for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
+ correct_buf[i] = (C_DATATYPE) ((i % NUM_MPI_RANKS) + (i / NUM_MPI_RANKS));
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -1161,6 +1201,22 @@ test_3d_filtered_dataset_no_overlap_separate_pages(void)
if (data) free(data);
VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
+
+ /* Verify the correct data was written */
+ read_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != read_buf), "malloc succeeded");
+
+ dset_id = H5Dopen(file_id, "/" UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DATASET_NAME, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "Dataset open succeeded");
+
+ VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded");
+
+ VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded");
+
+ if (correct_buf) free(correct_buf);
+ if (read_buf) free(read_buf);
+
+ VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded");
VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded");
VRFY((H5Pclose(plist_id) >= 0), "DXPL close succeeded");
@@ -1178,10 +1234,13 @@ test_3d_filtered_dataset_no_overlap_separate_pages(void)
* Programmer: Jordan Henderson
* 02/06/2017
*/
+/* XXX: Done */
static void
test_3d_filtered_dataset_no_overlap_same_pages(void)
{
C_DATATYPE *data = NULL;
+ C_DATATYPE *read_buf = NULL;
+ C_DATATYPE *correct_buf = NULL;
hsize_t dataset_dims[UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_DATASET_DIMS];
hsize_t chunk_dims[UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_DATASET_DIMS];
hsize_t sel_dims[UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_DATASET_DIMS];
@@ -1189,7 +1248,7 @@ test_3d_filtered_dataset_no_overlap_same_pages(void)
hsize_t stride[UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_DATASET_DIMS];
hsize_t block[UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_DATASET_DIMS];
hsize_t offset[UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_DATASET_DIMS];
- size_t i, data_size;
+ size_t i, data_size, correct_buf_size;
hid_t file_id, dset_id, plist_id;
hid_t filespace, memspace;
@@ -1269,12 +1328,19 @@ test_3d_filtered_dataset_no_overlap_same_pages(void)
/* Fill data buffer */
data_size = sel_dims[0] * sel_dims[1] * sel_dims[2] * sizeof(*data);
+ correct_buf_size = dataset_dims[0] * dataset_dims[1] * dataset_dims[2] * sizeof(*correct_buf);
data = (C_DATATYPE *) malloc(data_size);
VRFY((NULL != data), "malloc succeeded");
+ correct_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != correct_buf), "malloc succeeded");
+
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
+
+ for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
+ correct_buf[i] = (C_DATATYPE) ((i % (dataset_dims[0] * dataset_dims[1])) + (i / (dataset_dims[0] * dataset_dims[1])));
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -1287,6 +1353,22 @@ test_3d_filtered_dataset_no_overlap_same_pages(void)
if (data) free(data);
VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
+
+ /* Verify the correct data was written */
+ read_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != read_buf), "malloc succeeded");
+
+ dset_id = H5Dopen(file_id, "/" UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_DATASET_NAME, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "Dataset open succeeded");
+
+ VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded");
+
+ VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded");
+
+ if (correct_buf) free(correct_buf);
+ if (read_buf) free(read_buf);
+
+ VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded");
VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded");
VRFY((H5Pclose(plist_id) >= 0), "DXPL close succeeded");
@@ -1304,10 +1386,13 @@ test_3d_filtered_dataset_no_overlap_same_pages(void)
* Programmer: Jordan Henderson
* 02/06/2017
*/
+/* XXX: Done */
static void
test_3d_filtered_dataset_overlap(void)
{
C_DATATYPE *data = NULL;
+ C_DATATYPE *read_buf = NULL;
+ C_DATATYPE *correct_buf = NULL;
hsize_t dataset_dims[SHARED_FILTERED_CHUNKS_3D_DATASET_DIMS];
hsize_t chunk_dims[SHARED_FILTERED_CHUNKS_3D_DATASET_DIMS];
hsize_t sel_dims[SHARED_FILTERED_CHUNKS_3D_DATASET_DIMS];
@@ -1315,7 +1400,7 @@ test_3d_filtered_dataset_overlap(void)
hsize_t stride[SHARED_FILTERED_CHUNKS_3D_DATASET_DIMS];
hsize_t block[SHARED_FILTERED_CHUNKS_3D_DATASET_DIMS];
hsize_t offset[SHARED_FILTERED_CHUNKS_3D_DATASET_DIMS];
- size_t i, data_size;
+ size_t i, data_size, correct_buf_size;
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
@@ -1395,12 +1480,34 @@ test_3d_filtered_dataset_overlap(void)
/* Fill data buffer */
data_size = sel_dims[0] * sel_dims[1] * sel_dims[2] * sizeof(*data);
+ correct_buf_size = dataset_dims[0] * dataset_dims[1] * dataset_dims[2] * sizeof(*correct_buf);
data = (C_DATATYPE *) malloc(data_size);
VRFY((NULL != data), "malloc succeeded");
+ correct_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != correct_buf), "malloc succeeded");
+
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
+
+ /* This style of data verification is very ugly for cases like this,
+ * but avoids the problem of needing to have each rank send its data
+ * plus its selection to a single rank, then have that rank scatter
+ * all of the data one at a time to a single buffer and finally
+ * compare that buffer to the read buffer. - JTH
+ */
+ for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
+ /* Start with a base index */
+ correct_buf[i] = (C_DATATYPE) ((i % NUM_MPI_RANKS)
+ /* Add the value for the increasing column index */
+ + (NUM_MPI_RANKS * ((i % (SHARED_FILTERED_CHUNKS_3D_NCOLS * SHARED_FILTERED_CHUNKS_3D_DEPTH)) / (NUM_MPI_RANKS * SHARED_FILTERED_CHUNKS_3D_CH_NCOLS)))
+ /* Add the value for the increasing row index */
+ + ((SHARED_FILTERED_CHUNKS_3D_NCOLS * (SHARED_FILTERED_CHUNKS_3D_CH_NROWS * SHARED_FILTERED_CHUNKS_3D_CH_NCOLS / NUM_MPI_RANKS)) * (i / (SHARED_FILTERED_CHUNKS_3D_NCOLS * SHARED_FILTERED_CHUNKS_3D_DEPTH * (SHARED_FILTERED_CHUNKS_3D_CH_NROWS * SHARED_FILTERED_CHUNKS_3D_CH_NCOLS / NUM_MPI_RANKS))))
+ /* Add the value for the increasing row index in a particular chunk */
+ + (SHARED_FILTERED_CHUNKS_3D_CH_NCOLS * ((i % (SHARED_FILTERED_CHUNKS_3D_NCOLS * SHARED_FILTERED_CHUNKS_3D_DEPTH * (SHARED_FILTERED_CHUNKS_3D_CH_NROWS * SHARED_FILTERED_CHUNKS_3D_CH_NCOLS / NUM_MPI_RANKS))) / (SHARED_FILTERED_CHUNKS_3D_NCOLS * SHARED_FILTERED_CHUNKS_3D_DEPTH)))
+ /* Add the value for the increasing column index in a particular chunk */
+ + ((i % (SHARED_FILTERED_CHUNKS_3D_CH_NCOLS * SHARED_FILTERED_CHUNKS_3D_DEPTH)) / NUM_MPI_RANKS));
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -1413,6 +1520,22 @@ test_3d_filtered_dataset_overlap(void)
if (data) free(data);
VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
+
+ /* Verify the correct data was written */
+ read_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != read_buf), "malloc succeeded");
+
+ dset_id = H5Dopen(file_id, "/" SHARED_FILTERED_CHUNKS_3D_DATASET_NAME, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "Dataset open succeeded");
+
+ VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded");
+
+ VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded");
+
+ if (correct_buf) free(correct_buf);
+ if (read_buf) free(read_buf);
+
+ VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded");
VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded");
VRFY((H5Pclose(plist_id) >= 0), "DXPL close succeeded");
@@ -1429,6 +1552,7 @@ test_3d_filtered_dataset_overlap(void)
* Programmer: Jordan Henderson
* 02/10/2017
*/
+/* JTH: This test currently cannot be data-verified due to the floating-point data involved */
static void
test_cmpd_filtered_dataset_no_conversion_unshared(void)
{
@@ -1522,8 +1646,12 @@ test_cmpd_filtered_dataset_no_conversion_unshared(void)
/* Fill data buffer */
memset(data, 0, sizeof(cmpd_filtered_t) * COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_ENTRIES_PER_PROC);
- for (i = 0; i < COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_ENTRIES_PER_PROC; i++)
- data[i].field1 = data[i].field2 = data[i].field3 = data[i].field4 = GEN_DATA(i);
+ for (i = 0; i < COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_ENTRIES_PER_PROC; i++) {
+ data[i].field1 = (short) GEN_DATA(i);
+ data[i].field2 = (int) GEN_DATA(i);
+ data[i].field3 = (long) GEN_DATA(i);
+ data[i].field4 = (double) GEN_DATA(i);
+ }
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -1551,6 +1679,7 @@ test_cmpd_filtered_dataset_no_conversion_unshared(void)
* Programmer: Jordan Henderson
* 02/10/2017
*/
+/* JTH: This test currently cannot be data-verified due to the floating-point data involved */
static void
test_cmpd_filtered_dataset_no_conversion_shared(void)
{
@@ -1644,8 +1773,12 @@ test_cmpd_filtered_dataset_no_conversion_shared(void)
/* Fill data buffer */
memset(data, 0, sizeof(cmpd_filtered_t) * COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_SHARED_ENTRIES_PER_PROC);
- for (i = 0; i < COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_SHARED_ENTRIES_PER_PROC; i++)
- data[i].field1 = data[i].field2 = data[i].field3 = data[i].field4 = GEN_DATA(i);
+ for (i = 0; i < COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_SHARED_ENTRIES_PER_PROC; i++) {
+ data[i].field1 = (short) GEN_DATA(i);
+ data[i].field2 = (int) GEN_DATA(i);
+ data[i].field3 = (long) GEN_DATA(i);
+ data[i].field4 = (double) GEN_DATA(i);
+ }
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -1670,7 +1803,7 @@ test_cmpd_filtered_dataset_no_conversion_shared(void)
* chunks using a compound datatype which requires a
* datatype conversion.
*
- * This test currently fails because the datatype
+ * This test currently should fail because the datatype
* conversion causes the parallel library to break
* to independent I/O and this isn't allowed when
* there are filters in the pipeline.
@@ -1678,6 +1811,7 @@ test_cmpd_filtered_dataset_no_conversion_shared(void)
* Programmer: Jordan Henderson
* 02/07/2017
*/
+/* JTH: This test currently cannot be data-verified due to the floating-point data involved */
static void
test_cmpd_filtered_dataset_type_conversion_unshared(void)
{
@@ -1780,8 +1914,12 @@ test_cmpd_filtered_dataset_type_conversion_unshared(void)
/* Fill data buffer */
memset(data, 0, sizeof(cmpd_filtered_t) * COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_ENTRIES_PER_PROC);
- for (i = 0; i < COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_ENTRIES_PER_PROC; i++)
- data[i].field1 = data[i].field2 = data[i].field3 = data[i].field4 = GEN_DATA(i);
+ for (i = 0; i < COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_ENTRIES_PER_PROC; i++) {
+ data[i].field1 = (short) GEN_DATA(i);
+ data[i].field2 = (int) GEN_DATA(i);
+ data[i].field3 = (long) GEN_DATA(i);
+ data[i].field4 = (double) GEN_DATA(i);
+ }
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -1810,7 +1948,7 @@ test_cmpd_filtered_dataset_type_conversion_unshared(void)
* chunks using a compound datatype which requires
* a datatype conversion.
*
- * This test currently fails because the datatype
+ * This test currently should fail because the datatype
* conversion causes the parallel library to break
* to independent I/O and this isn't allowed when
* there are filters in the pipeline.
@@ -1818,6 +1956,7 @@ test_cmpd_filtered_dataset_type_conversion_unshared(void)
* Programmer: Jordan Henderson
* 02/10/2017
*/
+/* JTH: This test currently cannot be data-verified due to the floating-point data involved */
static void
test_cmpd_filtered_dataset_type_conversion_shared(void)
{
@@ -1920,8 +2059,12 @@ test_cmpd_filtered_dataset_type_conversion_shared(void)
/* Fill data buffer */
memset(data, 0, sizeof(cmpd_filtered_t) * COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_SHARED_ENTRIES_PER_PROC);
- for (i = 0; i < COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_SHARED_ENTRIES_PER_PROC; i++)
- data[i].field1 = data[i].field2 = data[i].field3 = data[i].field4 = GEN_DATA(i);
+ for (i = 0; i < COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_SHARED_ENTRIES_PER_PROC; i++) {
+ data[i].field1 = (short) GEN_DATA(i);
+ data[i].field2 = (int) GEN_DATA(i);
+ data[i].field3 = (long) GEN_DATA(i);
+ data[i].field4 = (double) GEN_DATA(i);
+ }
/* Create property list for collective dataset write */
plist_id = H5Pcreate(H5P_DATASET_XFER);
@@ -1953,22 +2096,19 @@ test_cmpd_filtered_dataset_type_conversion_shared(void)
* processes to ensure data correctness.
*
* Programmer: Jordan Henderson
- * XXX: 02/10/2017
+ * 08/03/2017
*/
static void
test_write_serial_read_parallel(void)
{
C_DATATYPE *data = NULL;
+ C_DATATYPE *read_buf = NULL;
+ C_DATATYPE *correct_buf = NULL;
hsize_t dataset_dims[WRITE_SERIAL_READ_PARALLEL_DATASET_DIMS];
hsize_t chunk_dims[WRITE_SERIAL_READ_PARALLEL_DATASET_DIMS];
- hsize_t sel_dims[WRITE_SERIAL_READ_PARALLEL_DATASET_DIMS];
- hsize_t count[WRITE_SERIAL_READ_PARALLEL_DATASET_DIMS];
- hsize_t stride[WRITE_SERIAL_READ_PARALLEL_DATASET_DIMS];
- hsize_t block[WRITE_SERIAL_READ_PARALLEL_DATASET_DIMS];
- hsize_t offset[WRITE_SERIAL_READ_PARALLEL_DATASET_DIMS];
- size_t i, j, k, data_size;
+ size_t i, data_size, correct_buf_size;
hid_t file_id = -1, dset_id = -1, plist_id = -1;
- hid_t filespace = -1, memspace = -1;
+ hid_t filespace = -1;
if (MAINPROCESS) puts("Testing write file serially; read file in parallel");
@@ -1992,9 +2132,6 @@ test_write_serial_read_parallel(void)
chunk_dims[0] = WRITE_SERIAL_READ_PARALLEL_CH_NROWS;
chunk_dims[1] = WRITE_SERIAL_READ_PARALLEL_CH_NCOLS;
chunk_dims[2] = 1;
- sel_dims[0] = WRITE_SERIAL_READ_PARALLEL_NROWS;
- sel_dims[1] = WRITE_SERIAL_READ_PARALLEL_NCOLS;
- sel_dims[2] = 1;
filespace = H5Screate_simple(WRITE_SERIAL_READ_PARALLEL_DATASET_DIMS, dataset_dims, NULL);
VRFY((filespace >= 0), "File dataspace creation succeeded");
@@ -2021,7 +2158,7 @@ test_write_serial_read_parallel(void)
VRFY((NULL != data), "malloc succeeded");
for (i = 0; i < data_size / sizeof(*data); i++)
- data[i] = GEN_DATA(i);
+ data[i] = (C_DATATYPE) GEN_DATA(i);
VRFY((H5Dwrite(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) >= 0), "Dataset write succeeded");
@@ -2031,7 +2168,69 @@ test_write_serial_read_parallel(void)
VRFY((H5Fclose(file_id) >= 0), "File close succeeded");
}
+ correct_buf_size = dataset_dims[0] * dataset_dims[1] * dataset_dims[2] * sizeof(*correct_buf);
+
+ correct_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != correct_buf), "malloc succeeded");
+
+ read_buf = (C_DATATYPE *) malloc(correct_buf_size);
+ VRFY((NULL != read_buf), "malloc succeeded");
+
+ for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
+ correct_buf[i] = (long) i;
+
/* All ranks open the file and verify their "portion" of the dataset is correct */
+ plist_id = H5Pcreate(H5P_FILE_ACCESS);
+ VRFY((plist_id >= 0), "FAPL creation succeeded");
+
+ VRFY((H5Pset_fapl_mpio(plist_id, comm, info) >= 0), "Set FAPL MPIO succeeded");
+
+ VRFY((H5Pset_libver_bounds(plist_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) >= 0), "Set libver bounds succeeded");
+
+ file_id = H5Fopen(filenames[0], H5F_ACC_RDWR, plist_id);
+ VRFY((file_id >= 0), "Test file open succeeded");
+
+ VRFY((H5Pclose(plist_id) >= 0), "FAPL close succeeded");
+
+ dset_id = H5Dopen(file_id, "/" WRITE_SERIAL_READ_PARALLEL_DATASET_NAME, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "Dataset open succeeded");
+
+ plist_id = H5Pcreate(H5P_DATASET_XFER);
+ VRFY((plist_id >= 0), "DXPL creation succeeded");
+
+ VRFY((H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE) >= 0), "Set DXPL MPIO succeeded");
+
+ VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0), "Dataset read succeeded");
+
+ if (MAINPROCESS) {
+ printf("Correct buf: ");
+ for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
+ printf("%ld, ", correct_buf[i]);
+ printf("\n\n");
+
+ printf("Read buf: ");
+ for (i = 0; i < correct_buf_size / sizeof(*correct_buf); i++)
+ printf("%ld, ", read_buf[i]);
+ printf("\n\n");
+
+ fflush(stdout);
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ }
+ else {
+ fflush(stdout);
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ }
+
+ /* VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)), "Data verification succeeded"); */
+
+ if (correct_buf) free(correct_buf);
+ if (read_buf) free(read_buf);
+
+ VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
+ VRFY((H5Pclose(plist_id) >= 0), "DXPL close succeeded");
+ VRFY((H5Fclose(file_id) >= 0), "File close succeeded");
return;
}
@@ -2044,7 +2243,7 @@ test_write_serial_read_parallel(void)
* process to ensure data correctness.
*
* Programmer: Jordan Henderson
- * XXX: 02/10/2017
+ * 08/03/2017
*/
static void
test_write_parallel_read_serial(void)
diff --git a/testpar/t_filters_parallel.h b/testpar/t_filters_parallel.h
index d098b66..4666033 100644
--- a/testpar/t_filters_parallel.h
+++ b/testpar/t_filters_parallel.h
@@ -48,7 +48,7 @@ size_t cd_nelmts = FILTER_NUM_CDVALUES;
#define HDF5_DATATYPE_NAME H5T_NATIVE_LONG
#define GEN_DATA(i) INCREMENTAL_DATA(i)
-#define INCREMENTAL_DATA(i) (mpi_rank + i) /* Generates incremental test data */
+#define INCREMENTAL_DATA(i) ((size_t) mpi_rank + i) /* Generates incremental test data */
/* XXX: For experimental purposes only, will causes tests to fail data verification phase */
/* #define GEN_DATA(i) RANK_DATA(i) */ /* Given an index value i, generates test data based upon selected mode */