From feb66e388de69d82bb6fc9921789b81ee310d9e1 Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Wed, 25 Sep 2024 20:40:50 -0500 Subject: [PATCH] Updates Added new parallel test library that contains common shared functionality for parallel tests (similar to h5test library) --- CMakeLists.txt | 5 + c++/test/dsets.cpp | 13 +- c++/test/h5cpputil.h | 59 +- c++/test/tarray.cpp | 8 +- c++/test/tattr.cpp | 18 +- c++/test/tcompound.cpp | 8 +- c++/test/tdspl.cpp | 8 +- c++/test/testhdf5.cpp | 42 +- c++/test/tfile.cpp | 20 +- c++/test/tfilter.cpp | 8 +- c++/test/th5s.cpp | 8 +- c++/test/titerate.cpp | 10 +- c++/test/tlinks.cpp | 10 +- c++/test/tobject.cpp | 14 +- c++/test/trefer.cpp | 10 +- c++/test/ttypes.cpp | 10 +- c++/test/tvlstr.cpp | 10 +- test/enc_dec_plist.c | 2 +- test/h5test.c | 9 +- test/h5test.h | 1 - test/stab.c | 7 +- test/tarray.c | 10 +- test/tattr.c | 10 +- test/tcoords.c | 10 +- test/testframe.c | 14 +- test/testframe.h | 31 +- test/testhdf5.c | 2 +- test/testhdf5.h | 100 +- test/tfile.c | 28 +- test/tgenprop.c | 10 +- test/th5o.c | 16 +- test/th5s.c | 18 +- test/titerate.c | 10 +- test/tmisc.c | 84 +- test/trefer.c | 32 +- test/trefer_deprec.c | 8 +- test/tselect.c | 10 +- test/tsohm.c | 8 +- test/ttime.c | 10 +- test/ttsafe.c | 2 +- test/ttsafe_acreate.c | 4 +- test/ttsafe_attr_vlen.c | 4 +- test/ttsafe_cancel.c | 4 +- test/ttsafe_dcreate.c | 4 +- test/ttsafe_error.c | 4 +- test/tunicode.c | 10 +- test/tvlstr.c | 14 +- test/tvltypes.c | 10 +- testpar/CMakeLists.txt | 116 +- testpar/t_2Gio.c | 2061 ++-------------------------------- testpar/t_bigio.c | 109 +- testpar/t_chunk_alloc.c | 8 +- testpar/t_coll_chunk.c | 40 +- testpar/t_coll_md.c | 20 +- testpar/t_dset.c | 153 +-- testpar/t_file.c | 28 +- testpar/t_file_image.c | 2 +- testpar/t_filter_read.c | 4 +- testpar/t_filters_parallel.h | 3 + testpar/t_mdset.c | 75 +- testpar/t_mpi.c | 3 +- testpar/t_oflush.c | 4 +- testpar/t_ph5basic.c | 6 +- testpar/t_prestart.c | 7 + testpar/t_prop.c | 4 +- testpar/t_pshutdown.c | 7 + testpar/t_shapesame.c | 212 ++-- testpar/t_span_tree.c | 50 +- testpar/t_subfiling_vfd.c | 3 + testpar/testpar.c | 121 ++ testpar/testpar.h | 55 +- testpar/testphdf5.c | 265 ++--- testpar/testphdf5.h | 180 ++- 73 files changed, 1245 insertions(+), 3038 deletions(-) create mode 100644 testpar/testpar.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 5382a8ff8b7..affac20dbc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,6 +159,7 @@ set (HDF5_LIB_BASE "hdf5") set (HDF5_LIB_CORE "") set (HDF5_TEST_LIB_CORE "_test") +set (HDF5_TEST_PAR_LIB_CORE "_testpar") set (HDF5_CPP_LIB_CORE "_cpp") set (HDF5_HL_LIB_CORE "_hl") set (HDF5_HL_CPP_LIB_CORE "_hl_cpp") @@ -174,6 +175,7 @@ set (HDF5_JAVA_JNI_LIB_CORE "_java") set (HDF5_LIB_CORENAME "${HDF5_LIB_BASE}") set (HDF5_TEST_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_TEST_LIB_CORE}") +set (HDF5_TEST_PAR_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_TEST_PAR_LIB_CORE}") set (HDF5_CPP_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_CPP_LIB_CORE}") set (HDF5_HL_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_HL_LIB_CORE}") set (HDF5_HL_CPP_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_HL_CPP_LIB_CORE}") @@ -194,6 +196,7 @@ set (HDF5_JAVA_TEST_LIB_CORENAME "jartest5") #----------------------------------------------------------------------------- set (HDF5_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") set (HDF5_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_TEST_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") +set (HDF5_TEST_PAR_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_TEST_PAR_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") set (HDF5_CPP_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_CPP_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") set (HDF5_HL_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_HL_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") set (HDF5_HL_CPP_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_HL_CPP_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") @@ -216,6 +219,7 @@ set (HDF5_JAVA_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_TEST_LIB #----------------------------------------------------------------------------- set (HDF5_LIB_TARGET "${HDF5_LIB_CORENAME}-static") set (HDF5_TEST_LIB_TARGET "${HDF5_TEST_LIB_CORENAME}-static") +set (HDF5_TEST_PAR_LIB_TARGET "${HDF5_TEST_PAR_LIB_CORENAME}-static") set (HDF5_CPP_LIB_TARGET "${HDF5_CPP_LIB_CORENAME}-static") set (HDF5_HL_LIB_TARGET "${HDF5_HL_LIB_CORENAME}-static") set (HDF5_HL_CPP_LIB_TARGET "${HDF5_HL_CPP_LIB_CORENAME}-static") @@ -232,6 +236,7 @@ set (HDF5_JAVA_HDF5_LIB_TARGET "${HDF5_JAVA_HDF5_LIB_CORENAME}") set (HDF5_JAVA_TEST_LIB_TARGET "${HDF5_JAVA_TEST_LIB_CORENAME}") set (HDF5_LIBSH_TARGET "${HDF5_LIB_CORENAME}-shared") set (HDF5_TEST_LIBSH_TARGET "${HDF5_TEST_LIB_CORENAME}-shared") +set (HDF5_TEST_PAR_LIBSH_TARGET "${HDF5_TEST_PAR_LIB_CORENAME}-shared") set (HDF5_CPP_LIBSH_TARGET "${HDF5_CPP_LIB_CORENAME}-shared") set (HDF5_HL_LIBSH_TARGET "${HDF5_HL_LIB_CORENAME}-shared") set (HDF5_HL_CPP_LIBSH_TARGET "${HDF5_HL_CPP_LIB_CORENAME}-shared") diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 65dabbe11c2..625e97f0d72 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1451,7 +1451,7 @@ test_read_string(H5File &file) *------------------------------------------------------------------------- */ extern "C" void -test_dset() +test_dset(const void *params) { hid_t fapl_id; fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template @@ -1492,9 +1492,6 @@ test_dset() catch (Exception &E) { test_report(nerrors, H5std_string(" Dataset")); } - - // Clean up data file - cleanup_dsets(); } // test_dset /*------------------------------------------------------------------------- @@ -1506,8 +1503,10 @@ test_dset() *------------------------------------------------------------------------- */ extern "C" void -cleanup_dsets() +cleanup_dsets(void *params) { - HDremove(FILE1.c_str()); - HDremove(FILE_ACCPLIST.c_str()); + if (GetTestCleanup()) { + HDremove(FILE1.c_str()); + HDremove(FILE_ACCPLIST.c_str()); + } } // cleanup_dsets diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index fa6822ad172..4b34be52b50 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -22,6 +22,7 @@ #define H5cpputil_H #include "h5test.h" +#include "testframe.h" using namespace H5; using std::cerr; @@ -30,7 +31,7 @@ using std::endl; #define MESSAGE(V, A) \ do { \ if (HDGetTestVerbosity() > (V)) \ - print_func A; \ + printf A; \ } while (0) #define SUBTEST(TEST) \ do { \ @@ -142,36 +143,36 @@ verify_val(Type1 x, Type2 value, float epsilon, const char *msg, int line, const #ifdef __cplusplus extern "C" { #endif -void test_array(); -void test_attr(); -void test_compound(); -void test_dsproplist(); -void test_file(); -void test_filters(); -void test_links(); -void test_h5s(); -void test_iterate(); -void test_object(); -void test_reference(); -void test_types(); -void test_vlstrings(); -void test_dset(); +void test_array(const void *params); +void test_attr(const void *params); +void test_compound(const void *params); +void test_dsproplist(const void *params); +void test_file(const void *params); +void test_filters(const void *params); +void test_links(const void *params); +void test_h5s(const void *params); +void test_iterate(const void *params); +void test_object(const void *params); +void test_reference(const void *params); +void test_types(const void *params); +void test_vlstrings(const void *params); +void test_dset(const void *params); /* Prototypes for the cleanup routines */ -void cleanup_array(); -void cleanup_attr(); -void cleanup_compound(); -void cleanup_dsproplist(); -void cleanup_dsets(); -void cleanup_file(); -void cleanup_filters(); -void cleanup_h5s(); -void cleanup_iterate(); -void cleanup_links(); -void cleanup_object(); -void cleanup_reference(); -void cleanup_types(); -void cleanup_vlstrings(); +void cleanup_array(void *params); +void cleanup_attr(void *params); +void cleanup_compound(void *params); +void cleanup_dsproplist(void *params); +void cleanup_dsets(void *params); +void cleanup_file(void *params); +void cleanup_filters(void *params); +void cleanup_h5s(void *params); +void cleanup_iterate(void *params); +void cleanup_links(void *params); +void cleanup_object(void *params); +void cleanup_reference(void *params); +void cleanup_types(void *params); +void cleanup_vlstrings(void *params); #ifdef __cplusplus } diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index 2d14264f006..3ee94d24f59 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -477,7 +477,7 @@ test_array_info() *------------------------------------------------------------------------- */ extern "C" void -test_array() +test_array(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Array Datatypes\n")); @@ -502,7 +502,9 @@ test_array() *------------------------------------------------------------------------- */ extern "C" void -cleanup_array() +cleanup_array(void *params) { - HDremove(FILENAME.c_str()); + if (GetTestCleanup()) { + HDremove(FILENAME.c_str()); + } } // cleanup_array diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 5135e0c7fa7..07ab0a6d777 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1956,7 +1956,7 @@ test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl) *------------------------------------------------------------------------- */ extern "C" void -test_attr() +test_attr(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Attributes\n")); @@ -2041,12 +2041,14 @@ test_attr() *------------------------------------------------------------------------- */ extern "C" void -cleanup_attr() +cleanup_attr(void *params) { - HDremove(FILE_BASIC.c_str()); - HDremove(FILE_COMPOUND.c_str()); - HDremove(FILE_SCALAR.c_str()); - HDremove(FILE_MULTI.c_str()); - HDremove(FILE_DTYPE.c_str()); - HDremove(FILE_CRTPROPS.c_str()); + if (GetTestCleanup()) { + HDremove(FILE_BASIC.c_str()); + HDremove(FILE_COMPOUND.c_str()); + HDremove(FILE_SCALAR.c_str()); + HDremove(FILE_MULTI.c_str()); + HDremove(FILE_DTYPE.c_str()); + HDremove(FILE_CRTPROPS.c_str()); + } } diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 53939dd1eb8..dada2c075a8 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -729,7 +729,7 @@ test_compound_set_size() *------------------------------------------------------------------------- */ extern "C" void -test_compound() +test_compound(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Compound Data Type operations\n")); @@ -753,7 +753,9 @@ test_compound() *------------------------------------------------------------------------- */ extern "C" void -cleanup_compound() +cleanup_compound(void *params) { - HDremove(COMPFILE.c_str()); + if (GetTestCleanup()) { + HDremove(COMPFILE.c_str()); + } } // cleanup_file diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index bccc41a568f..90b558fdbbf 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -114,7 +114,7 @@ test_transfplist() *------------------------------------------------------------------------- */ extern "C" void -test_dsproplist() +test_dsproplist(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Generic Dataset Property Lists\n")); @@ -132,7 +132,9 @@ test_dsproplist() *------------------------------------------------------------------------- */ extern "C" void -cleanup_dsproplist() +cleanup_dsproplist(void *params) { - HDremove(FILENAME.c_str()); + if (GetTestCleanup()) { + HDremove(FILENAME.c_str()); + } } diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index 53becf1e1bc..bbbe7b6a400 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -57,42 +57,42 @@ main(int argc, char *argv[]) // caused deliberately and expected. Exception::dontPrint(); /* Initialize testing framework */ - TestInit(argv[0], NULL, NULL); + TestInit(argv[0], NULL, NULL, 0); // testing file creation and opening in tfile.cpp - AddTest("tfile", test_file, cleanup_file, "File I/O Operations", NULL); + AddTest("tfile", test_file, NULL, cleanup_file, NULL, 0, "File I/O Operations"); // testing dataset functionalities in dset.cpp - AddTest("dsets", test_dset, cleanup_dsets, "Dataset I/O Operations", NULL); + AddTest("dsets", test_dset, NULL, cleanup_dsets, NULL, 0, "Dataset I/O Operations"); // testing dataspace functionalities in th5s.cpp - AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL); + AddTest("th5s", test_h5s, NULL, cleanup_h5s, NULL, 0, "Dataspaces"); // testing attribute functionalities in tattr.cpp - AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL); + AddTest("tattr", test_attr, NULL, cleanup_attr, NULL, 0, "Attributes"); // testing object functionalities in tobject.cpp - AddTest("tobject", test_object, cleanup_object, "Objects", NULL); + AddTest("tobject", test_object, NULL, cleanup_object, NULL, 0, "Objects"); // testing reference functionalities in trefer.cpp - AddTest("trefer", test_reference, cleanup_reference, "References", NULL); + AddTest("trefer", test_reference, NULL, cleanup_reference, NULL, 0, "References"); // testing variable-length strings in tvlstr.cpp - AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL); - AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL); - AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL); - AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL); - AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL); - AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL); - AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL); + AddTest("tvlstr", test_vlstrings, NULL, cleanup_vlstrings, NULL, 0, "Variable-Length Strings"); + AddTest("ttypes", test_types, NULL, cleanup_types, NULL, 0, "Generic Data Types"); + AddTest("tarray", test_array, NULL, cleanup_array, NULL, 0, "Array Datatypes"); + AddTest("tcompound", test_compound, NULL, cleanup_compound, NULL, 0, "Compound Data Types"); + AddTest("tdspl", test_dsproplist, NULL, cleanup_dsproplist, NULL, 0, "Dataset Property List"); + AddTest("tfilter", test_filters, NULL, cleanup_filters, NULL, 0, "Various Filters"); + AddTest("tlinks", test_links, NULL, cleanup_links, NULL, 0, "Various Links"); /* Comment out tests that are not done yet. - BMR, Feb 2001 - AddTest("select", test_select, cleanup_select, "Selections", NULL); - AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL); - AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL); + AddTest("select", test_select, NULL, cleanup_select, NULL, 0, "Selections"); + AddTest("time", test_time, NULL, cleanup_time, NULL, 0, "Time Datatypes"); + AddTest("vltypes", test_vltypes, NULL, cleanup_vltypes, NULL, 0, "Variable-Length Datatypes"); */ - AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL); + AddTest("iterate", test_iterate, NULL, cleanup_iterate, NULL, 0, "Group & Attribute Iteration"); /* - AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL); - AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL); + AddTest("genprop", test_genprop, NULL, cleanup_genprop, NULL, 0, "Generic Properties"); + AddTest("id", test_ids, NULL, NULL, NULL, 0, "User-Created Identifiers"); Comment out tests that are not done yet */ /* Tentative - BMR 2007/1/12 - AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL); + AddTest("enum", test_enum, NULL, cleanup_enum, NULL, 0, "Enum Data Types"); */ } catch (Exception &E) { diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 212a241a3d9..bd7d96422e8 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -968,7 +968,7 @@ test_file_info() *------------------------------------------------------------------------- */ extern "C" void -test_file() +test_file(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing File I/O Operations\n")); @@ -996,13 +996,15 @@ test_file() extern "C" #endif void - cleanup_file() + cleanup_file(void *params) { - HDremove(FILE1.c_str()); - HDremove(FILE2.c_str()); - HDremove(FILE3.c_str()); - HDremove(FILE4.c_str()); - HDremove(FILE5.c_str()); - HDremove(FILE6.c_str()); - HDremove(FILE7.c_str()); + if (GetTestCleanup()) { + HDremove(FILE1.c_str()); + HDremove(FILE2.c_str()); + HDremove(FILE3.c_str()); + HDremove(FILE4.c_str()); + HDremove(FILE5.c_str()); + HDremove(FILE6.c_str()); + HDremove(FILE7.c_str()); + } } // cleanup_file diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 26be0681c2d..d66a7b5894c 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -227,7 +227,7 @@ test_szip_filter(H5File &file1) */ const H5std_string FILE1("tfilters.h5"); extern "C" void -test_filters() +test_filters(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Various Filters\n")); @@ -259,7 +259,9 @@ test_filters() *------------------------------------------------------------------------- */ extern "C" void -cleanup_filters() +cleanup_filters(void *params) { - HDremove(FILE1.c_str()); + if (GetTestCleanup()) { + HDremove(FILE1.c_str()); + } } diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 04bc3c0b188..34fb32d4cea 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -471,7 +471,7 @@ test_h5s_compound_scalar_read() *------------------------------------------------------------------------- */ extern "C" void -test_h5s() +test_h5s(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Dataspaces\n")); @@ -493,7 +493,9 @@ test_h5s() *------------------------------------------------------------------------- */ extern "C" void -cleanup_h5s() +cleanup_h5s(void *params) { - HDremove(DATAFILE.c_str()); + if (GetTestCleanup()) { + HDremove(DATAFILE.c_str()); + } } // cleanup_h5s diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index b9196d43976..958b1bda604 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -440,7 +440,7 @@ test_HDFFV_9920() *------------------------------------------------------------------------- */ extern "C" void -test_iterate() +test_iterate(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Iterate Feature\n")); @@ -464,8 +464,10 @@ test_iterate() *------------------------------------------------------------------------- */ extern "C" void -cleanup_iterate() +cleanup_iterate(void *params) { - HDremove(FILE_ITERATE.c_str()); - HDremove(FILE_NAME.c_str()); + if (GetTestCleanup()) { + HDremove(FILE_ITERATE.c_str()); + HDremove(FILE_NAME.c_str()); + } } // cleanup_iterate diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 3ce8c6823d3..a6d68631fc4 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -709,7 +709,7 @@ test_visit(hid_t fapl_id, hbool_t new_format) *------------------------------------------------------------------------- */ extern "C" void -test_links() +test_links(const void *params) { hid_t fapl_id, fapl2_id; /* File access property lists */ unsigned new_format; /* Whether to use the new format or not */ @@ -769,8 +769,10 @@ test_links() *------------------------------------------------------------------------- */ extern "C" void -cleanup_links() +cleanup_links(void *params) { - HDremove(FILENAME[0]); - HDremove(FILENAME[1]); + if (GetTestCleanup()) { + HDremove(FILENAME[0]); + HDremove(FILENAME[1]); + } } diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 0affed1f838..cec13323544 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -718,7 +718,7 @@ test_intermediate_groups() *------------------------------------------------------------------------- */ extern "C" void -test_object() +test_object(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Object Functions\n")); @@ -742,10 +742,12 @@ test_object() *------------------------------------------------------------------------- */ extern "C" void -cleanup_object() +cleanup_object(void *params) { - HDremove(FILE_OBJECTS.c_str()); - HDremove(FILE_OBJHDR.c_str()); - HDremove(FILE_OBJINFO.c_str()); - HDremove(FILE_INTERGRPS.c_str()); + if (GetTestCleanup()) { + HDremove(FILE_OBJECTS.c_str()); + HDremove(FILE_OBJHDR.c_str()); + HDremove(FILE_OBJINFO.c_str()); + HDremove(FILE_INTERGRPS.c_str()); + } } // cleanup_objects diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 31c50229a1e..627330f4660 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -827,7 +827,7 @@ test_reference_region_1D() *------------------------------------------------------------------------- */ extern "C" void -test_reference() +test_reference(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing References\n")); @@ -848,8 +848,10 @@ test_reference() *------------------------------------------------------------------------- */ extern "C" void -cleanup_reference() +cleanup_reference(void *params) { - HDremove(FILE1.c_str()); - HDremove(FILE2.c_str()); + if (GetTestCleanup()) { + HDremove(FILE1.c_str()); + HDremove(FILE2.c_str()); + } } diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 322b72f444e..c504635b6ca 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -1093,7 +1093,7 @@ test_operators() *------------------------------------------------------------------------- */ extern "C" void -test_types() +test_types(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Generic Data Types\n")); @@ -1120,8 +1120,10 @@ test_types() *------------------------------------------------------------------------- */ extern "C" void -cleanup_types() +cleanup_types(void *params) { - for (int i = 0; i < 6; i++) - HDremove(FILENAME[i]); + if (GetTestCleanup()) { + for (int i = 0; i < 6; i++) + HDremove(FILENAME[i]); + } } // cleanup_types diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 33710a3ba17..ba39620334a 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -934,7 +934,7 @@ test_vl_rewrite() *------------------------------------------------------------------------- */ extern "C" void -test_vlstrings() +test_vlstrings(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Variable-Length Strings")); @@ -967,8 +967,10 @@ test_vlstrings() *------------------------------------------------------------------------- */ extern "C" void -cleanup_vlstrings() +cleanup_vlstrings(void *params) { - HDremove(FILENAME.c_str()); - HDremove(FILENAME2.c_str()); + if (GetTestCleanup()) { + HDremove(FILENAME.c_str()); + HDremove(FILENAME2.c_str()); + } } diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 878fe86449b..3fe137efd77 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -14,7 +14,7 @@ * Serial tests for encoding/decoding plists */ -#include "testhdf5.h" +#include "h5test.h" #include "H5ACprivate.h" #include "H5Pprivate.h" diff --git a/test/h5test.c b/test/h5test.c index c60c3851dad..b9d228bc4f7 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -121,6 +121,9 @@ size_t n_tests_failed_g = 0; size_t n_tests_skipped_g = 0; uint64_t vol_cap_flags_g = H5VL_CAP_FLAG_NONE; +/* Whether h5_cleanup should clean up temporary testing files */ +static bool do_test_file_cleanup_g = true; + static herr_t h5_errors(hid_t estack, void *client_data); static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size, bool nest_printf, bool subst_for_superblock); @@ -216,7 +219,7 @@ h5_cleanup(const char *base_name[], hid_t fapl) { int retval = 0; - if (GetTestCleanup()) { + if (do_test_file_cleanup_g) { /* Clean up files in base_name, and the FAPL */ h5_delete_all_test_files(base_name, fapl); H5Pclose(fapl); @@ -461,12 +464,12 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu if (isppdriver) { #ifdef H5_HAVE_PARALLEL if (getenv_all(MPI_COMM_WORLD, 0, HDF5_NOCLEANUP)) - SetTestNoCleanup(); + do_test_file_cleanup_g = false; #endif /* H5_HAVE_PARALLEL */ } else { if (getenv(HDF5_NOCLEANUP)) - SetTestNoCleanup(); + do_test_file_cleanup_g = false; } /* Check what prefix to use for test files. Process HDF5_PARAPREFIX and diff --git a/test/h5test.h b/test/h5test.h index bd8c5323e4d..1ee99efa383 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -327,7 +327,6 @@ H5TEST_DLLVAR size_t n_tests_passed_g; H5TEST_DLLVAR size_t n_tests_failed_g; H5TEST_DLLVAR size_t n_tests_skipped_g; H5TEST_DLLVAR uint64_t vol_cap_flags_g; -H5TEST_DLLVAR int mpi_rank_framework_g; H5TEST_DLL void h5_send_message(const char *file, const char *arg1, const char *arg2); H5TEST_DLL herr_t h5_wait_message(const char *file); diff --git a/test/stab.c b/test/stab.c index 3bae4d75046..c48474874c4 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1466,10 +1466,9 @@ main(void) puts("All symbol table tests passed."); /* Cleanup */ - if (GetTestCleanup()) { - HDremove(FILE_OLD_GROUPS_COPY); - HDremove(CORRUPT_STAB_TMP_FILE); - } + HDremove(FILE_OLD_GROUPS_COPY); + HDremove(CORRUPT_STAB_TMP_FILE); + h5_cleanup(FILENAME, fapl); return 0; diff --git a/test/tarray.c b/test/tarray.c index 68ae567f5a3..8f370cb4846 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -2251,9 +2251,11 @@ test_array(const void H5_ATTR_UNUSED *params) void cleanup_array(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } /* end cleanup_array() */ diff --git a/test/tattr.c b/test/tattr.c index 71290101fd7..0a889081042 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -12159,9 +12159,11 @@ test_attr(const void H5_ATTR_UNUSED *params) void cleanup_attr(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tcoords.c b/test/tcoords.c index 169991cc82f..b223600a4d2 100644 --- a/test/tcoords.c +++ b/test/tcoords.c @@ -715,9 +715,11 @@ test_coords(const void H5_ATTR_UNUSED *params) void cleanup_coords(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/testframe.c b/test/testframe.c index a19d2ef0ea0..8cb527036ec 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -59,7 +59,6 @@ static int TestDoCleanUp_g = 1; /* Do cleanup or not. Default is yes. */ /* * Add a new test to the list of tests to be executed */ -/* TODO: update usages of AddTest() */ herr_t AddTest(const char *TestName, void (*TestFunc)(const void *), void (*TestSetupFunc)(void *), void (*TestCleanupFunc)(void *), const void *TestData, size_t TestDataSize, @@ -138,7 +137,8 @@ AddTest(const char *TestName, void (*TestFunc)(const void *), void (*TestSetupFu */ herr_t TestInit(const char *ProgName, void (*TestPrivateUsage)(FILE *stream), - herr_t (*TestPrivateParser)(int argc, char *argv[])) + herr_t (*TestPrivateParser)(int argc, char *argv[]), + int TestProcessID) { /* Turn off automatic error reporting if requested */ if (enable_error_stack == 0) { @@ -158,6 +158,8 @@ TestInit(const char *ProgName, void (*TestPrivateUsage)(FILE *stream), if (NULL != TestPrivateParser) TestPrivateParser_g = TestPrivateParser; + TestFrameworkMPIRank_g = TestProcessID; + /* Reset global variables used by the testing framework */ /* TODO: move from h5test to here */ n_tests_run_g = 0; @@ -393,9 +395,13 @@ PerformTests(void) TestAlarmOn(); - TestArray[Loop].TestSetupFunc(TestArray[Loop].TestParameters); + if (TestArray[Loop].TestSetupFunc) + TestArray[Loop].TestSetupFunc(TestArray[Loop].TestParameters); + TestArray[Loop].TestFunc(TestArray[Loop].TestParameters); - TestArray[Loop].TestCleanupFunc(TestArray[Loop].TestParameters); + + if (TestArray[Loop].TestCleanupFunc) + TestArray[Loop].TestCleanupFunc(TestArray[Loop].TestParameters); TestAlarmOff(); diff --git a/test/testframe.h b/test/testframe.h index 9d2e15501fd..f360d4d1491 100644 --- a/test/testframe.h +++ b/test/testframe.h @@ -17,6 +17,14 @@ #ifndef H5TESTFRAME_H #define H5TESTFRAME_H +/* + * Include generic testing header, which includes the public + * HDF5 header, first. Including a private header first can + * cause the library to #undef the H5OPEN macro and cause odd + * test failures due to global IDs not being initialized. + */ +#include "h5test.h" + #include "H5private.h" /**********/ @@ -60,6 +68,10 @@ /* Prototypes */ /**************/ +#ifdef __cplusplus +extern "C" { +#endif + /** * -------------------------------------------------------------------------- * \ingroup H5TEST @@ -74,6 +86,9 @@ * \param[in] TestPrivateParser Pointer to a function which parses * command-line arguments which are specific to * the test program + * \param[in] TestProcessID ID for the process calling TestInit(). Used + * to control printing of output in parallel + * test programs. * * \return \herr_t * @@ -102,11 +117,21 @@ * may be NULL. TODO: may need note about how all standard options * have to come first, unless that gets fixed. * + * \p TestProcessID is an integer value that is used to distinguish + * between processes when multiple are involved in running a test + * program. This is primarily useful for controlling testing + * framework output printed during execution of a parallel test + * program. For serial tests, the value 0 should always be passed. + * For parallel tests, the rank value of the MPI process, as obtained + * by calling MPI_Comm_rank(), should be passed. Test framework output + * is only printed from the process with ID 0. + * * \see TestShutdown(), TestUsage(), TestParseCmdLine() * */ H5TEST_DLL herr_t TestInit(const char *ProgName, void (*TestPrivateUsage)(FILE *stream), - int (*TestPrivateParser)(int argc, char *argv[])); + int (*TestPrivateParser)(int argc, char *argv[]), + int TestProcessID); /** * -------------------------------------------------------------------------- @@ -678,4 +703,8 @@ H5TEST_DLL herr_t TestAlarmOn(void); */ H5TEST_DLL void TestAlarmOff(void); +#ifdef __cplusplus +} +#endif + #endif /* H5TESTFRAME_H */ diff --git a/test/testhdf5.c b/test/testhdf5.c index 151eb0ba2f3..92458824b86 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -47,7 +47,7 @@ main(int argc, char *argv[]) H5Pclose(fapl_id); /* Initialize testing framework */ - if (TestInit(argv[0], NULL, NULL) < 0) { + if (TestInit(argv[0], NULL, NULL, 0) < 0) { fprintf(stderr, "couldn't initialize testing framework\n"); exit(EXIT_FAILURE); } diff --git a/test/testhdf5.h b/test/testhdf5.h index bc678549d13..d38b0dc4591 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -17,12 +17,12 @@ #ifndef TESTHDF5_H #define TESTHDF5_H +/* Include generic testing header */ +#include "h5test.h" + /* Include testing framework functionality */ #include "testframe.h" -/* Include generic testing header also */ -#include "h5test.h" - /* Use %ld to print the value because long should cover most cases. */ /* Used to make certain a return value _is_not_ a value */ #define CHECK(ret, val, where) \ @@ -197,55 +197,55 @@ extern "C" { #endif /* Prototypes for the test routines */ -void test_metadata(const void *); -void test_checksum(const void *); -void test_refstr(const void *); -void test_file(const void *); -void test_h5o(const void *); -void test_h5t(const void *); -void test_h5s(const void *); -void test_coords(const void *); -void test_h5d(const void *); -void test_attr(const void *); -void test_select(const void *); -void test_time(const void *); -void test_reference(const void *); -void test_reference_deprec(const void *); -void test_vltypes(const void *); -void test_vlstrings(const void *); -void test_iterate(const void *); -void test_array(const void *); -void test_genprop(const void *); -void test_configure(const void *); -void test_h5_system(const void *); -void test_misc(const void *); -void test_ids(const void *); -void test_skiplist(const void *); -void test_sohm(const void *); -void test_unicode(const void *); +void test_metadata(const void *params); +void test_checksum(const void *params); +void test_refstr(const void *params); +void test_file(const void *params); +void test_h5o(const void *params); +void test_h5t(const void *params); +void test_h5s(const void *params); +void test_coords(const void *params); +void test_h5d(const void *params); +void test_attr(const void *params); +void test_select(const void *params); +void test_time(const void *params); +void test_reference(const void *params); +void test_reference_deprec(const void *params); +void test_vltypes(const void *params); +void test_vlstrings(const void *params); +void test_iterate(const void *params); +void test_array(const void *params); +void test_genprop(const void *params); +void test_configure(const void *params); +void test_h5_system(const void *params); +void test_misc(const void *params); +void test_ids(const void *params); +void test_skiplist(const void *params); +void test_sohm(const void *params); +void test_unicode(const void *params); /* Prototypes for the cleanup routines */ -void cleanup_metadata(void *); -void cleanup_checksum(void *); -void cleanup_file(void *); -void cleanup_h5o(void *); -void cleanup_h5s(void *); -void cleanup_coords(void *); -void cleanup_attr(void *); -void cleanup_select(void *); -void cleanup_time(void *); -void cleanup_reference(void *); -void cleanup_reference_deprec(void *); -void cleanup_vltypes(void *); -void cleanup_vlstrings(void *); -void cleanup_iterate(void *); -void cleanup_array(void *); -void cleanup_genprop(void *); -void cleanup_configure(void *); -void cleanup_h5_system(void *); -void cleanup_sohm(void *); -void cleanup_misc(void *); -void cleanup_unicode(void *); +void cleanup_metadata(void *params); +void cleanup_checksum(void *params); +void cleanup_file(void *params); +void cleanup_h5o(void *params); +void cleanup_h5s(void *params); +void cleanup_coords(void *params); +void cleanup_attr(void *params); +void cleanup_select(void *params); +void cleanup_time(void *params); +void cleanup_reference(void *params); +void cleanup_reference_deprec(void *params); +void cleanup_vltypes(void *params); +void cleanup_vlstrings(void *params); +void cleanup_iterate(void *params); +void cleanup_array(void *params); +void cleanup_genprop(void *params); +void cleanup_configure(void *params); +void cleanup_h5_system(void *params); +void cleanup_sohm(void *params); +void cleanup_misc(void *params); +void cleanup_unicode(void *params); #ifdef __cplusplus } diff --git a/test/tfile.c b/test/tfile.c index 20b5d30280a..33599b8b7bc 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -8491,18 +8491,20 @@ test_file(const void H5_ATTR_UNUSED *params) void cleanup_file(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(SFILE1, H5P_DEFAULT); - H5Fdelete(FILE1, H5P_DEFAULT); - H5Fdelete(FILE2, H5P_DEFAULT); - H5Fdelete(FILE3, H5P_DEFAULT); - H5Fdelete(FILE4, H5P_DEFAULT); - H5Fdelete(FILE5, H5P_DEFAULT); - H5Fdelete(FILE6, H5P_DEFAULT); - H5Fdelete(FILE7, H5P_DEFAULT); - H5Fdelete(FILE8, H5P_DEFAULT); - H5Fdelete(DST_FILE, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(SFILE1, H5P_DEFAULT); + H5Fdelete(FILE1, H5P_DEFAULT); + H5Fdelete(FILE2, H5P_DEFAULT); + H5Fdelete(FILE3, H5P_DEFAULT); + H5Fdelete(FILE4, H5P_DEFAULT); + H5Fdelete(FILE5, H5P_DEFAULT); + H5Fdelete(FILE6, H5P_DEFAULT); + H5Fdelete(FILE7, H5P_DEFAULT); + H5Fdelete(FILE8, H5P_DEFAULT); + H5Fdelete(DST_FILE, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tgenprop.c b/test/tgenprop.c index f8d239b0ab7..b4267b66a87 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -2190,9 +2190,11 @@ test_genprop(const void H5_ATTR_UNUSED *params) void cleanup_genprop(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/th5o.c b/test/th5o.c index b6397ab5a38..f4eddfc4f5c 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -1922,12 +1922,14 @@ test_h5o(const void H5_ATTR_UNUSED *params) void cleanup_h5o(void H5_ATTR_UNUSED *params) { - char filename[1024]; - - H5E_BEGIN_TRY - { - h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); - H5Fdelete(filename, H5P_DEFAULT); + if (GetTestCleanup()) { + char filename[1024]; + + H5E_BEGIN_TRY + { + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + H5Fdelete(filename, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/th5s.c b/test/th5s.c index d4bb5876c6f..e7094925d06 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -3536,13 +3536,15 @@ test_h5s(const void H5_ATTR_UNUSED *params) void cleanup_h5s(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(DATAFILE, H5P_DEFAULT); - H5Fdelete(NULLFILE, H5P_DEFAULT); - H5Fdelete(BASICFILE, H5P_DEFAULT); - H5Fdelete(ZEROFILE, H5P_DEFAULT); - H5Fdelete(VERBFNAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + H5Fdelete(NULLFILE, H5P_DEFAULT); + H5Fdelete(BASICFILE, H5P_DEFAULT); + H5Fdelete(ZEROFILE, H5P_DEFAULT); + H5Fdelete(VERBFNAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/titerate.c b/test/titerate.c index bddba2ccdaa..4abd468fd58 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -1276,9 +1276,11 @@ test_iterate(const void H5_ATTR_UNUSED *params) void cleanup_iterate(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(DATAFILE, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tmisc.c b/test/tmisc.c index f32aea5b270..e3ce99eeea8 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -7190,50 +7190,52 @@ test_misc(const void H5_ATTR_UNUSED *params) void cleanup_misc(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(MISC1_FILE, H5P_DEFAULT); - H5Fdelete(MISC2_FILE_1, H5P_DEFAULT); - H5Fdelete(MISC2_FILE_2, H5P_DEFAULT); - H5Fdelete(MISC3_FILE, H5P_DEFAULT); - H5Fdelete(MISC4_FILE_1, H5P_DEFAULT); - H5Fdelete(MISC4_FILE_2, H5P_DEFAULT); - H5Fdelete(MISC5_FILE, H5P_DEFAULT); - H5Fdelete(MISC6_FILE, H5P_DEFAULT); - H5Fdelete(MISC7_FILE, H5P_DEFAULT); - H5Fdelete(MISC8_FILE, H5P_DEFAULT); - H5Fdelete(MISC9_FILE, H5P_DEFAULT); - H5Fdelete(MISC10_FILE_NEW, H5P_DEFAULT); - H5Fdelete(MISC11_FILE, H5P_DEFAULT); - H5Fdelete(MISC12_FILE, H5P_DEFAULT); - H5Fdelete(MISC13_FILE_1, H5P_DEFAULT); - H5Fdelete(MISC13_FILE_2, H5P_DEFAULT); - H5Fdelete(MISC14_FILE, H5P_DEFAULT); - H5Fdelete(MISC15_FILE, H5P_DEFAULT); - H5Fdelete(MISC16_FILE, H5P_DEFAULT); - H5Fdelete(MISC17_FILE, H5P_DEFAULT); - H5Fdelete(MISC18_FILE, H5P_DEFAULT); - H5Fdelete(MISC19_FILE, H5P_DEFAULT); - H5Fdelete(MISC20_FILE, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(MISC1_FILE, H5P_DEFAULT); + H5Fdelete(MISC2_FILE_1, H5P_DEFAULT); + H5Fdelete(MISC2_FILE_2, H5P_DEFAULT); + H5Fdelete(MISC3_FILE, H5P_DEFAULT); + H5Fdelete(MISC4_FILE_1, H5P_DEFAULT); + H5Fdelete(MISC4_FILE_2, H5P_DEFAULT); + H5Fdelete(MISC5_FILE, H5P_DEFAULT); + H5Fdelete(MISC6_FILE, H5P_DEFAULT); + H5Fdelete(MISC7_FILE, H5P_DEFAULT); + H5Fdelete(MISC8_FILE, H5P_DEFAULT); + H5Fdelete(MISC9_FILE, H5P_DEFAULT); + H5Fdelete(MISC10_FILE_NEW, H5P_DEFAULT); + H5Fdelete(MISC11_FILE, H5P_DEFAULT); + H5Fdelete(MISC12_FILE, H5P_DEFAULT); + H5Fdelete(MISC13_FILE_1, H5P_DEFAULT); + H5Fdelete(MISC13_FILE_2, H5P_DEFAULT); + H5Fdelete(MISC14_FILE, H5P_DEFAULT); + H5Fdelete(MISC15_FILE, H5P_DEFAULT); + H5Fdelete(MISC16_FILE, H5P_DEFAULT); + H5Fdelete(MISC17_FILE, H5P_DEFAULT); + H5Fdelete(MISC18_FILE, H5P_DEFAULT); + H5Fdelete(MISC19_FILE, H5P_DEFAULT); + H5Fdelete(MISC20_FILE, H5P_DEFAULT); #ifdef H5_HAVE_FILTER_SZIP - H5Fdelete(MISC21_FILE, H5P_DEFAULT); - H5Fdelete(MISC22_FILE, H5P_DEFAULT); + H5Fdelete(MISC21_FILE, H5P_DEFAULT); + H5Fdelete(MISC22_FILE, H5P_DEFAULT); #endif /* H5_HAVE_FILTER_SZIP */ - H5Fdelete(MISC23_FILE, H5P_DEFAULT); - H5Fdelete(MISC24_FILE, H5P_DEFAULT); - H5Fdelete(MISC25A_FILE, H5P_DEFAULT); - H5Fdelete(MISC25C_FILE, H5P_DEFAULT); - H5Fdelete(MISC26_FILE, H5P_DEFAULT); - H5Fdelete(MISC28_FILE, H5P_DEFAULT); - H5Fdelete(MISC29_COPY_FILE, H5P_DEFAULT); - H5Fdelete(MISC30_FILE, H5P_DEFAULT); + H5Fdelete(MISC23_FILE, H5P_DEFAULT); + H5Fdelete(MISC24_FILE, H5P_DEFAULT); + H5Fdelete(MISC25A_FILE, H5P_DEFAULT); + H5Fdelete(MISC25C_FILE, H5P_DEFAULT); + H5Fdelete(MISC26_FILE, H5P_DEFAULT); + H5Fdelete(MISC28_FILE, H5P_DEFAULT); + H5Fdelete(MISC29_COPY_FILE, H5P_DEFAULT); + H5Fdelete(MISC30_FILE, H5P_DEFAULT); #ifndef H5_NO_DEPRECATED_SYMBOLS - H5Fdelete(MISC31_FILE, H5P_DEFAULT); + H5Fdelete(MISC31_FILE, H5P_DEFAULT); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - H5Fdelete(MISC38C_FILE, H5P_DEFAULT); - H5Fdelete(MISC39_FILE, H5P_DEFAULT); - H5Fdelete(MISC40_FILE, H5P_DEFAULT); - H5Fdelete(MISC41_FILE, H5P_DEFAULT); + H5Fdelete(MISC38C_FILE, H5P_DEFAULT); + H5Fdelete(MISC39_FILE, H5P_DEFAULT); + H5Fdelete(MISC40_FILE, H5P_DEFAULT); + H5Fdelete(MISC41_FILE, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } /* end cleanup_misc() */ diff --git a/test/trefer.c b/test/trefer.c index 9d12cf0bc75..ba43f070a87 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -3886,20 +3886,22 @@ test_reference(const void H5_ATTR_UNUSED *params) void cleanup_reference(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILE_REF_PARAM, H5P_DEFAULT); - H5Fdelete(FILE_REF_OBJ, H5P_DEFAULT); - H5Fdelete(FILE_REF_VL_OBJ, H5P_DEFAULT); - H5Fdelete(FILE_REF_CMPND_OBJ, H5P_DEFAULT); - H5Fdelete(FILE_REF_REG, H5P_DEFAULT); - H5Fdelete(FILE_REF_REG_1D, H5P_DEFAULT); - H5Fdelete(FILE_REF_OBJ_DEL, H5P_DEFAULT); - H5Fdelete(FILE_REF_GRP, H5P_DEFAULT); - H5Fdelete(FILE_REF_ATTR, H5P_DEFAULT); - H5Fdelete(FILE_REF_EXT1, H5P_DEFAULT); - H5Fdelete(FILE_REF_EXT2, H5P_DEFAULT); - H5Fdelete(FILE_REF_COMPAT, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILE_REF_PARAM, H5P_DEFAULT); + H5Fdelete(FILE_REF_OBJ, H5P_DEFAULT); + H5Fdelete(FILE_REF_VL_OBJ, H5P_DEFAULT); + H5Fdelete(FILE_REF_CMPND_OBJ, H5P_DEFAULT); + H5Fdelete(FILE_REF_REG, H5P_DEFAULT); + H5Fdelete(FILE_REF_REG_1D, H5P_DEFAULT); + H5Fdelete(FILE_REF_OBJ_DEL, H5P_DEFAULT); + H5Fdelete(FILE_REF_GRP, H5P_DEFAULT); + H5Fdelete(FILE_REF_ATTR, H5P_DEFAULT); + H5Fdelete(FILE_REF_EXT1, H5P_DEFAULT); + H5Fdelete(FILE_REF_EXT2, H5P_DEFAULT); + H5Fdelete(FILE_REF_COMPAT, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 86dbfa276a9..1a1a3dc8092 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -1864,7 +1864,9 @@ test_reference_deprec(const void H5_ATTR_UNUSED *params) void cleanup_reference_deprec(void H5_ATTR_UNUSED *params) { - HDremove(FILE1); - HDremove(FILE2); - HDremove(FILE3); + if (GetTestCleanup()) { + HDremove(FILE1); + HDremove(FILE2); + HDremove(FILE3); + } } diff --git a/test/tselect.c b/test/tselect.c index 6ed5d8eb4eb..a2dcf269a8e 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -16277,9 +16277,11 @@ test_select(const void H5_ATTR_UNUSED *params) void cleanup_select(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tsohm.c b/test/tsohm.c index 5a615f5df14..82581c2fd77 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3769,7 +3769,9 @@ test_sohm(const void H5_ATTR_UNUSED *params) void cleanup_sohm(void H5_ATTR_UNUSED *params) { - HDremove(FILENAME); - HDremove(FILENAME_SRC); - HDremove(FILENAME_DST); + if (GetTestCleanup()) { + HDremove(FILENAME); + HDremove(FILENAME_SRC); + HDremove(FILENAME_DST); + } } /* cleanup_sohm */ diff --git a/test/ttime.c b/test/ttime.c index d4dc9b6b857..3d9ab879565 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -222,9 +222,11 @@ test_time(const void H5_ATTR_UNUSED *params) void cleanup_time(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(DATAFILE, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/ttsafe.c b/test/ttsafe.c index d4ca1395d31..a92b73ad17e 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -97,7 +97,7 @@ main(int argc, char *argv[]) { /* Initialize testing framework */ - if (TestInit(argv[0], NULL, NULL) < 0) { + if (TestInit(argv[0], NULL, NULL, 0) < 0) { fprintf(stderr, "couldn't initialize testing framework\n"); return -1; } diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index a7ddb596e28..15ad84b1c88 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -184,7 +184,9 @@ tts_acreate_thread(void *client_data) void cleanup_acreate(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/ttsafe_attr_vlen.c b/test/ttsafe_attr_vlen.c index 2528e8a43a9..4a706b0082e 100644 --- a/test/ttsafe_attr_vlen.c +++ b/test/ttsafe_attr_vlen.c @@ -182,7 +182,9 @@ tts_attr_vlen_thread(void H5_ATTR_UNUSED *client_data) void cleanup_attr_vlen(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index a6a3b0f33b2..7531f3e0dde 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -205,7 +205,9 @@ cancellation_cleanup(void *arg) void cleanup_cancel(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_PTHREAD_H*/ diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index d35e719a889..e206a1415d1 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -154,6 +154,8 @@ tts_dcreate_creator(void *_thread_data) void cleanup_dcreate(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 91bb949582a..806ff4bb511 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -253,7 +253,9 @@ walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void H5_ATTR_UNUSE void cleanup_error(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/tunicode.c b/test/tunicode.c index 02ece2a2781..0b54281f835 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -866,9 +866,11 @@ test_unicode(const void H5_ATTR_UNUSED *params) void cleanup_unicode(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tvlstr.c b/test/tvlstr.c index 2ff553f133b..51004de8d08 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -1002,11 +1002,13 @@ test_vlstrings(const void H5_ATTR_UNUSED *params) void cleanup_vlstrings(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(DATAFILE, H5P_DEFAULT); - H5Fdelete(DATAFILE2, H5P_DEFAULT); - H5Fdelete(DATAFILE3, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + H5Fdelete(DATAFILE2, H5P_DEFAULT); + H5Fdelete(DATAFILE3, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tvltypes.c b/test/tvltypes.c index 5882c7074c2..ac3e13fdc53 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -3268,9 +3268,11 @@ test_vltypes(const void H5_ATTR_UNUSED *params) void cleanup_vltypes(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 106f79eba1e..35b862e1414 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -1,6 +1,17 @@ cmake_minimum_required (VERSION 3.18) project (HDF5_TEST_PAR C) +################################################################################# +# Define Parallel Test Library Sources +################################################################################# +set (TEST_PAR_LIB_SOURCES + ${HDF5_TEST_PAR_SOURCE_DIR}/testpar.c +) + +set (TEST_PAR_LIB_HEADERS + ${HDF5_TEST_PAR_SOURCE_DIR}/testpar.h +) + #----------------------------------------------------------------------------- # Define Tests #----------------------------------------------------------------------------- @@ -30,6 +41,101 @@ set (HDF5_TESTPAR_COMPILE_DEFS_PRIVATE "$<$:H5_HAVE_TEST_API>" ) +################################################################################# +# Setup build for parallel test library +################################################################################# +if (BUILD_STATIC_LIBS) + add_library (${HDF5_TEST_PAR_LIB_TARGET} STATIC ${TEST_PAR_LIB_SOURCES} ${TEST_PAR_LIB_HEADERS}) + target_include_directories (${HDF5_TEST_PAR_LIB_TARGET} + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_PAR_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_options(${HDF5_TEST_PAR_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_TEST_PAR_LIB_TARGET} + PRIVATE + "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + "${HDF5_TEST_COMPILE_DEFS_PRIVATE}" + ) + TARGET_C_PROPERTIES (${HDF5_TEST_PAR_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_TEST_PAR_LIB_TARGET} + PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} + PRIVATE "$<$,$>:ws2_32.lib>" + ) + if (MINGW) + target_link_libraries (${HDF5_TEST_PAR_LIB_TARGET} PRIVATE "wsock32.lib") + endif () + H5_SET_LIB_OPTIONS (${HDF5_TEST_PAR_LIB_TARGET} ${HDF5_TEST_PAR_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_TEST_PAR_LIB_TARGET} PROPERTIES FOLDER libraries/test/par) + + if (HDF5_EXPORTED_TARGETS AND HDF5_TEST_API_INSTALL) + INSTALL_TARGET_PDB (${HDF5_TEST_PAR_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} libraries) + + install ( + TARGETS ${HDF5_TEST_PAR_LIB_TARGET} + EXPORT ${HDF5_EXPORTED_TARGETS} + LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT libraries + FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries + INCLUDES DESTINATION include + ) + endif () +endif () + +if (BUILD_SHARED_LIBS) + add_library (${HDF5_TEST_PAR_LIBSH_TARGET} SHARED ${TEST_PAR_LIB_SOURCES} ${TEST_PAR_LIB_HEADERS}) + target_include_directories (${HDF5_TEST_PAR_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_PAR_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_options(${HDF5_TEST_PAR_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_TEST_PAR_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE + "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + "${HDF5_TEST_COMPILE_DEFS_PRIVATE}" + ) + TARGET_C_PROPERTIES (${HDF5_TEST_PAR_LIBSH_TARGET} SHARED) + target_link_libraries (${HDF5_TEST_PAR_LIBSH_TARGET} + PUBLIC ${LINK_LIBS} ${HDF5_LIBSH_TARGET} + PRIVATE "$<$,$>:ws2_32.lib>" + ) + if (MINGW) + target_link_libraries (${HDF5_TEST_PAR_LIBSH_TARGET} PRIVATE "wsock32.lib") + endif () + H5_SET_LIB_OPTIONS (${HDF5_TEST_PAR_LIBSH_TARGET} ${HDF5_TEST_PAR_LIB_NAME} SHARED "LIB") + set_target_properties (${HDF5_TEST_PAR_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/par) + + if (HDF5_EXPORTED_TARGETS AND HDF5_TEST_API_INSTALL) + INSTALL_TARGET_PDB (${HDF5_TEST_PAR_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) + + install ( + TARGETS ${HDF5_TEST_PAR_LIBSH_TARGET} + EXPORT ${HDF5_EXPORTED_TARGETS} + LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT libraries + FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries + INCLUDES DESTINATION include + ) + endif () +endif () + +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (BUILD_STATIC_LIBS) + clang_format (HDF5_TEST_PAR_SRC_FORMAT ${HDF5_TEST_PAR_LIB_TARGET}) + else () + clang_format (HDF5_TEST_PAR_SRC_FORMAT ${HDF5_TEST_PAR_LIBSH_TARGET}) + endif () +endif () + +################################################################################# +# Tests +################################################################################# + #-- Adding test for testhdf5 add_executable (testphdf5 ${testphdf5_SOURCES}) target_compile_options(testphdf5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -40,12 +146,12 @@ target_include_directories (testphdf5 if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (testphdf5 STATIC) target_link_libraries (testphdf5 - PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:MPI::MPI_C>" + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_PAR_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:MPI::MPI_C>" ) else () TARGET_C_PROPERTIES (testphdf5 SHARED) target_link_libraries (testphdf5 - PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:MPI::MPI_C>" + PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_PAR_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:MPI::MPI_C>" ) endif () set_target_properties (testphdf5 PROPERTIES FOLDER test/par) @@ -67,13 +173,15 @@ macro (ADD_H5P_EXE file) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} - PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:MPI::MPI_C>" + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_PAR_LIB_TARGET} ${HDF5_LIB_TARGET} + "$<$:MPI::MPI_C>" "$<$,$>:ws2_32.lib>" ) else () TARGET_C_PROPERTIES (${file} SHARED) target_link_libraries (${file} - PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:MPI::MPI_C>" + PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_PAR_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + "$<$:MPI::MPI_C>" "$<$,$>:ws2_32.lib>" ) endif () diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index 31eb6b6398b..215e00a7757 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -29,6 +29,9 @@ #include "hdf5.h" #include "testpar.h" +/* Include testing framework functionality */ +#include "testframe.h" + #include "mpi.h" /* For this test, we don't want to inherit the RANK definition @@ -58,8 +61,6 @@ #define DATASETNAME2 "Data2" #define DATASETNAME3 "Data3" #define DATASETNAME4 "Data4" -#define DATASETNAME5 "Data5" -#define DATASETNAME6 "Data6" #define DATASETNAME7 "Data7" #define DATASETNAME8 "Data8" #define DATASETNAME9 "Data9" @@ -94,6 +95,11 @@ char *filenames[NFILENAME]; hid_t fapl; /* file access property list */ MPI_Comm test_comm = MPI_COMM_WORLD; +/* Structure for passing test parameters around */ +typedef struct test_params_t { + char *filename; +} test_params_t; + // static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */ // static const char *TestProgName = NULL; // static void (*TestPrivateUsage)(void) = NULL; @@ -107,20 +113,20 @@ MPI_Comm test_comm = MPI_COMM_WORLD; * Show command usage */ static void -usage(void) +usage(FILE *stream) { - printf(" [-r] [-w] [-m] [-n] " - "[-o] [-f ] [-d ]\n"); - printf("\t-m" - "\tset number of datasets for the multiple dataset test\n"); - printf("\t-n" - "\tset number of groups for the multiple group test\n"); - printf("\t-f \tfilename prefix\n"); - printf("\t-2\t\tuse Split-file together with MPIO\n"); - printf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", BIG_X_FACTOR, - BIG_Y_FACTOR); - printf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); - printf("\n"); + fprintf(stream, " [-r] [-w] [-m] [-n] " + "[-o] [-f ] [-d ]\n"); + fprintf(stream, "\t-m" + "\tset number of datasets for the multiple dataset test\n"); + fprintf(stream, "\t-n" + "\tset number of groups for the multiple group test\n"); + fprintf(stream, "\t-f \tfilename prefix\n"); + fprintf(stream, "\t-2\t\tuse Split-file together with MPIO\n"); + fprintf(stream, "\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", BIG_X_FACTOR, + BIG_Y_FACTOR); + fprintf(stream, "\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); + fprintf(stream, "\n"); } /* @@ -252,59 +258,6 @@ parse_options(int argc, char **argv) return (0); } -/* - * Create the appropriate File access property list - */ -hid_t -create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) -{ - hid_t ret_pl = H5I_INVALID_HID; - herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ - - /* need the rank for error checking macros */ - MPI_Comm_rank(test_comm, &mpi_rank); - - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); - - if (l_facc_type == FACC_DEFAULT) - return (ret_pl); - - if (l_facc_type == FACC_MPIO) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); - ret = H5Pset_all_coll_metadata_ops(ret_pl, true); - VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); - VRFY((ret >= 0), ""); - return (ret_pl); - } - - if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { - hid_t mpio_pl; - - mpio_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return (ret_pl); - } - - /* unknown file access types */ - return (ret_pl); -} - /* * Setup the dimensions of the hyperslab. * Two modes--by rows or by columns. @@ -396,54 +349,6 @@ slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], hsize_t s } } -/* - * Setup the coordinates for point selection. - */ -void -point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, - hsize_t coords[], int order) -{ - hsize_t i, j, k = 0, m, n, s1, s2; - - // HDcompile_assert(MAX_RANK == 3); - HDcompile_assert(MAX_RANK == 2); - - if (OUT_OF_ORDER == order) - k = (num_points * MAX_RANK) - 1; - else if (IN_ORDER == order) - k = 0; - - s1 = start[0]; - s2 = start[1]; - - for (i = 0; i < count[0]; i++) - for (j = 0; j < count[1]; j++) - for (m = 0; m < block[0]; m++) - for (n = 0; n < block[1]; n++) - if (OUT_OF_ORDER == order) { - coords[k--] = s2 + (stride[1] * j) + n; - coords[k--] = s1 + (stride[0] * i) + m; - } - else if (IN_ORDER == order) { - coords[k++] = s1 + stride[0] * i + m; - coords[k++] = s2 + stride[1] * j + n; - } - - if (VERBOSE_MED) { - printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " - "datapoints=%lu\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], - (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], - (unsigned long)block[0], (unsigned long)block[1], - (unsigned long)(block[0] * block[1] * count[0] * count[1])); - k = 0; - for (i = 0; i < num_points; i++) { - printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); - k += 2; - } - } -} - /* * Fill the dataset with trivial data for testing. * Assume dimension rank is 2 and data is stored contiguous. @@ -492,7 +397,7 @@ dataset_print(hsize_t start[], hsize_t block[], DATATYPE *dataset) /* * Print the content of the dataset. */ -int +static int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original) { @@ -713,7 +618,7 @@ MpioTest2G(MPI_Comm comm) * dataset. */ -void +static void dataset_writeInd(const void *params) { hid_t fid; /* HDF5 file ID */ @@ -740,7 +645,7 @@ dataset_writeInd(const void *params) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = (const char *)params; + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Independent write test on file %s\n", filename); @@ -858,7 +763,7 @@ dataset_writeInd(const void *params) } /* Example of using the parallel HDF5 library to read a dataset */ -void +static void dataset_readInd(const void *params) { hid_t fid; /* HDF5 file ID */ @@ -880,7 +785,7 @@ dataset_readInd(const void *params) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = (const char *)params; + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Independent read test on file %s\n", filename); @@ -980,7 +885,7 @@ dataset_readInd(const void *params) * each process controls a hyperslab within.] */ -void +static void dataset_writeAll(const void *params) { hid_t fid; /* HDF5 file ID */ @@ -1013,7 +918,7 @@ dataset_writeAll(const void *params) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = (const char *) params; + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Collective write test on file %s\n", filename); @@ -1502,7 +1407,7 @@ dataset_writeAll(const void *params) * each process controls a hyperslab within.] */ -void +static void dataset_readAll(const void *params) { hid_t fid; /* HDF5 file ID */ @@ -1529,7 +1434,7 @@ dataset_readAll(const void *params) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = (const char *)params; + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Collective read test on file %s\n", filename); @@ -1904,241 +1809,13 @@ dataset_readAll(const void *params) free(data_origin1); } -/* - * Part 2--Independent read/write for extendible datasets. - */ - -/* - * Example of using the parallel HDF5 library to create two extendible - * datasets in one HDF5 file with independent parallel MPIO access support. - * The Datasets are of sizes (number-of-mpi-processes x dim0) x dim1. - * Each process controls only a slab of size dim0 x dim1 within each - * dataset. - */ - -void -extend_writeInd(void) -{ - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - const char *filename; - hsize_t dims[MAX_RANK]; /* dataset dim sizes */ - hsize_t max_dims[MAX_RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - hsize_t chunk_dims[MAX_RANK]; /* chunk sizes */ - hid_t dataset_pl; /* dataset create prop. list */ - - hsize_t start[MAX_RANK]; /* for hyperslab setting */ - hsize_t count[MAX_RANK]; /* for hyperslab setting */ - hsize_t stride[MAX_RANK]; /* for hyperslab setting */ - hsize_t block[MAX_RANK]; /* for hyperslab setting */ - - herr_t ret; /* Generic return value */ - int mpi_size, mpi_rank; - - MPI_Comm comm = test_comm; - MPI_Info info = MPI_INFO_NULL; - - filename = GetTestParameters(); - if (VERBOSE_MED) - printf("Extend independent write test on file %s\n", filename); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - /* setup chunk-size. Make sure sizes are > 0 */ - chunk_dims[0] = (hsize_t)chunkdim0; - chunk_dims[1] = (hsize_t)chunkdim1; - - /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - - /* ------------------- - * START AN HDF5 FILE - * -------------------*/ - /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); - - /* Reduce the number of metadata cache slots, so that there are cache - * collisions during the raw data I/O on the chunked dataset. This stresses - * the metadata cache and tests for cache bugs. -QAK - */ - { - int mdc_nelmts; - size_t rdcc_nelmts; - size_t rdcc_nbytes; - double rdcc_w0; - - ret = H5Pget_cache(acc_tpl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0); - VRFY((ret >= 0), "H5Pget_cache succeeded"); - mdc_nelmts = 4; - ret = H5Pset_cache(acc_tpl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0); - VRFY((ret >= 0), "H5Pset_cache succeeded"); - } - - /* create the file collectively */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); - VRFY((fid >= 0), "H5Fcreate succeeded"); - - /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); - - /* -------------------------------------------------------------- - * Define the dimensions of the overall datasets and create them. - * ------------------------------------------------------------- */ - - /* set up dataset storage chunk sizes and creation property list */ - if (VERBOSE_MED) - printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); - dataset_pl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dataset_pl >= 0), "H5Pcreate succeeded"); - ret = H5Pset_chunk(dataset_pl, MAX_RANK, chunk_dims); - VRFY((ret >= 0), "H5Pset_chunk succeeded"); - - /* setup dimensionality object */ - /* start out with no rows, extend it later. */ - dims[0] = dims[1] = 0; - sid = H5Screate_simple(MAX_RANK, dims, max_dims); - VRFY((sid >= 0), "H5Screate_simple succeeded"); - - /* create an extendible dataset collectively */ - dataset1 = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dataset_pl, H5P_DEFAULT); - VRFY((dataset1 >= 0), "H5Dcreate2 succeeded"); - - /* create another extendible dataset collectively */ - dataset2 = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dataset_pl, H5P_DEFAULT); - VRFY((dataset2 >= 0), "H5Dcreate2 succeeded"); - - /* release resource */ - H5Sclose(sid); - H5Pclose(dataset_pl); - - /* ------------------------- - * Test writing to dataset1 - * -------------------------*/ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - /* put some trivial data in the data_array */ - dataset_fill(start, block, data_array1); - MESG("data_array initialized"); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* Extend its current dim sizes before writing */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - ret = H5Dset_extent(dataset1, dims); - VRFY((ret >= 0), "H5Dset_extent succeeded"); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently */ - ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret >= 0), "H5Dwrite succeeded"); - - /* release resource */ - H5Sclose(file_dataspace); - H5Sclose(mem_dataspace); - - /* ------------------------- - * Test writing to dataset2 - * -------------------------*/ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - /* put some trivial data in the data_array */ - dataset_fill(start, block, data_array1); - MESG("data_array initialized"); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* Try write to dataset2 beyond its current dim sizes. Should fail. */ - /* Temporary turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently. Should fail. */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret < 0), "H5Dwrite failed as expected"); - - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); - H5Sclose(file_dataspace); - - /* Extend dataset2 and try again. Should succeed. */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - ret = H5Dset_extent(dataset2, dims); - VRFY((ret >= 0), "H5Dset_extent succeeded"); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret >= 0), "H5Dwrite succeeded"); - - /* release resource */ - ret = H5Sclose(file_dataspace); - VRFY((ret >= 0), "H5Sclose succeeded"); - ret = H5Sclose(mem_dataspace); - VRFY((ret >= 0), "H5Sclose succeeded"); - - /* close dataset collectively */ - ret = H5Dclose(dataset1); - VRFY((ret >= 0), "H5Dclose1 succeeded"); - ret = H5Dclose(dataset2); - VRFY((ret >= 0), "H5Dclose2 succeeded"); - - /* close the file collectively */ - H5Fclose(fid); - - /* release data buffers */ - if (data_array1) - free(data_array1); -} - /* * Example of using the parallel HDF5 library to create an extendable dataset * and perform I/O on it in a way that verifies that the chunk cache is * bypassed for parallel I/O. */ -void +static void extend_writeInd2(const void *params) { const char *filename; @@ -2159,7 +1836,7 @@ extend_writeInd2(const void *params) int i; /* Local index variable */ herr_t ret; /* Generic return value */ - filename = (const char *)params; + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Extend independent write test #2 on file %s\n", filename); @@ -2296,643 +1973,34 @@ extend_writeInd2(const void *params) VRFY((ret >= 0), "H5Fclose succeeded"); } -/* Example of using the parallel HDF5 library to read an extendible dataset */ -void -extend_readInd(void) +/* + * Example of using the parallel HDF5 library to read a compressed + * dataset in an HDF5 file with collective parallel access support. + */ +#ifdef H5_HAVE_FILTER_DEFLATE +static void +compress_readAll(const void *params) { - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - hsize_t dims[MAX_RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_array2 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ - const char *filename; - - hsize_t start[MAX_RANK]; /* for hyperslab setting */ - hsize_t count[MAX_RANK], stride[MAX_RANK]; /* for hyperslab setting */ - hsize_t block[MAX_RANK]; /* for hyperslab setting */ - - herr_t ret; /* Generic return value */ - int mpi_size, mpi_rank; - - MPI_Comm comm = test_comm; - MPI_Info info = MPI_INFO_NULL; - - filename = GetTestParameters(); - if (VERBOSE_MED) - printf("Extend independent read test on file %s\n", filename); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_array2 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array2 != NULL), "data_array2 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); - - /* ------------------- - * OPEN AN HDF5 FILE - * -------------------*/ - /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); - - /* open the file collectively */ - fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl); - VRFY((fid >= 0), ""); - - /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); - - /* open the dataset1 collectively */ - dataset1 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); - VRFY((dataset1 >= 0), ""); - - /* open another dataset collectively */ - dataset2 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); - VRFY((dataset2 >= 0), ""); - - /* Try extend dataset1 which is open RDONLY. Should fail. */ - /* first turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL); - VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded"); - dims[0]++; - ret = H5Dset_extent(dataset1, dims); - VRFY((ret < 0), "H5Dset_extent failed as expected"); - - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); - H5Sclose(file_dataspace); - - /* Read dataset1 using BYROW pattern */ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), ""); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), ""); - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* fill dataset with test data */ - dataset_fill(start, block, data_origin1); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* read data independently */ - ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret >= 0), "H5Dread succeeded"); - - /* verify the read data with original expected data */ - ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); - VRFY((ret == 0), "dataset1 read verified correct"); - if (ret) - nerrors++; - - H5Sclose(mem_dataspace); - H5Sclose(file_dataspace); - - /* Read dataset2 using BYCOL pattern */ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), ""); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), ""); - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* fill dataset with test data */ - dataset_fill(start, block, data_origin1); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* read data independently */ - ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret >= 0), "H5Dread succeeded"); - - /* verify the read data with original expected data */ - ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); - VRFY((ret == 0), "dataset2 read verified correct"); - if (ret) - nerrors++; - - H5Sclose(mem_dataspace); - H5Sclose(file_dataspace); - - /* close dataset collectively */ - ret = H5Dclose(dataset1); - VRFY((ret >= 0), ""); - ret = H5Dclose(dataset2); - VRFY((ret >= 0), ""); - - /* close the file collectively */ - H5Fclose(fid); - - /* release data buffers */ - if (data_array1) - free(data_array1); - if (data_array2) - free(data_array2); - if (data_origin1) - free(data_origin1); -} - -/* - * Part 3--Collective read/write for extendible datasets. - */ - -/* - * Example of using the parallel HDF5 library to create two extendible - * datasets in one HDF5 file with collective parallel MPIO access support. - * The Datasets are of sizes (number-of-mpi-processes x dim0) x dim1. - * Each process controls only a slab of size dim0 x dim1 within each - * dataset. - */ - -void -extend_writeAll(void) -{ - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - const char *filename; - hsize_t dims[MAX_RANK]; /* dataset dim sizes */ - hsize_t max_dims[MAX_RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - hsize_t chunk_dims[MAX_RANK]; /* chunk sizes */ - hid_t dataset_pl; /* dataset create prop. list */ - - hsize_t start[MAX_RANK]; /* for hyperslab setting */ - hsize_t count[MAX_RANK]; /* for hyperslab setting */ - hsize_t stride[MAX_RANK]; /* for hyperslab setting */ - hsize_t block[MAX_RANK]; /* for hyperslab setting */ - - herr_t ret; /* Generic return value */ - int mpi_size, mpi_rank; - - MPI_Comm comm = test_comm; - MPI_Info info = MPI_INFO_NULL; - - filename = GetTestParameters(); - if (VERBOSE_MED) - printf("Extend independent write test on file %s\n", filename); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - /* setup chunk-size. Make sure sizes are > 0 */ - chunk_dims[0] = (hsize_t)chunkdim0; - chunk_dims[1] = (hsize_t)chunkdim1; - - /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - - /* ------------------- - * START AN HDF5 FILE - * -------------------*/ - /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); - - /* Reduce the number of metadata cache slots, so that there are cache - * collisions during the raw data I/O on the chunked dataset. This stresses - * the metadata cache and tests for cache bugs. -QAK - */ - { - int mdc_nelmts; - size_t rdcc_nelmts; - size_t rdcc_nbytes; - double rdcc_w0; - - ret = H5Pget_cache(acc_tpl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0); - VRFY((ret >= 0), "H5Pget_cache succeeded"); - mdc_nelmts = 4; - ret = H5Pset_cache(acc_tpl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0); - VRFY((ret >= 0), "H5Pset_cache succeeded"); - } - - /* create the file collectively */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); - VRFY((fid >= 0), "H5Fcreate succeeded"); - - /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); - - /* -------------------------------------------------------------- - * Define the dimensions of the overall datasets and create them. - * ------------------------------------------------------------- */ - - /* set up dataset storage chunk sizes and creation property list */ - if (VERBOSE_MED) - printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); - dataset_pl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dataset_pl >= 0), "H5Pcreate succeeded"); - ret = H5Pset_chunk(dataset_pl, MAX_RANK, chunk_dims); - VRFY((ret >= 0), "H5Pset_chunk succeeded"); - - /* setup dimensionality object */ - /* start out with no rows, extend it later. */ - dims[0] = dims[1] = 0; - sid = H5Screate_simple(MAX_RANK, dims, max_dims); - VRFY((sid >= 0), "H5Screate_simple succeeded"); - - /* create an extendible dataset collectively */ - dataset1 = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dataset_pl, H5P_DEFAULT); - VRFY((dataset1 >= 0), "H5Dcreate2 succeeded"); - - /* create another extendible dataset collectively */ - dataset2 = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dataset_pl, H5P_DEFAULT); - VRFY((dataset2 >= 0), "H5Dcreate2 succeeded"); - - /* release resource */ - H5Sclose(sid); - H5Pclose(dataset_pl); - - /* ------------------------- - * Test writing to dataset1 - * -------------------------*/ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - /* put some trivial data in the data_array */ - dataset_fill(start, block, data_array1); - MESG("data_array initialized"); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* Extend its current dim sizes before writing */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - ret = H5Dset_extent(dataset1, dims); - VRFY((ret >= 0), "H5Dset_extent succeeded"); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* set up the collective transfer properties list */ - xfer_plist = H5Pcreate(H5P_DATASET_XFER); - VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - if (dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret >= 0), "set independent IO collectively succeeded"); - } - - /* write data collectively */ - ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret >= 0), "H5Dwrite succeeded"); - - /* release resource */ - H5Sclose(file_dataspace); - H5Sclose(mem_dataspace); - H5Pclose(xfer_plist); - - /* ------------------------- - * Test writing to dataset2 - * -------------------------*/ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - /* put some trivial data in the data_array */ - dataset_fill(start, block, data_array1); - MESG("data_array initialized"); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* set up the collective transfer properties list */ - xfer_plist = H5Pcreate(H5P_DATASET_XFER); - VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - if (dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret >= 0), "set independent IO collectively succeeded"); - } - - /* Try write to dataset2 beyond its current dim sizes. Should fail. */ - /* Temporary turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently. Should fail. */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret < 0), "H5Dwrite failed as expected"); - - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); - H5Sclose(file_dataspace); - - /* Extend dataset2 and try again. Should succeed. */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - ret = H5Dset_extent(dataset2, dims); - VRFY((ret >= 0), "H5Dset_extent succeeded"); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret >= 0), "H5Dwrite succeeded"); - - /* release resource */ - ret = H5Sclose(file_dataspace); - VRFY((ret >= 0), "H5Sclose succeeded"); - ret = H5Sclose(mem_dataspace); - VRFY((ret >= 0), "H5Sclose succeeded"); - ret = H5Pclose(xfer_plist); - VRFY((ret >= 0), "H5Pclose succeeded"); - - /* close dataset collectively */ - ret = H5Dclose(dataset1); - VRFY((ret >= 0), "H5Dclose1 succeeded"); - ret = H5Dclose(dataset2); - VRFY((ret >= 0), "H5Dclose2 succeeded"); - - /* close the file collectively */ - H5Fclose(fid); - - /* release data buffers */ - if (data_array1) - free(data_array1); -} - -/* Example of using the parallel HDF5 library to read an extendible dataset */ -void -extend_readAll(void) -{ - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - const char *filename; - hsize_t dims[MAX_RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_array2 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ - - hsize_t start[MAX_RANK]; /* for hyperslab setting */ - hsize_t count[MAX_RANK], stride[MAX_RANK]; /* for hyperslab setting */ - hsize_t block[MAX_RANK]; /* for hyperslab setting */ - - herr_t ret; /* Generic return value */ - int mpi_size, mpi_rank; - - MPI_Comm comm = test_comm; - MPI_Info info = MPI_INFO_NULL; - - filename = GetTestParameters(); - if (VERBOSE_MED) - printf("Extend independent read test on file %s\n", filename); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_array2 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array2 != NULL), "data_array2 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); - - /* ------------------- - * OPEN AN HDF5 FILE - * -------------------*/ - /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); - - /* open the file collectively */ - fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl); - VRFY((fid >= 0), ""); - - /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); - - /* open the dataset1 collectively */ - dataset1 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); - VRFY((dataset1 >= 0), ""); - - /* open another dataset collectively */ - dataset2 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); - VRFY((dataset2 >= 0), ""); - - /* Try extend dataset1 which is open RDONLY. Should fail. */ - /* first turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL); - VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded"); - dims[0]++; - ret = H5Dset_extent(dataset1, dims); - VRFY((ret < 0), "H5Dset_extent failed as expected"); - - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); - H5Sclose(file_dataspace); - - /* Read dataset1 using BYROW pattern */ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), ""); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), ""); - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* fill dataset with test data */ - dataset_fill(start, block, data_origin1); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* set up the collective transfer properties list */ - xfer_plist = H5Pcreate(H5P_DATASET_XFER); - VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - if (dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret >= 0), "set independent IO collectively succeeded"); - } - - /* read data collectively */ - ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret >= 0), "H5Dread succeeded"); - - /* verify the read data with original expected data */ - ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); - VRFY((ret == 0), "dataset1 read verified correct"); - if (ret) - nerrors++; - - H5Sclose(mem_dataspace); - H5Sclose(file_dataspace); - H5Pclose(xfer_plist); - - /* Read dataset2 using BYCOL pattern */ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), ""); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), ""); - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* fill dataset with test data */ - dataset_fill(start, block, data_origin1); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* set up the collective transfer properties list */ - xfer_plist = H5Pcreate(H5P_DATASET_XFER); - VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - if (dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret >= 0), "set independent IO collectively succeeded"); - } - - /* read data collectively */ - ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret >= 0), "H5Dread succeeded"); - - /* verify the read data with original expected data */ - ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); - VRFY((ret == 0), "dataset2 read verified correct"); - if (ret) - nerrors++; - - H5Sclose(mem_dataspace); - H5Sclose(file_dataspace); - H5Pclose(xfer_plist); - - /* close dataset collectively */ - ret = H5Dclose(dataset1); - VRFY((ret >= 0), ""); - ret = H5Dclose(dataset2); - VRFY((ret >= 0), ""); - - /* close the file collectively */ - H5Fclose(fid); - - /* release data buffers */ - if (data_array1) - free(data_array1); - if (data_array2) - free(data_array2); - if (data_origin1) - free(data_origin1); -} - -/* - * Example of using the parallel HDF5 library to read a compressed - * dataset in an HDF5 file with collective parallel access support. - */ -#ifdef H5_HAVE_FILTER_DEFLATE -void -compress_readAll(const void *params) -{ - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t dcpl; /* Dataset creation property list */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t dataspace; /* Dataspace ID */ - hid_t dataset; /* Dataset ID */ - int rank = 1; /* Dataspace rank */ - hsize_t dim = (hsize_t)dim0; /* Dataspace dimensions */ - unsigned u; /* Local index variable */ - unsigned chunk_opts; /* Chunk options */ - unsigned disable_partial_chunk_filters; /* Whether filters are disabled on partial chunks */ - DATATYPE *data_read = NULL; /* data buffer */ - DATATYPE *data_orig = NULL; /* expected data buffer */ + hid_t fid; /* HDF5 file ID */ + hid_t acc_tpl; /* File access templates */ + hid_t dcpl; /* Dataset creation property list */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t dataspace; /* Dataspace ID */ + hid_t dataset; /* Dataset ID */ + int rank = 1; /* Dataspace rank */ + hsize_t dim = (hsize_t)dim0; /* Dataspace dimensions */ + unsigned u; /* Local index variable */ + unsigned chunk_opts; /* Chunk options */ + unsigned disable_partial_chunk_filters; /* Whether filters are disabled on partial chunks */ + DATATYPE *data_read = NULL; /* data buffer */ + DATATYPE *data_orig = NULL; /* expected data buffer */ const char *filename; MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; int mpi_size, mpi_rank; herr_t ret; /* Generic return value */ - filename = (const char *)params; + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Collective chunked dataset read test on file %s\n", filename); @@ -3095,7 +2163,7 @@ compress_readAll(const void *params) * dataset with the exception that one processor selects no element. */ -void +static void none_selection_chunk(const void *params) { hid_t fid; /* HDF5 file ID */ @@ -3124,7 +2192,7 @@ none_selection_chunk(const void *params) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = (const char *)params; + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -3294,992 +2362,13 @@ none_selection_chunk(const void *params) free(data_array); } -/* Function: test_actual_io_mode - * - * Purpose: tests one specific case of collective I/O and checks that the - * actual_chunk_opt_mode property and the actual_io_mode - * properties in the DXPL have the correct values. - * - * Input: selection_mode: changes the way processes select data from the space, as well - * as some dxpl flags to get collective I/O to break in different ways. - * - * The relevant I/O function and expected response for each mode: - * TEST_ACTUAL_IO_MULTI_CHUNK_IND: - * H5D_mpi_chunk_collective_io, each process reports independent I/O - * - * TEST_ACTUAL_IO_MULTI_CHUNK_COL: - * H5D_mpi_chunk_collective_io, each process reports collective I/O - * - * TEST_ACTUAL_IO_MULTI_CHUNK_MIX: - * H5D_mpi_chunk_collective_io, each process reports mixed I/O - * - * TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE: - * H5D_mpi_chunk_collective_io, processes disagree. The root reports - * collective, the rest report independent I/O - * - * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: - * Same test TEST_ACTUAL_IO_MULTI_CHUNK_IND. - * Set directly go to multi-chunk-io without num threshold calc. - * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL: - * Same test TEST_ACTUAL_IO_MULTI_CHUNK_COL. - * Set directly go to multi-chunk-io without num threshold calc. - * - * TEST_ACTUAL_IO_LINK_CHUNK: - * H5D_link_chunk_collective_io, processes report linked chunk I/O - * - * TEST_ACTUAL_IO_CONTIGUOUS: - * H5D__contig_collective_write or H5D__contig_collective_read - * each process reports contiguous collective I/O - * - * TEST_ACTUAL_IO_NO_COLLECTIVE: - * Simple independent I/O. This tests that the defaults are properly set. - * - * TEST_ACTUAL_IO_RESET: - * Performs collective and then independent I/O with the same dxpl to - * make sure the property is correctly reset to the default on each use. - * Specifically, this test runs TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE - * (The most complex case that works on all builds) and then performs - * an independent read and write with the same dxpls. - * - * Note: DIRECT_MULTI_CHUNK_MIX and DIRECT_MULTI_CHUNK_MIX_DISAGREE - * is not needed as they are covered by DIRECT_CHUNK_MIX and - * MULTI_CHUNK_MIX_DISAGREE cases. _DIRECT_ cases are only for testing - * path way to multi-chunk-io by H5FD_MPIO_CHUNK_MULTI_IO instead of num-threshold. - */ -static void -test_actual_io_mode(int selection_mode) -{ - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - H5D_mpio_actual_io_mode_t actual_io_mode_write = H5D_MPIO_NO_COLLECTIVE; - H5D_mpio_actual_io_mode_t actual_io_mode_read = H5D_MPIO_NO_COLLECTIVE; - H5D_mpio_actual_io_mode_t actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; - const char *filename; - const char *test_name; - bool direct_multi_chunk_io; - bool multi_chunk_io; - bool is_chunked; - bool is_collective; - int mpi_size = -1; - int mpi_rank = -1; - int length; - int *buffer; - int i; - MPI_Comm mpi_comm = MPI_COMM_NULL; - MPI_Info mpi_info = MPI_INFO_NULL; - hid_t fid = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hid_t dataset = H5I_INVALID_HID; - hid_t data_type = H5T_NATIVE_INT; - hid_t fapl_id = H5I_INVALID_HID; - hid_t mem_space = H5I_INVALID_HID; - hid_t file_space = H5I_INVALID_HID; - hid_t dcpl = H5I_INVALID_HID; - hid_t dxpl_write = H5I_INVALID_HID; - hid_t dxpl_read = H5I_INVALID_HID; - hsize_t dims[MAX_RANK]; - hsize_t chunk_dims[MAX_RANK]; - hsize_t start[MAX_RANK]; - hsize_t stride[MAX_RANK]; - hsize_t count[MAX_RANK]; - hsize_t block[MAX_RANK]; - char message[256]; - herr_t ret; - - /* Set up some flags to make some future if statements slightly more readable */ - direct_multi_chunk_io = (selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND || - selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); - - /* Note: RESET performs the same tests as MULTI_CHUNK_MIX_DISAGREE and then - * tests independent I/O - */ - multi_chunk_io = - (selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_IND || - selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_COL || - selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX || - selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE || selection_mode == TEST_ACTUAL_IO_RESET); - - is_chunked = - (selection_mode != TEST_ACTUAL_IO_CONTIGUOUS && selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE); - - is_collective = selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE; - - /* Set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - MPI_Barrier(test_comm); - - assert(mpi_size >= 1); - - mpi_comm = test_comm; - mpi_info = MPI_INFO_NULL; - - filename = (const char *)GetTestParameters(); - assert(filename != NULL); - - /* Setup the file access template */ - fapl_id = create_faccess_plist(mpi_comm, mpi_info, facc_type); - VRFY((fapl_id >= 0), "create_faccess_plist() succeeded"); - - /* Create the file */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - VRFY((fid >= 0), "H5Fcreate succeeded"); - - /* Create the basic Space */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - sid = H5Screate_simple(MAX_RANK, dims, NULL); - VRFY((sid >= 0), "H5Screate_simple succeeded"); - - /* Create the dataset creation plist */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dcpl >= 0), "dataset creation plist created successfully"); - - /* If we are not testing contiguous datasets */ - if (is_chunked) { - /* Set up chunk information. */ - chunk_dims[0] = dims[0] / (hsize_t)mpi_size; - chunk_dims[1] = dims[1]; - ret = H5Pset_chunk(dcpl, 2, chunk_dims); - VRFY((ret >= 0), "chunk creation property list succeeded"); - } - - /* Create the dataset */ - dataset = H5Dcreate2(fid, "actual_io", data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded"); - - /* Create the file dataspace */ - file_space = H5Dget_space(dataset); - VRFY((file_space >= 0), "H5Dget_space succeeded"); - - /* Choose a selection method based on the type of I/O we want to occur, - * and also set up some selection-dependeent test info. */ - switch (selection_mode) { - - /* Independent I/O with optimization */ - case TEST_ACTUAL_IO_MULTI_CHUNK_IND: - case TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: - /* Since the dataset is chunked by row and each process selects a row, - * each process writes to a different chunk. This forces all I/O to be - * independent. - */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - test_name = "Multi Chunk - Independent"; - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; - actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; - break; - - /* Collective I/O with optimization */ - case TEST_ACTUAL_IO_MULTI_CHUNK_COL: - case TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL: - /* The dataset is chunked by rows, so each process takes a column which - * spans all chunks. Since the processes write non-overlapping regular - * selections to each chunk, the operation is purely collective. - */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - test_name = "Multi Chunk - Collective"; - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; - if (mpi_size > 1) - actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; - else - actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; - break; - - /* Mixed I/O with optimization */ - case TEST_ACTUAL_IO_MULTI_CHUNK_MIX: - /* A chunk will be assigned collective I/O only if it is selected by each - * process. To get mixed I/O, have the root select all chunks and each - * subsequent process select the first and nth chunk. The first chunk, - * accessed by all, will be assigned collective I/O while each other chunk - * will be accessed only by the root and the nth process and will be - * assigned independent I/O. Each process will access one chunk collectively - * and at least one chunk independently, reporting mixed I/O. - */ - - if (mpi_rank == 0) { - /* Select the first column */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - } - else { - /* Select the first and the nth chunk in the nth column */ - block[0] = (hsize_t)(dim0 / mpi_size); - block[1] = (hsize_t)(dim1 / mpi_size); - count[0] = 2; - count[1] = 1; - stride[0] = (hsize_t)mpi_rank * block[0]; - stride[1] = 1; - start[0] = 0; - start[1] = (hsize_t)mpi_rank * block[1]; - } - - test_name = "Multi Chunk - Mixed"; - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; - actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED; - break; - - /* RESET tests that the properties are properly reset to defaults each time I/O is - * performed. To achieve this, we have RESET perform collective I/O (which would change - * the values from the defaults) followed by independent I/O (which should report the - * default values). RESET doesn't need to have a unique selection, so we reuse - * MULTI_CHUMK_MIX_DISAGREE, which was chosen because it is a complex case that works - * on all builds. The independent section of RESET can be found at the end of this function. - */ - case TEST_ACTUAL_IO_RESET: - - /* Mixed I/O with optimization and internal disagreement */ - case TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE: - /* A chunk will be assigned collective I/O only if it is selected by each - * process. To get mixed I/O with disagreement, assign process n to the - * first chunk and the nth chunk. The first chunk, selected by all, is - * assgigned collective I/O, while each other process gets independent I/O. - * Since the root process with only access the first chunk, it will report - * collective I/O. The subsequent processes will access the first chunk - * collectively, and their other chunk independently, reporting mixed I/O. - */ - - if (mpi_rank == 0) { - /* Select the first chunk in the first column */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - block[0] = block[0] / (hsize_t)mpi_size; - } - else { - /* Select the first and the nth chunk in the nth column */ - block[0] = (hsize_t)(dim0 / mpi_size); - block[1] = (hsize_t)(dim1 / mpi_size); - count[0] = 2; - count[1] = 1; - stride[0] = (hsize_t)mpi_rank * block[0]; - stride[1] = 1; - start[0] = 0; - start[1] = (hsize_t)mpi_rank * block[1]; - } - - /* If the testname was not already set by the RESET case */ - if (selection_mode == TEST_ACTUAL_IO_RESET) - test_name = "RESET"; - else - test_name = "Multi Chunk - Mixed (Disagreement)"; - - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; - if (mpi_size > 1) { - if (mpi_rank == 0) - actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; - else - actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED; - } - else - actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; - - break; - - /* Linked Chunk I/O */ - case TEST_ACTUAL_IO_LINK_CHUNK: - /* Nothing special; link chunk I/O is forced in the dxpl settings. */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - test_name = "Link Chunk"; - actual_chunk_opt_mode_expected = H5D_MPIO_LINK_CHUNK; - actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; - break; - - /* Contiguous Dataset */ - case TEST_ACTUAL_IO_CONTIGUOUS: - /* A non overlapping, regular selection in a contiguous dataset leads to - * collective I/O */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - test_name = "Contiguous"; - actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - actual_io_mode_expected = H5D_MPIO_CONTIGUOUS_COLLECTIVE; - break; - - case TEST_ACTUAL_IO_NO_COLLECTIVE: - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - test_name = "Independent"; - actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; - break; - - default: - test_name = "Undefined Selection Mode"; - actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; - break; - } - - ret = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* Create a memory dataspace mirroring the dataset and select the same hyperslab - * as in the file space. - */ - mem_space = H5Screate_simple(MAX_RANK, dims, NULL); - VRFY((mem_space >= 0), "mem_space created"); - - ret = H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* Get the number of elements in the selection */ - length = dim0 * dim1; - - /* Allocate and initialize the buffer */ - buffer = (int *)malloc(sizeof(int) * (size_t)length); - VRFY((buffer != NULL), "malloc of buffer succeeded"); - for (i = 0; i < length; i++) - buffer[i] = i; - - /* Set up the dxpl for the write */ - dxpl_write = H5Pcreate(H5P_DATASET_XFER); - VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - - /* Set collective I/O properties in the dxpl. */ - if (is_collective) { - /* Request collective I/O */ - ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - /* Set the threshold number of processes per chunk to twice mpi_size. - * This will prevent the threshold from ever being met, thus forcing - * multi chunk io instead of link chunk io. - * This is via default. - */ - if (multi_chunk_io) { - /* force multi-chunk-io by threshold */ - ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl_write, (unsigned)mpi_size * 2); - VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_num succeeded"); - - /* set this to manipulate testing scenario about allocating processes - * to chunks */ - ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl_write, (unsigned)99); - VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_ratio succeeded"); - } - - /* Set directly go to multi-chunk-io without threshold calc. */ - if (direct_multi_chunk_io) { - /* set for multi chunk io by property*/ - ret = H5Pset_dxpl_mpio_chunk_opt(dxpl_write, H5FD_MPIO_CHUNK_MULTI_IO); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - } - } - - /* Make a copy of the dxpl to test the read operation */ - dxpl_read = H5Pcopy(dxpl_write); - VRFY((dxpl_read >= 0), "H5Pcopy succeeded"); - - /* Write */ - ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl_write, buffer); - if (ret < 0) - H5Eprint2(H5E_DEFAULT, stdout); - VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); - - /* Retrieve Actual io values */ - ret = H5Pget_mpio_actual_io_mode(dxpl_write, &actual_io_mode_write); - VRFY((ret >= 0), "retrieving actual io mode succeeded"); - - ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_write, &actual_chunk_opt_mode_write); - VRFY((ret >= 0), "retrieving actual chunk opt mode succeeded"); - - /* Read */ - ret = H5Dread(dataset, data_type, mem_space, file_space, dxpl_read, buffer); - if (ret < 0) - H5Eprint2(H5E_DEFAULT, stdout); - VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - - /* Retrieve Actual io values */ - ret = H5Pget_mpio_actual_io_mode(dxpl_read, &actual_io_mode_read); - VRFY((ret >= 0), "retrieving actual io mode succeeded"); - - ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_read, &actual_chunk_opt_mode_read); - VRFY((ret >= 0), "retrieving actual chunk opt mode succeeded"); - - /* Check write vs read */ - VRFY((actual_io_mode_read == actual_io_mode_write), - "reading and writing are the same for actual_io_mode"); - VRFY((actual_chunk_opt_mode_read == actual_chunk_opt_mode_write), - "reading and writing are the same for actual_chunk_opt_mode"); - - /* Test values */ - if (actual_chunk_opt_mode_expected != (H5D_mpio_actual_chunk_opt_mode_t)-1 && - actual_io_mode_expected != (H5D_mpio_actual_io_mode_t)-1) { - snprintf(message, sizeof(message), "Actual Chunk Opt Mode has the correct value for %s.\n", - test_name); - VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message); - snprintf(message, sizeof(message), "Actual IO Mode has the correct value for %s.\n", test_name); - VRFY((actual_io_mode_write == actual_io_mode_expected), message); - } - else { - fprintf(stderr, "%s %d -> (%d,%d)\n", test_name, mpi_rank, actual_chunk_opt_mode_write, - actual_io_mode_write); - } - - /* To test that the property is successfully reset to the default, we perform some - * independent I/O after the collective I/O - */ - if (selection_mode == TEST_ACTUAL_IO_RESET) { - if (mpi_rank == 0) { - /* Switch to independent io */ - ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_INDEPENDENT); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - ret = H5Pset_dxpl_mpio(dxpl_read, H5FD_MPIO_INDEPENDENT); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - /* Write */ - ret = H5Dwrite(dataset, data_type, H5S_ALL, H5S_ALL, dxpl_write, buffer); - VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); - - /* Check Properties */ - ret = H5Pget_mpio_actual_io_mode(dxpl_write, &actual_io_mode_write); - VRFY((ret >= 0), "retrieving actual io mode succeeded"); - ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_write, &actual_chunk_opt_mode_write); - VRFY((ret >= 0), "retrieving actual chunk opt mode succeeded"); - - VRFY(actual_chunk_opt_mode_write == H5D_MPIO_NO_CHUNK_OPTIMIZATION, - "actual_chunk_opt_mode has correct value for reset write (independent)"); - VRFY(actual_io_mode_write == H5D_MPIO_NO_COLLECTIVE, - "actual_io_mode has correct value for reset write (independent)"); - - /* Read */ - ret = H5Dread(dataset, data_type, H5S_ALL, H5S_ALL, dxpl_read, buffer); - VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); - - /* Check Properties */ - ret = H5Pget_mpio_actual_io_mode(dxpl_read, &actual_io_mode_read); - VRFY((ret >= 0), "retrieving actual io mode succeeded"); - ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_read, &actual_chunk_opt_mode_read); - VRFY((ret >= 0), "retrieving actual chunk opt mode succeeded"); - - VRFY(actual_chunk_opt_mode_read == H5D_MPIO_NO_CHUNK_OPTIMIZATION, - "actual_chunk_opt_mode has correct value for reset read (independent)"); - VRFY(actual_io_mode_read == H5D_MPIO_NO_COLLECTIVE, - "actual_io_mode has correct value for reset read (independent)"); - } - } - - /* Release some resources */ - ret = H5Sclose(sid); - ret = H5Pclose(fapl_id); - ret = H5Pclose(dcpl); - ret = H5Pclose(dxpl_write); - ret = H5Pclose(dxpl_read); - ret = H5Dclose(dataset); - ret = H5Sclose(mem_space); - ret = H5Sclose(file_space); - ret = H5Fclose(fid); - free(buffer); - return; -} - -/* Function: actual_io_mode_tests - * - * Purpose: Tests all possible cases of the actual_io_mode property. - */ -void -actual_io_mode_tests(void) -{ - int mpi_size = -1; - int mpi_rank = -1; - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_size(test_comm, &mpi_rank); - - test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); - - /* - * Test multi-chunk-io via proc_num threshold - */ - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_COL); - - /* The Multi Chunk Mixed test requires at least three processes. */ - if (mpi_size > 2) - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX); - else - fprintf(stdout, "Multi Chunk Mixed test requires 3 processes minimum\n"); - - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); - - /* - * Test multi-chunk-io via setting direct property - */ - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); - - test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK); - test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS); - - test_actual_io_mode(TEST_ACTUAL_IO_RESET); - return; -} - -/* - * Function: test_no_collective_cause_mode - * - * Purpose: - * tests cases for broken collective I/O and checks that the - * H5Pget_mpio_no_collective_cause properties in the DXPL have the correct values. - * - * Input: - * selection_mode: various mode to cause broken collective I/O - * Note: Originally, each TEST case is supposed to be used alone. - * After some discussion, this is updated to take multiple TEST cases - * with '|'. However there is no error check for any of combined - * test cases, so a tester is responsible to understand and feed - * proper combination of TESTs if needed. - * - * - * TEST_COLLECTIVE: - * Test for regular collective I/O without cause of breaking. - * Just to test normal behavior. - * - * TEST_SET_INDEPENDENT: - * Test for Independent I/O as the cause of breaking collective I/O. - * - * TEST_DATATYPE_CONVERSION: - * Test for Data Type Conversion as the cause of breaking collective I/O. - * - * TEST_DATA_TRANSFORMS: - * Test for Data Transform feature as the cause of breaking collective I/O. - * - * TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES: - * Test for NULL dataspace as the cause of breaking collective I/O. - * - * TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT: - * Test for Compact layout as the cause of breaking collective I/O. - * - * TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL: - * Test for Externl-File storage as the cause of breaking collective I/O. - */ -#define FILE_EXTERNAL "nocolcause_extern.data" -static void -test_no_collective_cause_mode(int selection_mode) -{ - uint32_t no_collective_cause_local_write = 0; - uint32_t no_collective_cause_local_read = 0; - uint32_t no_collective_cause_local_expected = 0; - uint32_t no_collective_cause_global_write = 0; - uint32_t no_collective_cause_global_read = 0; - uint32_t no_collective_cause_global_expected = 0; - // hsize_t coord[NELM][MAX_RANK]; - - uint32_t no_selection_io_cause_write = 0; - uint32_t no_selection_io_cause_read = 0; - uint32_t no_selection_io_cause_expected = 0; - - const char *filename; - const char *test_name; - bool is_chunked = 1; - bool is_independent = 0; - int mpi_size = -1; - int mpi_rank = -1; - int length; - int *buffer; - int i; - MPI_Comm mpi_comm; - MPI_Info mpi_info; - hid_t fid = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hid_t dataset = H5I_INVALID_HID; - hid_t data_type = H5T_NATIVE_INT; - hid_t fapl_id = H5I_INVALID_HID; - hid_t dcpl = H5I_INVALID_HID; - hid_t dxpl_write = H5I_INVALID_HID; - hid_t dxpl_read = H5I_INVALID_HID; - hsize_t dims[MAX_RANK]; - hid_t mem_space = H5I_INVALID_HID; - hid_t file_space = H5I_INVALID_HID; - hsize_t chunk_dims[MAX_RANK]; - herr_t ret; - /* set to global value as default */ - int l_facc_type = facc_type; - char message[256]; - - /* Set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - MPI_Barrier(test_comm); - - assert(mpi_size >= 1); - - mpi_comm = test_comm; - mpi_info = MPI_INFO_NULL; - - /* Create the dataset creation plist */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dcpl >= 0), "dataset creation plist created successfully"); - - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT) { - ret = H5Pset_layout(dcpl, H5D_COMPACT); - VRFY((ret >= 0), "set COMPACT layout succeeded"); - is_chunked = 0; - } - - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) { - ret = H5Pset_external(dcpl, FILE_EXTERNAL, 0, H5F_UNLIMITED); - VRFY((ret >= 0), "set EXTERNAL file layout succeeded"); - is_chunked = 0; - } - - if (selection_mode & TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES) { - sid = H5Screate(H5S_NULL); - VRFY((sid >= 0), "H5Screate_simple succeeded"); - is_chunked = 0; - } - else { - /* Create the basic Space */ - /* if this is a compact dataset, create a small dataspace that does not exceed 64K */ - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT) { - dims[0] = BIG_X_FACTOR * 6; - dims[1] = BIG_Y_FACTOR * 6; - } - else { - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - } - sid = H5Screate_simple(MAX_RANK, dims, NULL); - VRFY((sid >= 0), "H5Screate_simple succeeded"); - } - - filename = (const char *)GetTestParameters(); - assert(filename != NULL); - - /* Setup the file access template */ - fapl_id = create_faccess_plist(mpi_comm, mpi_info, l_facc_type); - VRFY((fapl_id >= 0), "create_faccess_plist() succeeded"); - - /* Create the file */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - - VRFY((fid >= 0), "H5Fcreate succeeded"); - - /* If we are not testing contiguous datasets */ - if (is_chunked) { - /* Set up chunk information. */ - chunk_dims[0] = dims[0] / (hsize_t)mpi_size; - chunk_dims[1] = dims[1]; - ret = H5Pset_chunk(dcpl, 2, chunk_dims); - VRFY((ret >= 0), "chunk creation property list succeeded"); - } - - /* Create the dataset */ - dataset = H5Dcreate2(fid, "nocolcause", data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded"); - - /* Set up the dxpl for the write */ - dxpl_write = H5Pcreate(H5P_DATASET_XFER); - VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - - /* - * Set expected causes and some tweaks based on the type of test - */ - if (selection_mode & TEST_DATATYPE_CONVERSION) { - test_name = "Broken Collective I/O - Datatype Conversion"; - - /* set different sign to trigger type conversion */ - data_type = H5T_NATIVE_UINT; - - /* Disable selection I/O since datatype conversion is supported in collective with selection I/O */ - ret = H5Pset_selection_io(dxpl_write, H5D_SELECTION_IO_MODE_OFF); - VRFY((ret >= 0), "H5Pset_selection_io succeeded"); - - no_collective_cause_local_expected |= H5D_MPIO_DATATYPE_CONVERSION | H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected |= H5D_MPIO_DATATYPE_CONVERSION | H5D_MPIO_NO_SELECTION_IO; - no_selection_io_cause_expected |= H5D_SEL_IO_DISABLE_BY_API; - } - - if (selection_mode & TEST_DATA_TRANSFORMS) { - test_name = "Broken Collective I/O - DATA Transforms"; - - /* Set transform */ - ret = H5Pset_data_transform(dxpl_write, "x+1"); - VRFY((ret >= 0), "H5Pset_data_transform succeeded"); - - /* Disable selection I/O since data transforms are supported in collective with selection I/O */ - ret = H5Pset_selection_io(dxpl_write, H5D_SELECTION_IO_MODE_OFF); - VRFY((ret >= 0), "H5Pset_selection_io succeeded"); - - no_collective_cause_local_expected |= H5D_MPIO_DATA_TRANSFORMS | H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected |= H5D_MPIO_DATA_TRANSFORMS | H5D_MPIO_NO_SELECTION_IO; - no_selection_io_cause_expected |= H5D_SEL_IO_DISABLE_BY_API; - } - - if (selection_mode & TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES) { - test_name = "Broken Collective I/O - No Simple or Scalar DataSpace"; - no_collective_cause_local_expected |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES; - no_collective_cause_global_expected |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES; - no_collective_cause_local_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - } - - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT || - selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) { - test_name = "Broken Collective I/O - No CONTI or CHUNKED Dataset"; - no_collective_cause_local_expected |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; - no_collective_cause_global_expected |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; - no_collective_cause_local_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - } - - if (selection_mode & TEST_COLLECTIVE) { - test_name = "Broken Collective I/O - Not Broken"; - no_collective_cause_local_expected = H5D_MPIO_COLLECTIVE; - no_collective_cause_global_expected = H5D_MPIO_COLLECTIVE; - } - - if (selection_mode & TEST_SET_INDEPENDENT) { - test_name = "Broken Collective I/O - Independent"; - no_collective_cause_local_expected = H5D_MPIO_SET_INDEPENDENT; - no_collective_cause_global_expected = H5D_MPIO_SET_INDEPENDENT; - no_collective_cause_local_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - /* switch to independent io */ - is_independent = 1; - } - - /* use all spaces for certain tests */ - if (selection_mode & TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES || - selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) { - file_space = H5S_ALL; - mem_space = H5S_ALL; - } - else { - /* Get the file dataspace */ - file_space = H5Dget_space(dataset); - VRFY((file_space >= 0), "H5Dget_space succeeded"); - - /* Create the memory dataspace */ - mem_space = H5Screate_simple(MAX_RANK, dims, NULL); - VRFY((mem_space >= 0), "mem_space created"); - } - - /* Get the number of elements in the selection */ - H5_CHECKED_ASSIGN(length, int, dims[0] * dims[1], hsize_t); - - /* Allocate and initialize the buffer */ - buffer = (int *)malloc(sizeof(int) * (size_t)length); - VRFY((buffer != NULL), "malloc of buffer succeeded"); - for (i = 0; i < length; i++) - buffer[i] = i; - - if (is_independent) { - /* Set Independent I/O */ - ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_INDEPENDENT); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - } - else { - /* Set Collective I/O */ - ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - } - - /*--------------------- - * Test Write access - *---------------------*/ - - /* Write */ - ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl_write, buffer); - if (ret < 0) - H5Eprint2(H5E_DEFAULT, stdout); - VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); - - /* Get the cause of broken collective I/O */ - ret = H5Pget_mpio_no_collective_cause(dxpl_write, &no_collective_cause_local_write, - &no_collective_cause_global_write); - VRFY((ret >= 0), "retrieving no collective cause succeeded"); - - ret = H5Pget_no_selection_io_cause(dxpl_write, &no_selection_io_cause_write); - VRFY((ret >= 0), "retrieving no selection io cause succeeded"); - - if (no_collective_cause_local_write & H5D_MPIO_NO_SELECTION_IO) { - VRFY((no_selection_io_cause_write == no_selection_io_cause_expected), - "H5D_MPIO_NO_SELECTION_IO for write is as expected"); - } - - if (no_collective_cause_global_write & H5D_MPIO_NO_SELECTION_IO) { - - VRFY((no_selection_io_cause_write == no_selection_io_cause_expected), - "H5D_MPIO_NO_SELECTION_IO for write is as expected"); - } - - /*--------------------- - * Test Read access - *---------------------*/ - - /* Make a copy of the dxpl to test the read operation */ - dxpl_read = H5Pcopy(dxpl_write); - VRFY((dxpl_read >= 0), "H5Pcopy succeeded"); - - /* Read */ - ret = H5Dread(dataset, data_type, mem_space, file_space, dxpl_read, buffer); - - if (ret < 0) - H5Eprint2(H5E_DEFAULT, stdout); - VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - - /* Get the cause of broken collective I/O */ - ret = H5Pget_mpio_no_collective_cause(dxpl_read, &no_collective_cause_local_read, - &no_collective_cause_global_read); - VRFY((ret >= 0), "retrieving no collective cause succeeded"); - - ret = H5Pget_no_selection_io_cause(dxpl_read, &no_selection_io_cause_read); - VRFY((ret >= 0), "retrieving no selection io cause succeeded"); - - if (no_collective_cause_local_read & H5D_MPIO_NO_SELECTION_IO) { - - VRFY((no_selection_io_cause_read == no_selection_io_cause_expected), - "H5D_MPIO_NO_SELECTION_IO for read is as expected"); - } - - if (no_collective_cause_global_read & H5D_MPIO_NO_SELECTION_IO) { - - VRFY((no_selection_io_cause_read == no_selection_io_cause_expected), - "H5D_MPIO_NO_SELECTION_IO for read is as expected"); - } - - /* Check write vs read */ - VRFY((no_collective_cause_local_read == no_collective_cause_local_write), - "reading and writing are the same for local cause of Broken Collective I/O"); - VRFY((no_collective_cause_global_read == no_collective_cause_global_write), - "reading and writing are the same for global cause of Broken Collective I/O"); - - /* Test values */ - memset(message, 0, sizeof(message)); - snprintf(message, sizeof(message), "Local cause of Broken Collective I/O has the correct value for %s.\n", - test_name); - VRFY((no_collective_cause_local_write == no_collective_cause_local_expected), message); - memset(message, 0, sizeof(message)); - snprintf(message, sizeof(message), - "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name); - VRFY((no_collective_cause_global_write == no_collective_cause_global_expected), message); - - /* Release some resources */ - if (sid) - H5Sclose(sid); - if (fapl_id) - H5Pclose(fapl_id); - if (dcpl) - H5Pclose(dcpl); - if (dxpl_write) - H5Pclose(dxpl_write); - if (dxpl_read) - H5Pclose(dxpl_read); - if (dataset) - H5Dclose(dataset); - if (mem_space) - H5Sclose(mem_space); - if (file_space) - H5Sclose(file_space); - if (fid) - H5Fclose(fid); - free(buffer); - - /* clean up external file */ - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) - HDremove(FILE_EXTERNAL); - - return; -} - -/* Function: no_collective_cause_tests - * - * Purpose: Tests cases for broken collective IO. - */ -void -no_collective_cause_tests(void) -{ - /* - * Test individual cause - */ - test_no_collective_cause_mode(TEST_COLLECTIVE); - test_no_collective_cause_mode(TEST_SET_INDEPENDENT); - test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION); - test_no_collective_cause_mode(TEST_DATA_TRANSFORMS); - test_no_collective_cause_mode(TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL); - - /* - * Test combined causes - */ - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION); - test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION | - TEST_DATA_TRANSFORMS); - - return; -} - -/* Function: dense_attr_test - * - * Purpose: Test cases for writing dense attributes in parallel - */ -void -test_dense_attr(void) -{ - int mpi_size, mpi_rank; - hid_t fpid, fid; - hid_t gid, gpid; - hid_t atFileSpace, atid; - hsize_t atDims[1] = {10000}; - herr_t status; - const char *filename; - - /* get filename */ - filename = (const char *)GetTestParameters(); - assert(filename != NULL); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - fpid = H5Pcreate(H5P_FILE_ACCESS); - VRFY((fpid > 0), "H5Pcreate succeeded"); - status = H5Pset_libver_bounds(fpid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - VRFY((status >= 0), "H5Pset_libver_bounds succeeded"); - status = H5Pset_fapl_mpio(fpid, test_comm, MPI_INFO_NULL); - VRFY((status >= 0), "H5Pset_fapl_mpio succeeded"); - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fpid); - VRFY((fid > 0), "H5Fcreate succeeded"); - status = H5Pclose(fpid); - VRFY((status >= 0), "H5Pclose succeeded"); - - gpid = H5Pcreate(H5P_GROUP_CREATE); - VRFY((gpid > 0), "H5Pcreate succeeded"); - status = H5Pset_attr_phase_change(gpid, 0, 0); - VRFY((status >= 0), "H5Pset_attr_phase_change succeeded"); - gid = H5Gcreate2(fid, "foo", H5P_DEFAULT, gpid, H5P_DEFAULT); - VRFY((gid > 0), "H5Gcreate2 succeeded"); - status = H5Pclose(gpid); - VRFY((status >= 0), "H5Pclose succeeded"); - - atFileSpace = H5Screate_simple(1, atDims, NULL); - VRFY((atFileSpace > 0), "H5Screate_simple succeeded"); - atid = H5Acreate2(gid, "bar", H5T_STD_U64LE, atFileSpace, H5P_DEFAULT, H5P_DEFAULT); - VRFY((atid > 0), "H5Acreate succeeded"); - status = H5Sclose(atFileSpace); - VRFY((status >= 0), "H5Sclose succeeded"); - - status = H5Aclose(atid); - VRFY((status >= 0), "H5Aclose succeeded"); - - status = H5Gclose(gid); - VRFY((status >= 0), "H5Gclose succeeded"); - status = H5Fclose(fid); - VRFY((status >= 0), "H5Fclose succeeded"); - - return; -} - int main(int argc, char **argv) { - int express_test; - int mpi_size, mpi_rank; /* mpi variables */ - hsize_t oldsize, newsize = 1048576; + test_params_t test_params; + int express_test; + int mpi_size, mpi_rank; /* mpi variables */ + hsize_t oldsize, newsize = 1048576; #ifndef H5_HAVE_WIN32_API /* Un-buffer the stdout and stderr */ @@ -4291,8 +2380,6 @@ main(int argc, char **argv) MPI_Comm_size(test_comm, &mpi_size); MPI_Comm_rank(test_comm, &mpi_rank); - mpi_rank_framework_g = mpi_rank; - memset(filenames, 0, sizeof(filenames)); dim0 = BIG_X_FACTOR; @@ -4337,37 +2424,39 @@ main(int argc, char **argv) /* Initialize testing framework */ if (mpi_rank < 2) { - if (TestInit(argv[0], usage, parse_options) < 0) { + if (TestInit(argv[0], usage, parse_options, mpi_rank) < 0) { fprintf(stderr, "couldn't initialize testing framework\n"); MPI_Abort(MPI_COMM_WORLD, -1); } - /* Parse command line arguments */ - if (TestParseCmdLine(argc, argv) < 0) { - fprintf(stderr, "couldn't parse command-line arguments\n"); - TestShutdown(); - MPI_Abort(MPI_COMM_WORLD, -1); - } + test_params.filename = PARATESTFILE; - AddTest("idsetw", dataset_writeInd, NULL, NULL, PARATESTFILE, sizeof(char *), "dataset independent write"); + AddTest("idsetw", dataset_writeInd, NULL, NULL, &test_params, sizeof(test_params), "dataset independent write"); - AddTest("idsetr", dataset_readInd, NULL, NULL, PARATESTFILE, sizeof(char *), "dataset independent read"); + AddTest("idsetr", dataset_readInd, NULL, NULL, &test_params, sizeof(test_params), "dataset independent read"); - AddTest("cdsetw", dataset_writeAll, NULL, NULL, PARATESTFILE, sizeof(char *), "dataset collective write"); + AddTest("cdsetw", dataset_writeAll, NULL, NULL, &test_params, sizeof(test_params), "dataset collective write"); - AddTest("cdsetr", dataset_readAll, NULL, NULL, PARATESTFILE, sizeof(char *), "dataset collective read"); + AddTest("cdsetr", dataset_readAll, NULL, NULL, &test_params, sizeof(test_params), "dataset collective read"); - AddTest("eidsetw2", extend_writeInd2, NULL, NULL, PARATESTFILE, sizeof(char *), "extendible dataset independent write #2"); + AddTest("eidsetw2", extend_writeInd2, NULL, NULL, &test_params, sizeof(test_params), "extendible dataset independent write #2"); - AddTest("selnone", none_selection_chunk, NULL, NULL, PARATESTFILE, sizeof(char *), "chunked dataset with none-selection"); + AddTest("selnone", none_selection_chunk, NULL, NULL, &test_params, sizeof(test_params), "chunked dataset with none-selection"); #ifdef H5_HAVE_FILTER_DEFLATE - AddTest("cmpdsetr", compress_readAll, NULL, NULL, PARATESTFILE, sizeof(char *), "compressed dataset collective read"); + AddTest("cmpdsetr", compress_readAll, NULL, NULL, &test_params, sizeof(test_params), "compressed dataset collective read"); #endif /* H5_HAVE_FILTER_DEFLATE */ /* Display testing information */ TestInfo(stdout); + /* Parse command line arguments */ + if (TestParseCmdLine(argc, argv) < 0) { + fprintf(stderr, "couldn't parse command-line arguments\n"); + TestShutdown(); + MPI_Abort(MPI_COMM_WORLD, -1); + } + /* setup file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(fapl, test_comm, MPI_INFO_NULL); diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index f596207fbce..caded81c5cc 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -50,7 +50,7 @@ const char *FILENAME[3] = {"bigio_test.h5", "single_rank_independent_io.h5", NUL #define POINT 2 #define ALL 3 -/* Dataset data type. Int's can be easily octo dumped. */ +typedef int DATATYPE; typedef hsize_t B_DATATYPE; int facc_type = FACC_MPIO; /*Test file access type */ @@ -115,54 +115,6 @@ fill_datasets(hsize_t start[], hsize_t block[], B_DATATYPE *dataset) } } -/* - * Setup the coordinates for point selection. - */ -void -point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, - hsize_t coords[], int order) -{ - hsize_t i, j, k = 0, m, n, s1, s2; - - HDcompile_assert(RANK == 2); - - if (OUT_OF_ORDER == order) - k = (num_points * RANK) - 1; - else if (IN_ORDER == order) - k = 0; - - s1 = start[0]; - s2 = start[1]; - - for (i = 0; i < count[0]; i++) - for (j = 0; j < count[1]; j++) - for (m = 0; m < block[0]; m++) - for (n = 0; n < block[1]; n++) - if (OUT_OF_ORDER == order) { - coords[k--] = s2 + (stride[1] * j) + n; - coords[k--] = s1 + (stride[0] * i) + m; - } - else if (IN_ORDER == order) { - coords[k++] = s1 + stride[0] * i + m; - coords[k++] = s2 + stride[1] * j + n; - } - - if (VERBOSE_MED) { - printf("start[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " - "count[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " - "stride[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " - "block[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " - "total datapoints=%" PRIuHSIZE "\n", - start[0], start[1], count[0], count[1], stride[0], stride[1], block[0], block[1], - block[0] * block[1] * count[0] * count[1]); - k = 0; - for (i = 0; i < num_points; i++) { - printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); - k += 2; - } - } -} - /* * Print the content of the dataset. */ @@ -1193,59 +1145,6 @@ single_rank_independent_io(void) MPI_Barrier(MPI_COMM_WORLD); } -/* - * Create the appropriate File access property list - */ -hid_t -create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) -{ - hid_t ret_pl = H5I_INVALID_HID; - herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ - - /* need the rank for error checking macros */ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY_G((ret_pl >= 0), "H5P_FILE_ACCESS"); - - if (l_facc_type == FACC_DEFAULT) - return (ret_pl); - - if (l_facc_type == FACC_MPIO) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY_G((ret >= 0), ""); - ret = H5Pset_all_coll_metadata_ops(ret_pl, true); - VRFY_G((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); - VRFY_G((ret >= 0), ""); - return (ret_pl); - } - - if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { - hid_t mpio_pl; - - mpio_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY_G((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY_G((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY_G((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY_G((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return (ret_pl); - } - - /* unknown file access types */ - return (ret_pl); -} - /*------------------------------------------------------------------------- * Function: coll_chunk1 * @@ -1276,7 +1175,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) * ------------------------------------------------------------------------ */ -void +static void coll_chunk1(void) { const char *filename = FILENAME[0]; @@ -1324,7 +1223,7 @@ coll_chunk1(void) * * ------------------------------------------------------------------------ */ -void +static void coll_chunk2(void) { const char *filename = FILENAME[0]; @@ -1373,7 +1272,7 @@ coll_chunk2(void) * ------------------------------------------------------------------------ */ -void +static void coll_chunk3(void) { const char *filename = FILENAME[0]; diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c index 1d5978306a8..202551ff9c8 100644 --- a/testpar/t_chunk_alloc.c +++ b/testpar/t_chunk_alloc.c @@ -456,7 +456,7 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in * it, read to verify all data are as written. */ void -test_chunk_alloc(void) +test_chunk_alloc(const void *params) { const char *filename; hid_t file_id, dataset; @@ -480,7 +480,7 @@ test_chunk_alloc(void) return; } - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend Chunked allocation test on file %s\n", filename); @@ -542,7 +542,7 @@ test_chunk_alloc(void) * fashion. */ void -test_chunk_alloc_incr_ser_to_par(void) +test_chunk_alloc_incr_ser_to_par(const void *params) { H5D_space_status_t space_status; const char *filename; @@ -567,7 +567,7 @@ test_chunk_alloc_incr_ser_to_par(void) MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (MAINPROCESS && VERBOSE_MED) printf("Chunked dataset incremental file space allocation serial to parallel test on file %s\n", filename); diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index fa3459d252f..a02886c7e37 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -64,9 +64,9 @@ static void coll_chunktest(const char *filename, int chunk_factor, int select_fa */ void -coll_chunk1(void) +coll_chunk1(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -126,9 +126,9 @@ coll_chunk1(void) * ------------------------------------------------------------------------ */ void -coll_chunk2(void) +coll_chunk2(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -189,9 +189,9 @@ coll_chunk2(void) */ void -coll_chunk3(void) +coll_chunk3(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_size; int mpi_rank; @@ -254,9 +254,9 @@ coll_chunk3(void) */ void -coll_chunk4(void) +coll_chunk4(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -317,9 +317,9 @@ coll_chunk4(void) */ void -coll_chunk5(void) +coll_chunk5(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -382,9 +382,9 @@ coll_chunk5(void) */ void -coll_chunk6(void) +coll_chunk6(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -445,9 +445,9 @@ coll_chunk6(void) */ void -coll_chunk7(void) +coll_chunk7(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -508,9 +508,9 @@ coll_chunk7(void) */ void -coll_chunk8(void) +coll_chunk8(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -571,9 +571,9 @@ coll_chunk8(void) */ void -coll_chunk9(void) +coll_chunk9(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -634,9 +634,9 @@ coll_chunk9(void) */ void -coll_chunk10(void) +coll_chunk10(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); diff --git a/testpar/t_coll_md.c b/testpar/t_coll_md.c index 043ecf81208..f87e357dc1a 100644 --- a/testpar/t_coll_md.c +++ b/testpar/t_coll_md.c @@ -63,7 +63,7 @@ * arbitrary number (0 was chosen). */ void -test_partial_no_selection_coll_md_read(void) +test_partial_no_selection_coll_md_read(const void *params) { const char *filename; hsize_t *dataset_dims = NULL; @@ -102,7 +102,7 @@ test_partial_no_selection_coll_md_read(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); @@ -262,7 +262,7 @@ test_partial_no_selection_coll_md_read(void) * */ void -test_multi_chunk_io_addrmap_issue(void) +test_multi_chunk_io_addrmap_issue(const void *params) { const char *filename; hsize_t start[MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS]; @@ -297,7 +297,7 @@ test_multi_chunk_io_addrmap_issue(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); @@ -390,7 +390,7 @@ test_multi_chunk_io_addrmap_issue(void) *2096 but expected 320000 major: Internal error (too specific to document in detail) minor: MPI Error String */ void -test_link_chunk_io_sort_chunk_issue(void) +test_link_chunk_io_sort_chunk_issue(const void *params) { const char *filename; hsize_t dataset_dims[LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS]; @@ -427,7 +427,7 @@ test_link_chunk_io_sort_chunk_issue(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); @@ -554,7 +554,7 @@ test_link_chunk_io_sort_chunk_issue(void) * heap data is not correctly mapped as raw data. */ void -test_collective_global_heap_write(void) +test_collective_global_heap_write(const void *params) { const char *filename; hsize_t attr_dims[COLL_GHEAP_WRITE_ATTR_DIMS]; @@ -583,7 +583,7 @@ test_collective_global_heap_write(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); @@ -634,7 +634,7 @@ test_collective_global_heap_write(void) * collective metadata writes are NOT requested. */ void -test_coll_io_ind_md_write(void) +test_coll_io_ind_md_write(const void *params) { const char *filename; long long *data = NULL; @@ -654,7 +654,7 @@ test_coll_io_ind_md_write(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index bf4fcfda1a7..ea9898fa995 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -122,53 +122,6 @@ slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], hsize_t s } } -/* - * Setup the coordinates for point selection. - */ -void -point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, - hsize_t coords[], int order) -{ - hsize_t i, j, k = 0, m, n, s1, s2; - - HDcompile_assert(RANK == 2); - - if (OUT_OF_ORDER == order) - k = (num_points * RANK) - 1; - else if (IN_ORDER == order) - k = 0; - - s1 = start[0]; - s2 = start[1]; - - for (i = 0; i < count[0]; i++) - for (j = 0; j < count[1]; j++) - for (m = 0; m < block[0]; m++) - for (n = 0; n < block[1]; n++) - if (OUT_OF_ORDER == order) { - coords[k--] = s2 + (stride[1] * j) + n; - coords[k--] = s1 + (stride[0] * i) + m; - } - else if (IN_ORDER == order) { - coords[k++] = s1 + stride[0] * i + m; - coords[k++] = s2 + stride[1] * j + n; - } - - if (VERBOSE_MED) { - printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " - "datapoints=%lu\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], - (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], - (unsigned long)block[0], (unsigned long)block[1], - (unsigned long)(block[0] * block[1] * count[0] * count[1])); - k = 0; - for (i = 0; i < num_points; i++) { - printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); - k += 2; - } - } -} - /* * Fill the dataset with trivial data for testing. * Assume dimension rank is 2 and data is stored contiguous. @@ -271,7 +224,7 @@ dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[] */ void -dataset_writeInd(void) +dataset_writeInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -293,7 +246,7 @@ dataset_writeInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Independent write test on file %s\n", filename); @@ -423,7 +376,7 @@ dataset_writeInd(void) /* Example of using the parallel HDF5 library to read a dataset */ void -dataset_readInd(void) +dataset_readInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -444,7 +397,7 @@ dataset_readInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Independent read test on file %s\n", filename); @@ -558,7 +511,7 @@ dataset_readInd(void) */ void -dataset_writeAll(void) +dataset_writeAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -587,7 +540,7 @@ dataset_writeAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Collective write test on file %s\n", filename); @@ -1090,7 +1043,7 @@ dataset_writeAll(void) */ void -dataset_readAll(void) +dataset_readAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1116,7 +1069,7 @@ dataset_readAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Collective read test on file %s\n", filename); @@ -1517,7 +1470,7 @@ dataset_readAll(void) */ void -extend_writeInd(void) +extend_writeInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1543,7 +1496,7 @@ extend_writeInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -1751,7 +1704,7 @@ extend_writeInd(void) */ void -extend_writeInd2(void) +extend_writeInd2(const void *params) { const char *filename; hid_t fid; /* HDF5 file ID */ @@ -1771,7 +1724,7 @@ extend_writeInd2(void) int i; /* Local index variable */ herr_t ret; /* Generic return value */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent write test #2 on file %s\n", filename); @@ -1924,7 +1877,7 @@ extend_writeInd2(void) /* Example of using the parallel HDF5 library to read an extendible dataset */ void -extend_readInd(void) +extend_readInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1947,7 +1900,7 @@ extend_readInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent read test on file %s\n", filename); @@ -2114,7 +2067,7 @@ extend_readInd(void) */ void -extend_writeAll(void) +extend_writeAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -2141,7 +2094,7 @@ extend_writeAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -2367,7 +2320,7 @@ extend_writeAll(void) /* Example of using the parallel HDF5 library to read an extendible dataset */ void -extend_readAll(void) +extend_readAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -2391,7 +2344,7 @@ extend_readAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent read test on file %s\n", filename); @@ -2573,7 +2526,7 @@ extend_readAll(void) */ #ifdef H5_HAVE_FILTER_DEFLATE void -compress_readAll(void) +compress_readAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -2594,7 +2547,7 @@ compress_readAll(void) int mpi_size, mpi_rank; herr_t ret; /* Generic return value */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Collective chunked dataset read test on file %s\n", filename); @@ -2769,7 +2722,7 @@ compress_readAll(void) */ void -none_selection_chunk(void) +none_selection_chunk(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -2797,7 +2750,7 @@ none_selection_chunk(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -3031,7 +2984,7 @@ none_selection_chunk(void) * path way to multi-chunk-io by H5FD_MPIO_CHUNK_MULTI_IO instead of num-threshold. */ static void -test_actual_io_mode(int selection_mode) +test_actual_io_mode(const void *params, int selection_mode) { H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = H5D_MPIO_NO_CHUNK_OPTIMIZATION; H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = H5D_MPIO_NO_CHUNK_OPTIMIZATION; @@ -3111,7 +3064,7 @@ test_actual_io_mode(int selection_mode) mpi_comm = MPI_COMM_WORLD; mpi_info = MPI_INFO_NULL; - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); /* Setup the file access template */ @@ -3484,7 +3437,7 @@ test_actual_io_mode(int selection_mode) * */ void -actual_io_mode_tests(void) +actual_io_mode_tests(const void *params) { H5D_selection_io_mode_t selection_io_mode; hid_t dxpl_id = H5I_INVALID_HID; @@ -3507,32 +3460,32 @@ actual_io_mode_tests(void) VRFY((ret >= 0), "H5Pclose succeeded"); if (selection_io_mode == H5D_SELECTION_IO_MODE_OFF) { - test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); + test_actual_io_mode(params, TEST_ACTUAL_IO_NO_COLLECTIVE); /* * Test multi-chunk-io via proc_num threshold */ - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_COL); + test_actual_io_mode(params, TEST_ACTUAL_IO_MULTI_CHUNK_IND); + test_actual_io_mode(params, TEST_ACTUAL_IO_MULTI_CHUNK_COL); /* The Multi Chunk Mixed test requires at least three processes. */ if (mpi_size > 2) - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX); + test_actual_io_mode(params, TEST_ACTUAL_IO_MULTI_CHUNK_MIX); else fprintf(stdout, "Multi Chunk Mixed test requires 3 processes minimum\n"); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); + test_actual_io_mode(params, TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); /* * Test multi-chunk-io via setting direct property */ - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); + test_actual_io_mode(params, TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); + test_actual_io_mode(params, TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); - test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK); - test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS); + test_actual_io_mode(params, TEST_ACTUAL_IO_LINK_CHUNK); + test_actual_io_mode(params, TEST_ACTUAL_IO_CONTIGUOUS); - test_actual_io_mode(TEST_ACTUAL_IO_RESET); + test_actual_io_mode(params, TEST_ACTUAL_IO_RESET); } return; @@ -3579,7 +3532,7 @@ actual_io_mode_tests(void) */ #define FILE_EXTERNAL "nocolcause_extern.data" static void -test_no_collective_cause_mode(int selection_mode) +test_no_collective_cause_mode(const void *params, int selection_mode) { uint32_t no_collective_cause_local_write = 0; uint32_t no_collective_cause_local_read = 0; @@ -3682,7 +3635,7 @@ test_no_collective_cause_mode(int selection_mode) VRFY((sid >= 0), "H5Screate_simple succeeded"); } - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); /* Setup the file access template */ @@ -3920,7 +3873,7 @@ test_no_collective_cause_mode(int selection_mode) /* clean up external file */ if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) - H5Fdelete(FILE_EXTERNAL, fapl); + HDremove(FILE_EXTERNAL); if (fapl) H5Pclose(fapl); @@ -3934,25 +3887,25 @@ test_no_collective_cause_mode(int selection_mode) * */ void -no_collective_cause_tests(void) +no_collective_cause_tests(const void *params) { /* * Test individual cause */ - test_no_collective_cause_mode(TEST_COLLECTIVE); - test_no_collective_cause_mode(TEST_SET_INDEPENDENT); - test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION); - test_no_collective_cause_mode(TEST_DATA_TRANSFORMS); - test_no_collective_cause_mode(TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL); + test_no_collective_cause_mode(params, TEST_COLLECTIVE); + test_no_collective_cause_mode(params, TEST_SET_INDEPENDENT); + test_no_collective_cause_mode(params, TEST_DATATYPE_CONVERSION); + test_no_collective_cause_mode(params, TEST_DATA_TRANSFORMS); + test_no_collective_cause_mode(params, TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES); + test_no_collective_cause_mode(params, TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT); + test_no_collective_cause_mode(params, TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL); /* * Test combined causes */ - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION); - test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION | + test_no_collective_cause_mode(params, TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION); + test_no_collective_cause_mode(params, TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); + test_no_collective_cause_mode(params, TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); return; @@ -3970,7 +3923,7 @@ no_collective_cause_tests(void) */ void -dataset_atomicity(void) +dataset_atomicity(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -3997,7 +3950,7 @@ dataset_atomicity(void) dim0 = 64; dim1 = 32; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (facc_type != FACC_MPIO) { printf("Atomicity tests will not work without the MPIO VFD\n"); return; @@ -4318,7 +4271,7 @@ dataset_atomicity(void) * */ void -test_dense_attr(void) +test_dense_attr(const void *params) { int mpi_size, mpi_rank; hid_t fpid, fid; @@ -4346,7 +4299,7 @@ test_dense_attr(void) } /* get filename */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); fpid = H5Pcreate(H5P_FILE_ACCESS); diff --git a/testpar/t_file.c b/testpar/t_file.c index acfb45d30a8..1fd4b41e82f 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -57,7 +57,7 @@ static int open_file(const char *filename, hid_t fapl, int metadata_write_strate * sooner or later due to barrier mixed up. */ void -test_split_comm_access(void) +test_split_comm_access(const void *params) { MPI_Comm comm; MPI_Info info = MPI_INFO_NULL; @@ -68,7 +68,7 @@ test_split_comm_access(void) herr_t ret; /* generic return value */ const char *filename; - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Split Communicator access test on file %s\n", filename); @@ -134,7 +134,7 @@ test_split_comm_access(void) } void -test_page_buffer_access(void) +test_page_buffer_access(const void *params) { const char *filename; hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -152,7 +152,7 @@ test_page_buffer_access(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* Until page buffering is supported in parallel in some form (even if * just for a single MPI process), this test just will just check to @@ -790,7 +790,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, hsize_t * multiple opens of the same file. */ void -test_file_properties(void) +test_file_properties(const void *params) { hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ @@ -823,7 +823,7 @@ test_file_properties(void) return; } - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; mpi_ret = MPI_Info_create(&info); VRFY((mpi_ret >= 0), "MPI_Info_create succeeded"); @@ -995,7 +995,7 @@ test_file_properties(void) } /* end test_file_properties() */ void -test_delete(void) +test_delete(const void *params) { hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ @@ -1005,7 +1005,7 @@ test_delete(void) htri_t is_accessible = FAIL; /* Whether a file is accessible */ herr_t ret; /* Generic return value */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -1075,7 +1075,7 @@ test_delete(void) * due to an invalid library version bounds setting */ void -test_invalid_libver_bounds_file_close_assert(void) +test_invalid_libver_bounds_file_close_assert(const void *params) { const char *filename = NULL; MPI_Comm comm = MPI_COMM_WORLD; @@ -1085,7 +1085,7 @@ test_invalid_libver_bounds_file_close_assert(void) hid_t fapl_id = H5I_INVALID_HID; hid_t fcpl_id = H5I_INVALID_HID; - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -1125,7 +1125,7 @@ test_invalid_libver_bounds_file_close_assert(void) * called by multiple ranks. */ void -test_evict_on_close_parallel_unsupp(void) +test_evict_on_close_parallel_unsupp(const void *params) { const char *filename = NULL; MPI_Comm comm = MPI_COMM_WORLD; @@ -1134,7 +1134,7 @@ test_evict_on_close_parallel_unsupp(void) hid_t fapl_id = H5I_INVALID_HID; herr_t ret; - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -1185,7 +1185,7 @@ test_evict_on_close_parallel_unsupp(void) * This is a test program from the user. */ void -test_fapl_preserve_hints(void) +test_fapl_preserve_hints(const void *params) { const char *filename; const char *key = "hdf_info_fapl"; @@ -1203,7 +1203,7 @@ test_fapl_preserve_hints(void) int mpi_ret; /* MPI return value */ herr_t ret; /* Generic return value */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; value_used = malloc(MPI_MAX_INFO_VAL + 1); VRFY(value_used, "malloc succeeded"); diff --git a/testpar/t_file_image.c b/testpar/t_file_image.c index 1790685cfe0..ae1658e47d3 100644 --- a/testpar/t_file_image.c +++ b/testpar/t_file_image.c @@ -58,7 +58,7 @@ * JRM -- 11/28/11 */ void -file_image_daisy_chain_test(void) +file_image_daisy_chain_test(const void H5_ATTR_UNUSED *params) { char file_name[1024] = "\0"; int mpi_size, mpi_rank; diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c index c00d139d08e..e7cd95de672 100644 --- a/testpar/t_filter_read.c +++ b/testpar/t_filter_read.c @@ -192,7 +192,7 @@ filter_read_internal(const char *filename, hid_t dcpl, hsize_t *dset_size) */ void -test_filter_read(void) +test_filter_read(const void *params) { hid_t dc; /* HDF5 IDs */ const hsize_t chunk_size[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */ @@ -220,7 +220,7 @@ test_filter_read(void) hsize_t combo_size; /* Size of dataset with multiple filters */ #endif /* H5_HAVE_FILTER_DEFLATE || H5_HAVE_FILTER_SZIP */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Parallel reading of dataset written with filters %s\n", filename); diff --git a/testpar/t_filters_parallel.h b/testpar/t_filters_parallel.h index 04d36395dbc..f853b779e89 100644 --- a/testpar/t_filters_parallel.h +++ b/testpar/t_filters_parallel.h @@ -24,6 +24,9 @@ #include "stdlib.h" #include "testpar.h" +/* Include testing framework functionality */ +#include "testframe.h" + #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0]) /* Used to load other filters than GZIP */ diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index b9cb4cc5729..55e1758c3a0 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -31,6 +31,9 @@ static int read_attribute(hid_t, int, int); static int check_value(DATATYPE *, DATATYPE *, int); static void get_slab(hsize_t[], hsize_t[], hsize_t[], hsize_t[], int); +static void rr_obj_hdr_flush_confusion_writer(const void *params, MPI_Comm comm); +static void rr_obj_hdr_flush_confusion_reader(const void *params, MPI_Comm comm); + /* * The size value computed by this function is used extensively in * configuring tests for the current number of processes. @@ -72,7 +75,7 @@ get_size(void) * */ void -zero_dim_dset(void) +zero_dim_dset(const void *params) { int mpi_size, mpi_rank; const char *filename; @@ -95,7 +98,7 @@ zero_dim_dset(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((plist >= 0), "create_faccess_plist succeeded"); @@ -141,7 +144,7 @@ zero_dim_dset(void) * a slab of array to the file. */ void -multiple_dset_write(void) +multiple_dset_write(const void *params) { int i, j, n, mpi_size, mpi_rank, size; hid_t iof, plist, dataset, memspace, filespace; @@ -157,7 +160,7 @@ multiple_dset_write(void) char *filename; int ndatasets; - pt = GetTestParameters(); + pt = params; filename = pt->name; ndatasets = pt->count; @@ -235,7 +238,7 @@ multiple_dset_write(void) /* Example of using PHDF5 to create, write, and read compact dataset. */ void -compact_dataset(void) +compact_dataset(const void *params) { int i, j, mpi_size, mpi_rank, size, err_num = 0; hid_t iof, plist, dcpl, dxpl, dataset, filespace; @@ -274,7 +277,7 @@ compact_dataset(void) inme = malloc((size_t)size * (size_t)size * sizeof(double)); VRFY((outme != NULL), "malloc succeeded for inme"); - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; VRFY((mpi_size <= size), "mpi_size <= size"); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); @@ -375,7 +378,7 @@ compact_dataset(void) * of Null dataspace. */ void -null_dataset(void) +null_dataset(const void *params) { int mpi_size, mpi_rank; hid_t iof, plist, dxpl, dataset, attr, sid; @@ -403,7 +406,7 @@ null_dataset(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); iof = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist); @@ -492,7 +495,7 @@ null_dataset(void) * the boundary of interest. */ void -big_dataset(void) +big_dataset(const void *params) { int mpi_size, mpi_rank; /* MPI info */ hid_t iof, /* File ID */ @@ -523,7 +526,7 @@ big_dataset(void) /* Verify MPI_Offset can handle larger than 2GB sizes */ VRFY((sizeof(MPI_Offset) > 4), "sizeof(MPI_Offset)>4"); - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl >= 0), "create_faccess_plist succeeded"); @@ -634,7 +637,7 @@ big_dataset(void) * default fill value of zeros to work correctly. */ void -dataset_fillvalue(void) +dataset_fillvalue(const void *params) { int mpi_size, mpi_rank; /* MPI info */ int err_num; /* Number of errors */ @@ -672,7 +675,7 @@ dataset_fillvalue(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* Set the dataset dimension to be one row more than number of processes */ /* and calculate the actual dataset size. */ @@ -888,17 +891,17 @@ dataset_fillvalue(void) /* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */ void -collective_group_write_independent_group_read(void) +collective_group_write_independent_group_read(const void *params) { - collective_group_write(); - independent_group_read(); + collective_group_write(params); + independent_group_read(params); } /* Write multiple groups with a chunked dataset in each group collectively. * These groups and datasets are for testing independent read later. */ void -collective_group_write(void) +collective_group_write(const void *params) { int mpi_rank, mpi_size, size; int i, j, m; @@ -913,7 +916,7 @@ collective_group_write(void) char *filename; int ngroups; - pt = GetTestParameters(); + pt = params; filename = pt->name; ngroups = pt->count; @@ -1011,7 +1014,7 @@ collective_group_write(void) * datasets independently. */ void -independent_group_read(void) +independent_group_read(const void *params) { int mpi_rank, m; hid_t plist, fid; @@ -1020,7 +1023,7 @@ independent_group_read(void) int ngroups; herr_t ret; - pt = GetTestParameters(); + pt = params; filename = pt->name; ngroups = pt->count; @@ -1139,7 +1142,7 @@ group_dataset_read(hid_t fid, int mpi_rank, int m) * */ void -multiple_group_write(void) +multiple_group_write(const void *params) { int mpi_rank, mpi_size, size; int m; @@ -1152,7 +1155,7 @@ multiple_group_write(void) char *filename; int ngroups; - pt = GetTestParameters(); + pt = params; filename = pt->name; ngroups = pt->count; @@ -1308,7 +1311,7 @@ create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, int counter) * every dataset in every group and check their correctness. */ void -multiple_group_read(void) +multiple_group_read(const void *params) { int mpi_rank, mpi_size, error_num, size; int m; @@ -1320,7 +1323,7 @@ multiple_group_read(void) char *filename; int ngroups; - pt = GetTestParameters(); + pt = params; filename = pt->name; ngroups = pt->count; @@ -1617,7 +1620,7 @@ get_slab(hsize_t chunk_origin[], hsize_t chunk_dims[], hsize_t count[], hsize_t #define N 4 void -io_mode_confusion(void) +io_mode_confusion(const void *params) { /* * HDF5 APIs definitions @@ -1650,7 +1653,7 @@ io_mode_confusion(void) const H5Ptest_param_t *pt; char *filename; - pt = GetTestParameters(); + pt = params; filename = pt->name; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -1897,7 +1900,7 @@ const char *lg_att_name[NUM_DATA_SETS] = {"large_attribute_0", "large_attribute "large_attribute_3"}; void -rr_obj_hdr_flush_confusion(void) +rr_obj_hdr_flush_confusion(const void *params) { /* MPI variables */ /* private communicator size and rank */ @@ -1946,9 +1949,9 @@ rr_obj_hdr_flush_confusion(void) * step. When all steps are done, they inform readers to end. */ if (is_reader) - rr_obj_hdr_flush_confusion_reader(comm); + rr_obj_hdr_flush_confusion_reader(params, comm); else - rr_obj_hdr_flush_confusion_writer(comm); + rr_obj_hdr_flush_confusion_writer(params, comm); MPI_Comm_free(&comm); if (verbose) @@ -1958,8 +1961,8 @@ rr_obj_hdr_flush_confusion(void) } /* rr_obj_hdr_flush_confusion() */ -void -rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) +static void +rr_obj_hdr_flush_confusion_writer(const void *params, MPI_Comm comm) { int i; int j; @@ -2008,7 +2011,7 @@ rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) * setup test bed related variables: */ - pt = (const H5Ptest_param_t *)GetTestParameters(); + pt = params; filename = pt->name; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_world_rank); @@ -2339,8 +2342,8 @@ rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) } /* rr_obj_hdr_flush_confusion_writer() */ -void -rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) +static void +rr_obj_hdr_flush_confusion_reader(const void *params, MPI_Comm comm) { int i; int j; @@ -2387,7 +2390,7 @@ rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) * setup test bed related variables: */ - pt = (const H5Ptest_param_t *)GetTestParameters(); + pt = params; filename = pt->name; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_world_rank); @@ -2702,7 +2705,7 @@ rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) #define EXTRA_ALIGN 100 void -chunk_align_bug_1(void) +chunk_align_bug_1(const void *params) { int mpi_rank; hid_t file_id, dset_id, fapl_id, dcpl_id, space_id; @@ -2726,7 +2729,7 @@ chunk_align_bug_1(void) return; } - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* Create file without alignment */ fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 2479c369a8e..3d1907e3a9a 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -1011,9 +1011,10 @@ parse_options(int argc, char **argv) else { switch (*(*argv + 1)) { case 'v': - if (*((*argv + 1) + 1)) + if (*((*argv + 1) + 1)) { if (ParseTestVerbosity((*argv + 1) + 1) < 0) return 1; + } else SetTestVerbosity(VERBO_MED); break; diff --git a/testpar/t_oflush.c b/testpar/t_oflush.c index 4a91be17719..70257a40f85 100644 --- a/testpar/t_oflush.c +++ b/testpar/t_oflush.c @@ -25,7 +25,7 @@ #define RANK 2 void -test_oflush(void) +test_oflush(const void *params) { int mpi_size, mpi_rank; hid_t file, dataset; @@ -50,7 +50,7 @@ test_oflush(void) for (i = 0; i < NY; i++) data[j][i] = i + j; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((file >= 0), "file creation succeeded"); diff --git a/testpar/t_ph5basic.c b/testpar/t_ph5basic.c index 7fdefeb3ee9..6a3909173d4 100644 --- a/testpar/t_ph5basic.c +++ b/testpar/t_ph5basic.c @@ -28,7 +28,7 @@ *------------------------------------------------------------------------- */ void -test_fapl_mpio_dup(void) +test_fapl_mpio_dup(const void H5_ATTR_UNUSED *params) { int mpi_size, mpi_rank; MPI_Comm comm, comm_tmp; @@ -190,7 +190,7 @@ test_fapl_mpio_dup(void) *------------------------------------------------------------------------- */ void -test_get_dxpl_mpio(void) +test_get_dxpl_mpio(const void *params) { hid_t fid = H5I_INVALID_HID; hid_t sid = H5I_INVALID_HID; @@ -222,7 +222,7 @@ test_get_dxpl_mpio(void) VRFY((fapl >= 0), "Fapl creation succeeded"); /* Create a file */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); VRFY((fid >= 0), "H5Fcreate succeeded"); diff --git a/testpar/t_prestart.c b/testpar/t_prestart.c index 87d8fdb32e9..3a82924cae5 100644 --- a/testpar/t_prestart.c +++ b/testpar/t_prestart.c @@ -17,6 +17,13 @@ #include "testpar.h" +#define RANK 2 +#define ROW_FACTOR 8 /* Nominal row factor for dataset size */ +#define COL_FACTOR 16 /* Nominal column factor for dataset size */ + +/* Dataset data type. Int's can be easily octo dumped. */ +typedef int DATATYPE; + int nerrors = 0; /* errors count */ static const char *FILENAME[] = {"shutdown", NULL}; diff --git a/testpar/t_prop.c b/testpar/t_prop.c index af7b9a891f8..789796b7ebd 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -88,7 +88,7 @@ test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc) } void -test_plist_ed(void) +test_plist_ed(const void H5_ATTR_UNUSED *params) { hid_t dcpl; /* dataset create prop. list */ hid_t dapl; /* dataset access prop. list */ @@ -451,7 +451,7 @@ test_plist_ed(void) } void -external_links(void) +external_links(const void H5_ATTR_UNUSED *params) { hid_t lcpl = H5I_INVALID_HID; /* link create prop. list */ hid_t lapl = H5I_INVALID_HID; /* link access prop. list */ diff --git a/testpar/t_pshutdown.c b/testpar/t_pshutdown.c index ab908ab2c49..cb6cdf963f7 100644 --- a/testpar/t_pshutdown.c +++ b/testpar/t_pshutdown.c @@ -21,6 +21,13 @@ #include "testpar.h" +#define RANK 2 +#define ROW_FACTOR 8 /* Nominal row factor for dataset size */ +#define COL_FACTOR 16 /* Nominal column factor for dataset size */ + +/* Dataset data type. Int's can be easily octo dumped. */ +typedef int DATATYPE; + int nerrors = 0; /* errors count */ static const char *FILENAME[] = {"shutdown", NULL}; diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 9d12814adda..5874cfa0209 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -32,6 +32,9 @@ #define PATH_MAX 512 #endif +#define ROW_FACTOR 8 /* Nominal row factor for dataset size */ +#define COL_FACTOR 16 /* Nominal column factor for dataset size */ + /* FILENAME and filenames must have the same number of names. * Use PARATESTFILE in general and use a separated filename only if the file * created in one test is accessed by a different test. @@ -43,6 +46,21 @@ const char *FILENAME[NFILENAME] = {"ShapeSameTest", NULL}; char *filenames[NFILENAME]; hid_t fapl; /* file access property list */ +/* global variables */ +int dim0; +int dim1; +int chunkdim0; +int chunkdim1; +int nerrors = 0; /* errors count */ +int ndatasets = 300; /* number of datasets to create*/ +int ngroups = 512; /* number of groups to create in root + * group. */ +int facc_type = FACC_MPIO; /*Test file access type */ +int dxfer_coll_type = DXFER_COLLECTIVE_IO; + +H5E_auto2_t old_func; /* previous error handler */ +void *old_client_data; /* previous error handler arg.*/ + /* On Lustre (and perhaps other parallel file systems?), we have severe * slow downs if two or more processes attempt to access the same file system * block. To minimize this problem, we set alignment in the shape same tests @@ -115,6 +133,11 @@ struct hs_dr_pio_test_vars_t { int64_t tests_skipped; }; +/* Structure for passing test parameters around */ +typedef struct test_params_t { + char *filename; +} test_params_t; + /*------------------------------------------------------------------------- * Function: hs_dr_pio_test__setup() * @@ -129,7 +152,7 @@ struct hs_dr_pio_test_vars_t { #define CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG 0 static void -hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker_edge_size, +hs_dr_pio_test__setup(const void *params, const int test_num, const int edge_size, const int checker_edge_size, const int chunk_edge_size, const int small_rank, const int large_rank, const bool use_collective_io, const hid_t dset_type, const int express_test, struct hs_dr_pio_test_vars_t *tv_ptr) @@ -250,7 +273,7 @@ hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker memset(tv_ptr->large_ds_slice_buf, 0, sizeof(uint32_t) * tv_ptr->large_ds_slice_size); - filename = (const char *)GetTestParameters(); + filename = ((const test_params_t *)params)->filename; assert(filename != NULL); #if CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG if (MAINPROCESS) { @@ -1701,7 +1724,7 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t *tv_ptr) #define CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG 0 static void -contig_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const int chunk_edge_size, +contig_hs_dr_pio_test__run_test(const void *params, const int test_num, const int edge_size, const int chunk_edge_size, const int small_rank, const int large_rank, const bool use_collective_io, const hid_t dset_type, int express_test, int *skips_ptr, int max_skips, int64_t *total_tests_ptr, int64_t *tests_run_ptr, int64_t *tests_skipped_ptr, @@ -1775,8 +1798,8 @@ contig_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i printf("\r - running test #%lld: small rank = %d, large rank = %d", (long long)(test_num + 1), small_rank, large_rank); - hs_dr_pio_test__setup(test_num, edge_size, -1, chunk_edge_size, small_rank, large_rank, use_collective_io, - dset_type, express_test, tv_ptr); + hs_dr_pio_test__setup(params, test_num, edge_size, -1, chunk_edge_size, small_rank, large_rank, + use_collective_io, dset_type, express_test, tv_ptr); /* initialize skips & max_skips */ tv_ptr->skips = *skips_ptr; @@ -1889,7 +1912,7 @@ contig_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i #define CONTIG_HS_DR_PIO_TEST__DEBUG 0 static void -contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) +contig_hs_dr_pio_test(const void *params, ShapeSameTestMethods sstest_type) { int express_test; int local_express_test; @@ -1948,7 +1971,7 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) chunk_edge_size = 0; contig_hs_dr_pio_test__run_test( - test_num, edge_size, chunk_edge_size, small_rank, large_rank, false, dset_type, + params, test_num, edge_size, chunk_edge_size, small_rank, large_rank, false, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -1959,7 +1982,7 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) chunk_edge_size = 0; contig_hs_dr_pio_test__run_test( - test_num, edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, + params, test_num, edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -1970,7 +1993,7 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) chunk_edge_size = 5; contig_hs_dr_pio_test__run_test( - test_num, edge_size, chunk_edge_size, small_rank, large_rank, false, dset_type, + params, test_num, edge_size, chunk_edge_size, small_rank, large_rank, false, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -1981,7 +2004,7 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) chunk_edge_size = 5; contig_hs_dr_pio_test__run_test( - test_num, edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, + params, test_num, edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -3633,7 +3656,7 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t *tv_ptr) #define CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG 0 static void -ckrbrd_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const int checker_edge_size, +ckrbrd_hs_dr_pio_test__run_test(const void *params, const int test_num, const int edge_size, const int checker_edge_size, const int chunk_edge_size, const int small_rank, const int large_rank, const bool use_collective_io, const hid_t dset_type, const int express_test, int *skips_ptr, int max_skips, int64_t *total_tests_ptr, @@ -3708,8 +3731,8 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i printf("\r - running test #%lld: small rank = %d, large rank = %d", (long long)(test_num + 1), small_rank, large_rank); - hs_dr_pio_test__setup(test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank, - use_collective_io, dset_type, express_test, tv_ptr); + hs_dr_pio_test__setup(params, test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, + large_rank, use_collective_io, dset_type, express_test, tv_ptr); /* initialize skips & max_skips */ tv_ptr->skips = *skips_ptr; @@ -3804,7 +3827,7 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i */ static void -ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) +ckrbrd_hs_dr_pio_test(const void *params, ShapeSameTestMethods sstest_type) { int express_test; int local_express_test; @@ -3869,7 +3892,7 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) case IND_CONTIG: /* contiguous data set, independent I/O */ chunk_edge_size = 0; - ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size, + ckrbrd_hs_dr_pio_test__run_test(params, test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank, false, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); @@ -3880,7 +3903,7 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) case COL_CONTIG: /* contiguous data set, collective I/O */ chunk_edge_size = 0; - ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size, + ckrbrd_hs_dr_pio_test__run_test(params, test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); @@ -3891,7 +3914,7 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) case IND_CHUNKED: /* chunked data set, independent I/O */ chunk_edge_size = 5; - ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size, + ckrbrd_hs_dr_pio_test__run_test(params, test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank, false, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); @@ -3902,7 +3925,7 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) case COL_CHUNKED: /* chunked data set, collective I/O */ chunk_edge_size = 5; - ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size, + ckrbrd_hs_dr_pio_test__run_test(params, test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); @@ -3943,21 +3966,6 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) * Main driver of the Parallel HDF5 tests */ -/* global variables */ -int dim0; -int dim1; -int chunkdim0; -int chunkdim1; -int nerrors = 0; /* errors count */ -int ndatasets = 300; /* number of datasets to create*/ -int ngroups = 512; /* number of groups to create in root - * group. */ -int facc_type = FACC_MPIO; /*Test file access type */ -int dxfer_coll_type = DXFER_COLLECTIVE_IO; - -H5E_auto2_t old_func; /* previous error handler */ -void *old_client_data; /* previous error handler arg.*/ - /* other option flags */ #ifdef USE_PAUSE @@ -4019,20 +4027,20 @@ MPI_Init(int *argc, char ***argv) * Show command usage */ static void -usage(void) +usage(FILE *stream) { - printf(" [-r] [-w] [-m] [-n] " - "[-o] [-f ] [-d ]\n"); - printf("\t-m" - "\tset number of datasets for the multiple dataset test\n"); - printf("\t-n" - "\tset number of groups for the multiple group test\n"); - printf("\t-f \tfilename prefix\n"); - printf("\t-2\t\tuse Split-file together with MPIO\n"); - printf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", ROW_FACTOR, - COL_FACTOR); - printf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); - printf("\n"); + fprintf(stream, " [-r] [-w] [-m] [-n] " + "[-o] [-f ] [-d ]\n"); + fprintf(stream, "\t-m" + "\tset number of datasets for the multiple dataset test\n"); + fprintf(stream, "\t-n" + "\tset number of groups for the multiple group test\n"); + fprintf(stream, "\t-f \tfilename prefix\n"); + fprintf(stream, "\t-2\t\tuse Split-file together with MPIO\n"); + fprintf(stream, "\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", ROW_FACTOR, + COL_FACTOR); + fprintf(stream, "\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); + fprintf(stream, "\n"); } /* @@ -4166,120 +4174,68 @@ parse_options(int argc, char **argv) return (0); } -/* - * Create the appropriate File access property list - */ -hid_t -create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) -{ - hid_t ret_pl = H5I_INVALID_HID; - herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ - - /* need the rank for error checking macros */ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); - - if (l_facc_type == FACC_DEFAULT) - return (ret_pl); - - if (l_facc_type == FACC_MPIO) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); - ret = H5Pset_all_coll_metadata_ops(ret_pl, true); - VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); - VRFY((ret >= 0), ""); - return (ret_pl); - } - - if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { - hid_t mpio_pl; - - mpio_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return (ret_pl); - } - - /* unknown file access types */ - return (ret_pl); -} - /* Shape Same test using contiguous hyperslab using independent IO on contiguous datasets */ static void -sscontig1(void) +sscontig1(const void *params) { - contig_hs_dr_pio_test(IND_CONTIG); + contig_hs_dr_pio_test(params, IND_CONTIG); } /* Shape Same test using contiguous hyperslab using collective IO on contiguous datasets */ static void -sscontig2(void) +sscontig2(const void *params) { - contig_hs_dr_pio_test(COL_CONTIG); + contig_hs_dr_pio_test(params, COL_CONTIG); } /* Shape Same test using contiguous hyperslab using independent IO on chunked datasets */ static void -sscontig3(void) +sscontig3(const void *params) { - contig_hs_dr_pio_test(IND_CHUNKED); + contig_hs_dr_pio_test(params, IND_CHUNKED); } /* Shape Same test using contiguous hyperslab using collective IO on chunked datasets */ static void -sscontig4(void) +sscontig4(const void *params) { - contig_hs_dr_pio_test(COL_CHUNKED); + contig_hs_dr_pio_test(params, COL_CHUNKED); } /* Shape Same test using checker hyperslab using independent IO on contiguous datasets */ static void -sschecker1(void) +sschecker1(const void *params) { - ckrbrd_hs_dr_pio_test(IND_CONTIG); + ckrbrd_hs_dr_pio_test(params, IND_CONTIG); } /* Shape Same test using checker hyperslab using collective IO on contiguous datasets */ static void -sschecker2(void) +sschecker2(const void *params) { - ckrbrd_hs_dr_pio_test(COL_CONTIG); + ckrbrd_hs_dr_pio_test(params, COL_CONTIG); } /* Shape Same test using checker hyperslab using independent IO on chunked datasets */ static void -sschecker3(void) +sschecker3(const void *params) { - ckrbrd_hs_dr_pio_test(IND_CHUNKED); + ckrbrd_hs_dr_pio_test(params, IND_CHUNKED); } /* Shape Same test using checker hyperslab using collective IO on chunked datasets */ static void -sschecker4(void) +sschecker4(const void *params) { - ckrbrd_hs_dr_pio_test(COL_CHUNKED); + ckrbrd_hs_dr_pio_test(params, COL_CHUNKED); } int main(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ - int mpi_code; + test_params_t test_params; + int mpi_size, mpi_rank; /* mpi variables */ + int mpi_code; #ifdef H5_HAVE_TEST_API int required = MPI_THREAD_MULTIPLE; int provided; @@ -4323,8 +4279,6 @@ main(int argc, char **argv) return -1; } - mpi_rank_framework_g = mpi_rank; - dim0 = ROW_FACTOR * mpi_size; dim1 = COL_FACTOR * mpi_size; @@ -4378,7 +4332,7 @@ main(int argc, char **argv) } /* Initialize testing framework */ - if (TestInit(argv[0], usage, parse_options) < 0) { + if (TestInit(argv[0], usage, parse_options, mpi_rank) < 0) { if (MAINPROCESS) { fprintf(stderr, "couldn't initialize testing framework\n"); fflush(stderr); @@ -4388,17 +4342,19 @@ main(int argc, char **argv) return -1; } + test_params.filename = PARATESTFILE; + /* Shape Same tests using contiguous hyperslab */ - AddTest("sscontig1", sscontig1, NULL, NULL, PARATESTFILE, sizeof(char *), "Cntg hslab, ind IO, cntg dsets"); - AddTest("sscontig2", sscontig2, NULL, NULL, PARATESTFILE, sizeof(char *), "Cntg hslab, col IO, cntg dsets"); - AddTest("sscontig3", sscontig3, NULL, NULL, PARATESTFILE, sizeof(char *), "Cntg hslab, ind IO, chnk dsets"); - AddTest("sscontig4", sscontig4, NULL, NULL, PARATESTFILE, sizeof(char *), "Cntg hslab, col IO, chnk dsets"); + AddTest("sscontig1", sscontig1, NULL, NULL, &test_params, sizeof(test_params), "Cntg hslab, ind IO, cntg dsets"); + AddTest("sscontig2", sscontig2, NULL, NULL, &test_params, sizeof(test_params), "Cntg hslab, col IO, cntg dsets"); + AddTest("sscontig3", sscontig3, NULL, NULL, &test_params, sizeof(test_params), "Cntg hslab, ind IO, chnk dsets"); + AddTest("sscontig4", sscontig4, NULL, NULL, &test_params, sizeof(test_params), "Cntg hslab, col IO, chnk dsets"); /* Shape Same tests using checker board hyperslab */ - AddTest("sschecker1", sschecker1, NULL, NULL, PARATESTFILE, sizeof(char *), "Check hslab, ind IO, cntg dsets"); - AddTest("sschecker2", sschecker2, NULL, NULL, PARATESTFILE, sizeof(char *), "Check hslab, col IO, cntg dsets"); - AddTest("sschecker3", sschecker3, NULL, NULL, PARATESTFILE, sizeof(char *), "Check hslab, ind IO, chnk dsets"); - AddTest("sschecker4", sschecker4, NULL, NULL, PARATESTFILE, sizeof(char *), "Check hslab, col IO, chnk dsets"); + AddTest("sschecker1", sschecker1, NULL, NULL, &test_params, sizeof(test_params), "Check hslab, ind IO, cntg dsets"); + AddTest("sschecker2", sschecker2, NULL, NULL, &test_params, sizeof(test_params), "Check hslab, col IO, cntg dsets"); + AddTest("sschecker3", sschecker3, NULL, NULL, &test_params, sizeof(test_params), "Check hslab, ind IO, chnk dsets"); + AddTest("sschecker4", sschecker4, NULL, NULL, &test_params, sizeof(test_params), "Check hslab, col IO, chnk dsets"); /* Display testing information */ TestInfo(stdout); diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index b381ef5d77c..892f784f962 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -36,8 +36,8 @@ #define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0 -static void coll_write_test(int chunk_factor); -static void coll_read_test(void); +static void coll_write_test(const void *params, int chunk_factor); +static void coll_read_test(const void *params); /*------------------------------------------------------------------------- * Function: coll_irregular_cont_write @@ -52,7 +52,7 @@ static void coll_read_test(void); *------------------------------------------------------------------------- */ void -coll_irregular_cont_write(void) +coll_irregular_cont_write(const void *params) { int mpi_rank; @@ -71,7 +71,7 @@ coll_irregular_cont_write(void) return; } - coll_write_test(0); + coll_write_test(params, 0); } /*------------------------------------------------------------------------- @@ -87,7 +87,7 @@ coll_irregular_cont_write(void) *------------------------------------------------------------------------- */ void -coll_irregular_cont_read(void) +coll_irregular_cont_read(const void *params) { int mpi_rank; @@ -106,7 +106,7 @@ coll_irregular_cont_read(void) return; } - coll_read_test(); + coll_read_test(params); } /*------------------------------------------------------------------------- @@ -122,7 +122,7 @@ coll_irregular_cont_read(void) *------------------------------------------------------------------------- */ void -coll_irregular_simple_chunk_write(void) +coll_irregular_simple_chunk_write(const void *params) { int mpi_rank; @@ -141,7 +141,7 @@ coll_irregular_simple_chunk_write(void) return; } - coll_write_test(1); + coll_write_test(params, 1); } /*------------------------------------------------------------------------- @@ -157,7 +157,7 @@ coll_irregular_simple_chunk_write(void) *------------------------------------------------------------------------- */ void -coll_irregular_simple_chunk_read(void) +coll_irregular_simple_chunk_read(const void *params) { int mpi_rank; @@ -176,7 +176,7 @@ coll_irregular_simple_chunk_read(void) return; } - coll_read_test(); + coll_read_test(params); } /*------------------------------------------------------------------------- @@ -192,7 +192,7 @@ coll_irregular_simple_chunk_read(void) *------------------------------------------------------------------------- */ void -coll_irregular_complex_chunk_write(void) +coll_irregular_complex_chunk_write(const void *params) { int mpi_rank; @@ -211,7 +211,7 @@ coll_irregular_complex_chunk_write(void) return; } - coll_write_test(4); + coll_write_test(params, 4); } /*------------------------------------------------------------------------- @@ -227,7 +227,7 @@ coll_irregular_complex_chunk_write(void) *------------------------------------------------------------------------- */ void -coll_irregular_complex_chunk_read(void) +coll_irregular_complex_chunk_read(const void *params) { int mpi_rank; @@ -246,7 +246,7 @@ coll_irregular_complex_chunk_read(void) return; } - coll_read_test(); + coll_read_test(params); } /*------------------------------------------------------------------------- @@ -263,7 +263,7 @@ coll_irregular_complex_chunk_read(void) *------------------------------------------------------------------------- */ void -coll_write_test(int chunk_factor) +coll_write_test(const void *params, int chunk_factor) { const char *filename; @@ -301,7 +301,7 @@ coll_write_test(int chunk_factor) MPI_Comm_rank(comm, &mpi_rank); /* Obtain file name */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* * Buffers' initialization. @@ -717,7 +717,7 @@ coll_write_test(int chunk_factor) *------------------------------------------------------------------------- */ static void -coll_read_test(void) +coll_read_test(const void *params) { const char *filename; @@ -751,7 +751,7 @@ coll_read_test(void) MPI_Comm_rank(comm, &mpi_rank); /* Obtain file name */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* Initialize the buffer */ @@ -1504,7 +1504,7 @@ lower_dim_size_comp_test__verify_data(uint32_t *buf_ptr, #define LDSCT_DS_RANK 5 static void -lower_dim_size_comp_test__run_test(const int chunk_edge_size, const bool use_collective_io, +lower_dim_size_comp_test__run_test(const void *params, const int chunk_edge_size, const bool use_collective_io, const hid_t dset_type) { #if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG @@ -1636,7 +1636,7 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, const bool use_col /* get the file name */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); /* ---------------------------------------- @@ -2349,7 +2349,7 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, const bool use_col */ void -lower_dim_size_comp_test(void) +lower_dim_size_comp_test(const void *params) { /* const char *fcnName = "lower_dim_size_comp_test()"; */ int chunk_edge_size = 0; @@ -2372,10 +2372,10 @@ lower_dim_size_comp_test(void) HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); for (use_collective_io = 0; use_collective_io <= 1; use_collective_io++) { chunk_edge_size = 0; - lower_dim_size_comp_test__run_test(chunk_edge_size, (bool)use_collective_io, H5T_NATIVE_UINT); + lower_dim_size_comp_test__run_test(params, chunk_edge_size, (bool)use_collective_io, H5T_NATIVE_UINT); chunk_edge_size = 5; - lower_dim_size_comp_test__run_test(chunk_edge_size, (bool)use_collective_io, H5T_NATIVE_UINT); + lower_dim_size_comp_test__run_test(params, chunk_edge_size, (bool)use_collective_io, H5T_NATIVE_UINT); } /* end for */ return; @@ -2411,7 +2411,7 @@ lower_dim_size_comp_test(void) #define LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE 16 void -link_chunk_collective_io_test(void) +link_chunk_collective_io_test(const void *params) { /* const char *fcnName = "link_chunk_collective_io_test()"; */ const char *filename; @@ -2459,7 +2459,7 @@ link_chunk_collective_io_test(void) assert(mpi_size > 0); /* get the file name */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); /* setup file access template */ diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index 30545ea1968..68ae70c8ade 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -27,6 +27,9 @@ #ifdef H5_HAVE_SUBFILING_VFD +/* Include testing framework functionality -- currently just for test alarm timer */ +#include "testframe.h" + #include "H5FDsubfiling.h" #include "H5FDioc.h" diff --git a/testpar/testpar.c b/testpar/testpar.c new file mode 100644 index 00000000000..b3c22f0163b --- /dev/null +++ b/testpar/testpar.c @@ -0,0 +1,121 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Provides support functions for hdf5 parallel tests. + */ + +#include "testpar.h" + +#define MAX_RANK 2 + +/* + * Create the appropriate File access property list + */ +hid_t +create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) +{ + hid_t ret_pl = H5I_INVALID_HID; + herr_t ret; /* generic return value */ + int mpi_rank; /* mpi variables */ + + /* need the rank for error checking macros */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + if ((ret_pl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return H5I_INVALID_HID; + + if (l_facc_type == FACC_DEFAULT) + return ret_pl; + + if (l_facc_type == FACC_MPIO) { + /* set Parallel access with communicator */ + if ((ret = H5Pset_fapl_mpio(ret_pl, comm, info)) < 0) + return H5I_INVALID_HID; + if ((ret = H5Pset_all_coll_metadata_ops(ret_pl, true)) < 0) + return H5I_INVALID_HID; + if ((ret = H5Pset_coll_metadata_write(ret_pl, true)) < 0) + return H5I_INVALID_HID; + return ret_pl; + } + + if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { + hid_t mpio_pl; + + if ((mpio_pl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return H5I_INVALID_HID; + /* set Parallel access with communicator */ + if ((ret = H5Pset_fapl_mpio(mpio_pl, comm, info)) < 0) + return H5I_INVALID_HID; + + /* setup file access template */ + if ((ret_pl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return H5I_INVALID_HID; + /* set Parallel access with communicator */ + if ((ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl)) < 0) + return H5I_INVALID_HID; + if (H5Pclose(mpio_pl) < 0) + return H5I_INVALID_HID; + + return ret_pl; + } + + /* unknown file access types */ + return ret_pl; +} + +/* + * Setup the coordinates for point selection. + */ +void +point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, + hsize_t coords[], int order) +{ + hsize_t i, j, k = 0, m, n, s1, s2; + + HDcompile_assert(MAX_RANK == 2); + + if (OUT_OF_ORDER == order) + k = (num_points * MAX_RANK) - 1; + else if (IN_ORDER == order) + k = 0; + + s1 = start[0]; + s2 = start[1]; + + for (i = 0; i < count[0]; i++) + for (j = 0; j < count[1]; j++) + for (m = 0; m < block[0]; m++) + for (n = 0; n < block[1]; n++) + if (OUT_OF_ORDER == order) { + coords[k--] = s2 + (stride[1] * j) + n; + coords[k--] = s1 + (stride[0] * i) + m; + } + else if (IN_ORDER == order) { + coords[k++] = s1 + stride[0] * i + m; + coords[k++] = s2 + stride[1] * j + n; + } + + if (VERBOSE_MED) { + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + k = 0; + for (i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += 2; + } + } +} diff --git a/testpar/testpar.h b/testpar/testpar.h index ed05660b9db..8438bbec5f0 100644 --- a/testpar/testpar.h +++ b/testpar/testpar.h @@ -39,27 +39,6 @@ #define IN_ORDER 1 #define OUT_OF_ORDER 2 -/* Definitions of the selection mode for the test_actual_io_function. */ -#define TEST_ACTUAL_IO_NO_COLLECTIVE 0 -#define TEST_ACTUAL_IO_RESET 1 -#define TEST_ACTUAL_IO_MULTI_CHUNK_IND 2 -#define TEST_ACTUAL_IO_MULTI_CHUNK_COL 3 -#define TEST_ACTUAL_IO_MULTI_CHUNK_MIX 4 -#define TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE 5 -#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND 6 -#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL 7 -#define TEST_ACTUAL_IO_LINK_CHUNK 8 -#define TEST_ACTUAL_IO_CONTIGUOUS 9 - -/* Definitions of the selection mode for the no_collective_cause_tests function. */ -#define TEST_COLLECTIVE 0x001 -#define TEST_SET_INDEPENDENT 0x002 -#define TEST_DATATYPE_CONVERSION 0x004 -#define TEST_DATA_TRANSFORMS 0x008 -#define TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES 0x010 -#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT 0x020 -#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL 0x040 - #define MAX_ERR_REPORT 10 /* Maximum number of errors reported */ /* Define some handy debugging shorthands, routines, ... */ @@ -143,6 +122,40 @@ MPI_BANNER("SYNC DONE"); \ } while (0) +/* Shared enum for some parallel tests that + * contains values to determine how parallel + * I/O is performed + */ +enum H5TEST_COLL_CHUNK_API { + API_NONE = 0, + API_LINK_HARD, + API_MULTI_HARD, + API_LINK_TRUE, + API_LINK_FALSE, + API_MULTI_COLL, + API_MULTI_IND +}; + +/* Shape Same Tests Definitions */ +typedef enum { + IND_CONTIG, /* Independent IO on contiguous datasets */ + COL_CONTIG, /* Collective IO on contiguous datasets */ + IND_CHUNKED, /* Independent IO on chunked datasets */ + COL_CHUNKED /* Collective IO on chunked datasets */ +} ShapeSameTestMethods; + /* End of Define some handy debugging shorthands, routines, ... */ +#ifdef __cplusplus +extern "C" { +#endif + +hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type); + +void point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, + hsize_t coords[], int order); + +#ifdef __cplusplus +} +#endif #endif /* TESTPAR_H */ diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 8d17624efc1..343ba7c7601 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -248,68 +248,12 @@ parse_options(int argc, char **argv) return (0); } -/* - * Create the appropriate File access property list - */ -hid_t -create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) -{ - hid_t ret_pl = H5I_INVALID_HID; - herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ - - /* need the rank for error checking macros */ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), "H5Pcreate succeeded"); - - if (l_facc_type == FACC_DEFAULT) - return (ret_pl); - - if (l_facc_type == FACC_MPIO) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), "H5Pset_fapl_mpio succeeded"); - ret = H5Pset_all_coll_metadata_ops(ret_pl, true); - VRFY((ret >= 0), "H5Pset_all_coll_metadata_ops succeeded"); - ret = H5Pset_coll_metadata_write(ret_pl, true); - VRFY((ret >= 0), "H5Pset_coll_metadata_write succeeded"); - return (ret_pl); - } - - if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { - hid_t mpio_pl; - - mpio_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), "H5Pcreate succeeded"); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), "H5Pset_fapl_mpio succeeded"); - - /* setup file access template */ - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), "H5Pcreate succeeded"); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return (ret_pl); - } - - /* unknown file access types */ - return (ret_pl); -} - int main(int argc, char **argv) { + H5Ptest_param_t test_params; int mpi_size, mpi_rank; /* mpi variables */ int mpi_code; - H5Ptest_param_t ndsets_params, ngroups_params; - H5Ptest_param_t collngroups_params; - H5Ptest_param_t io_mode_confusion_params; - H5Ptest_param_t rr_obj_flush_confusion_params; #ifdef H5_HAVE_TEST_API int required = MPI_THREAD_MULTIPLE; int provided; @@ -353,8 +297,6 @@ main(int argc, char **argv) return -1; } - mpi_rank_framework_g = mpi_rank; - dim0 = ROW_FACTOR * mpi_size; dim1 = COL_FACTOR * mpi_size; @@ -393,158 +335,151 @@ main(int argc, char **argv) VRFY((H5Pget_vol_cap_flags(fapl, &vol_cap_flags_g) >= 0), "H5Pget_vol_cap_flags succeeded"); /* Initialize testing framework */ - if (TestInit(argv[0], usage, parse_options) < 0) { + if (TestInit(argv[0], usage, parse_options, mpi_rank) < 0) { if (MAINPROCESS) fprintf(stderr, "couldn't initialize testing framework\n"); MPI_Finalize(); return -1; } + test_params.name = PARATESTFILE; + test_params.count = 0; + /* Tests are generally arranged from least to most complexity... */ - AddTest("mpiodup", test_fapl_mpio_dup, NULL, "fapl_mpio duplicate", NULL); - AddTest("getdxplmpio", test_get_dxpl_mpio, NULL, "dxpl_mpio get", PARATESTFILE); + AddTest("mpiodup", test_fapl_mpio_dup, NULL, NULL, NULL, 0, "fapl_mpio duplicate"); + AddTest("getdxplmpio", test_get_dxpl_mpio, NULL, NULL, &test_params, sizeof(test_params), "dxpl_mpio get"); - AddTest("split", test_split_comm_access, NULL, "dataset using split communicators", PARATESTFILE); - AddTest("h5oflusherror", test_oflush, NULL, "H5Oflush failure", PARATESTFILE); + AddTest("split", test_split_comm_access, NULL, NULL, &test_params, sizeof(test_params), "dataset using split communicators"); + AddTest("h5oflusherror", test_oflush, NULL, NULL, &test_params, sizeof(test_params), "H5Oflush failure"); - AddTest("page_buffer", test_page_buffer_access, NULL, "page buffer usage in parallel", PARATESTFILE); + AddTest("page_buffer", test_page_buffer_access, NULL, NULL, &test_params, sizeof(test_params), "page buffer usage in parallel"); - AddTest("props", test_file_properties, NULL, "Coll Metadata file property settings", PARATESTFILE); + AddTest("props", test_file_properties, NULL, NULL, &test_params, sizeof(test_params), "Coll Metadata file property settings"); - AddTest("delete", test_delete, NULL, "MPI-IO VFD file delete", PARATESTFILE); + AddTest("delete", test_delete, NULL, NULL, &test_params, sizeof(test_params), "MPI-IO VFD file delete"); - AddTest("invlibverassert", test_invalid_libver_bounds_file_close_assert, NULL, - "Invalid libver bounds assertion failure", PARATESTFILE); + AddTest("invlibverassert", test_invalid_libver_bounds_file_close_assert, NULL, NULL, + &test_params, sizeof(test_params), "Invalid libver bounds assertion failure"); - AddTest("evictparassert", test_evict_on_close_parallel_unsupp, NULL, "Evict on close in parallel failure", - PARATESTFILE); - AddTest("fapl_preserve", test_fapl_preserve_hints, NULL, "preserve MPI I/O hints after fapl closed", - PARATESTFILE); + AddTest("evictparassert", test_evict_on_close_parallel_unsupp, NULL, NULL, &test_params, sizeof(test_params), + "Evict on close in parallel failure"); + AddTest("fapl_preserve", test_fapl_preserve_hints, NULL, NULL, &test_params, sizeof(test_params), + "preserve MPI I/O hints after fapl closed"); - AddTest("idsetw", dataset_writeInd, NULL, "dataset independent write", PARATESTFILE); - AddTest("idsetr", dataset_readInd, NULL, "dataset independent read", PARATESTFILE); + AddTest("idsetw", dataset_writeInd, NULL, NULL, &test_params, sizeof(test_params), "dataset independent write"); + AddTest("idsetr", dataset_readInd, NULL, NULL, &test_params, sizeof(test_params), "dataset independent read"); - AddTest("cdsetw", dataset_writeAll, NULL, "dataset collective write", PARATESTFILE); - AddTest("cdsetr", dataset_readAll, NULL, "dataset collective read", PARATESTFILE); + AddTest("cdsetw", dataset_writeAll, NULL, NULL, &test_params, sizeof(test_params), "dataset collective write"); + AddTest("cdsetr", dataset_readAll, NULL, NULL, &test_params, sizeof(test_params), "dataset collective read"); - AddTest("eidsetw", extend_writeInd, NULL, "extendible dataset independent write", PARATESTFILE); - AddTest("eidsetr", extend_readInd, NULL, "extendible dataset independent read", PARATESTFILE); - AddTest("ecdsetw", extend_writeAll, NULL, "extendible dataset collective write", PARATESTFILE); - AddTest("ecdsetr", extend_readAll, NULL, "extendible dataset collective read", PARATESTFILE); - AddTest("eidsetw2", extend_writeInd2, NULL, "extendible dataset independent write #2", PARATESTFILE); - AddTest("selnone", none_selection_chunk, NULL, "chunked dataset with none-selection", PARATESTFILE); - AddTest("calloc", test_chunk_alloc, NULL, "parallel extend Chunked allocation on serial file", - PARATESTFILE); - AddTest("chkallocser2par", test_chunk_alloc_incr_ser_to_par, NULL, - "chunk allocation from serial to parallel file access", PARATESTFILE); - AddTest("fltread", test_filter_read, NULL, "parallel read of dataset written serially with filters", - PARATESTFILE); + AddTest("eidsetw", extend_writeInd, NULL, NULL, &test_params, sizeof(test_params), "extendible dataset independent write"); + AddTest("eidsetr", extend_readInd, NULL, NULL, &test_params, sizeof(test_params), "extendible dataset independent read"); + AddTest("ecdsetw", extend_writeAll, NULL, NULL, &test_params, sizeof(test_params), "extendible dataset collective write"); + AddTest("ecdsetr", extend_readAll, NULL, NULL, &test_params, sizeof(test_params), "extendible dataset collective read"); + AddTest("eidsetw2", extend_writeInd2, NULL, NULL, &test_params, sizeof(test_params), "extendible dataset independent write #2"); + AddTest("selnone", none_selection_chunk, NULL, NULL, &test_params, sizeof(test_params), "chunked dataset with none-selection"); + AddTest("calloc", test_chunk_alloc, NULL, NULL, &test_params, sizeof(test_params), "parallel extend Chunked allocation on serial file"); + AddTest("chkallocser2par", test_chunk_alloc_incr_ser_to_par, NULL, NULL, &test_params, sizeof(test_params), + "chunk allocation from serial to parallel file access"); + AddTest("fltread", test_filter_read, NULL, NULL, &test_params, sizeof(test_params), "parallel read of dataset written serially with filters"); #ifdef H5_HAVE_FILTER_DEFLATE - AddTest("cmpdsetr", compress_readAll, NULL, "compressed dataset collective read", PARATESTFILE); + AddTest("cmpdsetr", compress_readAll, NULL, NULL, &test_params, sizeof(test_params), "compressed dataset collective read"); #endif /* H5_HAVE_FILTER_DEFLATE */ - AddTest("zerodsetr", zero_dim_dset, NULL, "zero dim dset", PARATESTFILE); + AddTest("zerodsetr", zero_dim_dset, NULL, NULL, &test_params, sizeof(test_params), "zero dim dset"); - ndsets_params.name = PARATESTFILE; - ndsets_params.count = ndatasets; - AddTest("ndsetw", multiple_dset_write, NULL, "multiple datasets write", &ndsets_params); + test_params.count = ndatasets; + AddTest("ndsetw", multiple_dset_write, NULL, NULL, &test_params, sizeof(test_params), "multiple datasets write"); - ngroups_params.name = PARATESTFILE; - ngroups_params.count = ngroups; - AddTest("ngrpw", multiple_group_write, NULL, "multiple groups write", &ngroups_params); - AddTest("ngrpr", multiple_group_read, NULL, "multiple groups read", &ngroups_params); + test_params.count = ngroups; + AddTest("ngrpw", multiple_group_write, NULL, NULL, &test_params, sizeof(test_params), "multiple groups write"); + AddTest("ngrpr", multiple_group_read, NULL, NULL, &test_params, sizeof(test_params), "multiple groups read"); - AddTest("compact", compact_dataset, NULL, "compact dataset test", PARATESTFILE); + AddTest("compact", compact_dataset, NULL, NULL, &test_params, sizeof(test_params), "compact dataset test"); - collngroups_params.name = PARATESTFILE; - collngroups_params.count = ngroups; + test_params.count = ngroups; /* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */ - AddTest("cngrpw-ingrpr", collective_group_write_independent_group_read, NULL, - "collective grp/dset write - independent grp/dset read", &collngroups_params); + AddTest("cngrpw-ingrpr", collective_group_write_independent_group_read, NULL, NULL, + &test_params, sizeof(test_params), "collective grp/dset write - independent grp/dset read"); #ifndef H5_HAVE_WIN32_API - AddTest("bigdset", big_dataset, NULL, "big dataset test", PARATESTFILE); + AddTest("bigdset", big_dataset, NULL, NULL, &test_params, sizeof(test_params), "big dataset test"); #else printf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n"); #endif - AddTest("fill", dataset_fillvalue, NULL, "dataset fill value", PARATESTFILE); + AddTest("fill", dataset_fillvalue, NULL, NULL, &test_params, sizeof(test_params), "dataset fill value"); - AddTest("cchunk1", coll_chunk1, NULL, "simple collective chunk io", PARATESTFILE); - AddTest("cchunk2", coll_chunk2, NULL, "noncontiguous collective chunk io", PARATESTFILE); - AddTest("cchunk3", coll_chunk3, NULL, "multi-chunk collective chunk io", PARATESTFILE); - AddTest("cchunk4", coll_chunk4, NULL, "collective chunk io with partial non-selection ", PARATESTFILE); + AddTest("cchunk1", coll_chunk1, NULL, NULL, &test_params, sizeof(test_params), "simple collective chunk io"); + AddTest("cchunk2", coll_chunk2, NULL, NULL, &test_params, sizeof(test_params), "noncontiguous collective chunk io"); + AddTest("cchunk3", coll_chunk3, NULL, NULL, &test_params, sizeof(test_params), "multi-chunk collective chunk io"); + AddTest("cchunk4", coll_chunk4, NULL, NULL, &test_params, sizeof(test_params), "collective chunk io with partial non-selection"); if ((mpi_size < 3) && MAINPROCESS) { printf("Collective chunk IO optimization APIs "); printf("needs at least 3 processes to participate\n"); printf("Collective chunk IO API tests will be skipped \n"); } - AddTest((mpi_size < 3) ? "-cchunk5" : "cchunk5", coll_chunk5, NULL, - "linked chunk collective IO without optimization", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk6" : "cchunk6", coll_chunk6, NULL, - "multi-chunk collective IO with direct request", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk7" : "cchunk7", coll_chunk7, NULL, - "linked chunk collective IO with optimization", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk8" : "cchunk8", coll_chunk8, NULL, - "linked chunk collective IO transferring to multi-chunk", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk9" : "cchunk9", coll_chunk9, NULL, - "multiple chunk collective IO with optimization", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk10" : "cchunk10", coll_chunk10, NULL, - "multiple chunk collective IO transferring to independent IO", PARATESTFILE); + AddTest((mpi_size < 3) ? "-cchunk5" : "cchunk5", coll_chunk5, NULL, NULL, + &test_params, sizeof(test_params), "linked chunk collective IO without optimization"); + AddTest((mpi_size < 3) ? "-cchunk6" : "cchunk6", coll_chunk6, NULL, NULL, + &test_params, sizeof(test_params), "multi-chunk collective IO with direct request"); + AddTest((mpi_size < 3) ? "-cchunk7" : "cchunk7", coll_chunk7, NULL, NULL, + &test_params, sizeof(test_params), "linked chunk collective IO with optimization"); + AddTest((mpi_size < 3) ? "-cchunk8" : "cchunk8", coll_chunk8, NULL, NULL, + &test_params, sizeof(test_params), "linked chunk collective IO transferring to multi-chunk"); + AddTest((mpi_size < 3) ? "-cchunk9" : "cchunk9", coll_chunk9, NULL, NULL, + &test_params, sizeof(test_params), "multiple chunk collective IO with optimization"); + AddTest((mpi_size < 3) ? "-cchunk10" : "cchunk10", coll_chunk10, NULL, NULL, + &test_params, sizeof(test_params), "multiple chunk collective IO transferring to independent IO"); /* irregular collective IO tests*/ - AddTest("ccontw", coll_irregular_cont_write, NULL, "collective irregular contiguous write", PARATESTFILE); - AddTest("ccontr", coll_irregular_cont_read, NULL, "collective irregular contiguous read", PARATESTFILE); - AddTest("cschunkw", coll_irregular_simple_chunk_write, NULL, "collective irregular simple chunk write", - PARATESTFILE); - AddTest("cschunkr", coll_irregular_simple_chunk_read, NULL, "collective irregular simple chunk read", - PARATESTFILE); - AddTest("ccchunkw", coll_irregular_complex_chunk_write, NULL, "collective irregular complex chunk write", - PARATESTFILE); - AddTest("ccchunkr", coll_irregular_complex_chunk_read, NULL, "collective irregular complex chunk read", - PARATESTFILE); - - AddTest("null", null_dataset, NULL, "null dataset test", PARATESTFILE); + AddTest("ccontw", coll_irregular_cont_write, NULL, NULL, &test_params, sizeof(test_params), "collective irregular contiguous write"); + AddTest("ccontr", coll_irregular_cont_read, NULL, NULL, &test_params, sizeof(test_params), "collective irregular contiguous read"); + AddTest("cschunkw", coll_irregular_simple_chunk_write, NULL, NULL, &test_params, sizeof(test_params), "collective irregular simple chunk write"); + AddTest("cschunkr", coll_irregular_simple_chunk_read, NULL, NULL, &test_params, sizeof(test_params), "collective irregular simple chunk read"); + AddTest("ccchunkw", coll_irregular_complex_chunk_write, NULL, NULL, &test_params, sizeof(test_params), "collective irregular complex chunk write"); + AddTest("ccchunkr", coll_irregular_complex_chunk_read, NULL, NULL, &test_params, sizeof(test_params), "collective irregular complex chunk read"); - io_mode_confusion_params.name = PARATESTFILE; - io_mode_confusion_params.count = 0; /* value not used */ + AddTest("null", null_dataset, NULL, NULL, &test_params, sizeof(test_params), "null dataset test"); - AddTest("I/Omodeconf", io_mode_confusion, NULL, "I/O mode confusion test -- hangs quickly on failure", - &io_mode_confusion_params); + test_params.count = 0; + AddTest("I/Omodeconf", io_mode_confusion, NULL, NULL, &test_params, sizeof(test_params), + "I/O mode confusion test -- hangs quickly on failure"); if ((mpi_size < 3) && MAINPROCESS) { printf("rr_obj_hdr_flush_confusion test needs at least 3 processes.\n"); printf("rr_obj_hdr_flush_confusion test will be skipped \n"); } if (mpi_size > 2) { - rr_obj_flush_confusion_params.name = PARATESTFILE; - rr_obj_flush_confusion_params.count = 0; /* value not used */ - AddTest("rrobjflushconf", rr_obj_hdr_flush_confusion, NULL, - "round robin object header flush confusion test", &rr_obj_flush_confusion_params); + test_params.count = 0; + AddTest("rrobjflushconf", rr_obj_hdr_flush_confusion, NULL, NULL, &test_params, sizeof(test_params), + "round robin object header flush confusion test"); } - AddTest("alnbg1", chunk_align_bug_1, NULL, "Chunk allocation with alignment bug.", PARATESTFILE); + AddTest("alnbg1", chunk_align_bug_1, NULL, NULL, &test_params, sizeof(test_params), "Chunk allocation with alignment bug."); - AddTest("tldsc", lower_dim_size_comp_test, NULL, - "test lower dim size comp in span tree to mpi derived type", PARATESTFILE); + AddTest("tldsc", lower_dim_size_comp_test, NULL, NULL, &test_params, sizeof(test_params), + "test lower dim size comp in span tree to mpi derived type"); - AddTest("lccio", link_chunk_collective_io_test, NULL, "test mpi derived type management", PARATESTFILE); + AddTest("lccio", link_chunk_collective_io_test, NULL, NULL, &test_params, sizeof(test_params), + "test mpi derived type management"); - AddTest("actualio", actual_io_mode_tests, NULL, "test actual io mode proprerty", PARATESTFILE); + AddTest("actualio", actual_io_mode_tests, NULL, NULL, &test_params, sizeof(test_params), + "test actual io mode proprerty"); - AddTest("nocolcause", no_collective_cause_tests, NULL, "test cause for broken collective io", - PARATESTFILE); + AddTest("nocolcause", no_collective_cause_tests, NULL, NULL, &test_params, sizeof(test_params), + "test cause for broken collective io"); - AddTest("edpl", test_plist_ed, NULL, "encode/decode Property Lists", NULL); + AddTest("edpl", test_plist_ed, NULL, NULL, NULL, 0, "encode/decode Property Lists"); - AddTest("extlink", external_links, NULL, "test external links", NULL); + AddTest("extlink", external_links, NULL, NULL, NULL, 0, "test external links"); if ((mpi_size < 2) && MAINPROCESS) { printf("File Image Ops daisy chain test needs at least 2 processes.\n"); printf("File Image Ops daisy chain test will be skipped \n"); } - AddTest((mpi_size < 2) ? "-fiodc" : "fiodc", file_image_daisy_chain_test, NULL, - "file image ops daisy chain", NULL); + AddTest((mpi_size < 2) ? "-fiodc" : "fiodc", file_image_daisy_chain_test, NULL, NULL, + NULL, 0, "file image ops daisy chain"); /* Atomicity operations are not supported for OpenMPI versions < major * version 5 and will sporadically fail. @@ -562,22 +497,22 @@ main(int argc, char **argv) printf("Atomicity tests will not work with a non MPIO VFD\n"); } else if (mpi_size >= 2 && facc_type == FACC_MPIO) { - AddTest("atomicity", dataset_atomicity, NULL, "dataset atomic updates", PARATESTFILE); + AddTest("atomicity", dataset_atomicity, NULL, NULL, &test_params, sizeof(test_params), "dataset atomic updates"); } #endif - AddTest("denseattr", test_dense_attr, NULL, "Store Dense Attributes", PARATESTFILE); - - AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL, - "Collective Metadata read with some ranks having no selection", PARATESTFILE); - AddTest("MC_coll_MD_read", test_multi_chunk_io_addrmap_issue, NULL, - "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); - AddTest("COLLIO_INDMDWR", test_coll_io_ind_md_write, NULL, - "Collective I/O with Independent metadata writes", PARATESTFILE); + AddTest("denseattr", test_dense_attr, NULL, NULL, &test_params, sizeof(test_params), "Store Dense Attributes"); + + AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL, NULL, + &test_params, sizeof(test_params), "Collective Metadata read with some ranks having no selection"); + AddTest("MC_coll_MD_read", test_multi_chunk_io_addrmap_issue, NULL, NULL, + &test_params, sizeof(test_params), "Collective MD read with multi chunk I/O (H5D__chunk_addrmap)"); + AddTest("LC_coll_MD_read", test_link_chunk_io_sort_chunk_issue, NULL, NULL, + &test_params, sizeof(test_params), "Collective MD read with link chunk I/O (H5D__sort_chunk)"); + AddTest("GH_coll_MD_wr", test_collective_global_heap_write, NULL, NULL, + &test_params, sizeof(test_params), "Collective MD write of global heap data"); + AddTest("COLLIO_INDMDWR", test_coll_io_ind_md_write, NULL, NULL, + &test_params, sizeof(test_params), "Collective I/O with Independent metadata writes"); /* Display testing information */ TestInfo(stdout); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 9b9078e930a..add8fd92e9b 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -20,16 +20,6 @@ #include "testpar.h" -enum H5TEST_COLL_CHUNK_API { - API_NONE = 0, - API_LINK_HARD, - API_MULTI_HARD, - API_LINK_TRUE, - API_LINK_FALSE, - API_MULTI_COLL, - API_MULTI_IND -}; - #ifndef false #define false 0 #endif @@ -151,6 +141,27 @@ enum H5TEST_COLL_CHUNK_API { 4 /* Number of points that will be selected \ and overwritten */ +/* Definitions of the selection mode for the test_actual_io_function. */ +#define TEST_ACTUAL_IO_NO_COLLECTIVE 0 +#define TEST_ACTUAL_IO_RESET 1 +#define TEST_ACTUAL_IO_MULTI_CHUNK_IND 2 +#define TEST_ACTUAL_IO_MULTI_CHUNK_COL 3 +#define TEST_ACTUAL_IO_MULTI_CHUNK_MIX 4 +#define TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE 5 +#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND 6 +#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL 7 +#define TEST_ACTUAL_IO_LINK_CHUNK 8 +#define TEST_ACTUAL_IO_CONTIGUOUS 9 + +/* Definitions of the selection mode for the no_collective_cause_tests function. */ +#define TEST_COLLECTIVE 0x001 +#define TEST_SET_INDEPENDENT 0x002 +#define TEST_DATATYPE_CONVERSION 0x004 +#define TEST_DATA_TRANSFORMS 0x008 +#define TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES 0x010 +#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT 0x020 +#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL 0x040 + /* Don't erase these lines, they are put here for debugging purposes */ /* #define MSPACE1_RANK 1 @@ -176,14 +187,6 @@ typedef struct H5Ptest_param_t /* holds extra test parameters */ /* Dataset data type. Int's can be easily octo dumped. */ typedef int DATATYPE; -/* Shape Same Tests Definitions */ -typedef enum { - IND_CONTIG, /* Independent IO on contiguous datasets */ - COL_CONTIG, /* Collective IO on contiguous datasets */ - IND_CHUNKED, /* Independent IO on chunked datasets */ - COL_CHUNKED /* Collective IO on chunked datasets */ -} ShapeSameTestMethods; - /* Shared global variables */ extern int dim0, dim1; /*Dataset dimensions */ extern int chunkdim0, chunkdim1; /*Chunk dimensions */ @@ -192,86 +195,81 @@ extern int facc_type; /*Test file access type */ extern int dxfer_coll_type; /* Test program prototypes */ -void test_plist_ed(void); -void external_links(void); -void zero_dim_dset(void); -void test_file_properties(void); -void test_delete(void); -void test_invalid_libver_bounds_file_close_assert(void); -void test_evict_on_close_parallel_unsupp(void); -void test_fapl_preserve_hints(void); -void multiple_dset_write(void); -void multiple_group_write(void); -void multiple_group_read(void); -void collective_group_write_independent_group_read(void); -void collective_group_write(void); -void independent_group_read(void); -void test_fapl_mpio_dup(void); -void test_get_dxpl_mpio(void); -void test_split_comm_access(void); -void test_page_buffer_access(void); -void dataset_atomicity(void); -void dataset_writeInd(void); -void dataset_writeAll(void); -void extend_writeInd(void); -void extend_writeInd2(void); -void extend_writeAll(void); -void dataset_readInd(void); -void dataset_readAll(void); -void extend_readInd(void); -void extend_readAll(void); -void none_selection_chunk(void); -void actual_io_mode_tests(void); -void no_collective_cause_tests(void); -void test_chunk_alloc(void); -void test_chunk_alloc_incr_ser_to_par(void); -void test_filter_read(void); -void compact_dataset(void); -void null_dataset(void); -void big_dataset(void); -void dataset_fillvalue(void); -void coll_chunk1(void); -void coll_chunk2(void); -void coll_chunk3(void); -void coll_chunk4(void); -void coll_chunk5(void); -void coll_chunk6(void); -void coll_chunk7(void); -void coll_chunk8(void); -void coll_chunk9(void); -void coll_chunk10(void); -void coll_irregular_cont_read(void); -void coll_irregular_cont_write(void); -void coll_irregular_simple_chunk_read(void); -void coll_irregular_simple_chunk_write(void); -void coll_irregular_complex_chunk_read(void); -void coll_irregular_complex_chunk_write(void); -void io_mode_confusion(void); -void rr_obj_hdr_flush_confusion(void); -void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm); -void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm); -void chunk_align_bug_1(void); -void lower_dim_size_comp_test(void); -void link_chunk_collective_io_test(void); +void test_plist_ed(const void *params); +void external_links(const void *params); +void zero_dim_dset(const void *params); +void test_file_properties(const void *params); +void test_delete(const void *params); +void test_invalid_libver_bounds_file_close_assert(const void *params); +void test_evict_on_close_parallel_unsupp(const void *params); +void test_fapl_preserve_hints(const void *params); +void multiple_dset_write(const void *params); +void multiple_group_write(const void *params); +void multiple_group_read(const void *params); +void collective_group_write_independent_group_read(const void *params); +void collective_group_write(const void *params); +void independent_group_read(const void *params); +void test_fapl_mpio_dup(const void *params); +void test_get_dxpl_mpio(const void *params); +void test_split_comm_access(const void *params); +void test_page_buffer_access(const void *params); +void dataset_atomicity(const void *params); +void dataset_writeInd(const void *params); +void dataset_writeAll(const void *params); +void extend_writeInd(const void *params); +void extend_writeInd2(const void *params); +void extend_writeAll(const void *params); +void dataset_readInd(const void *params); +void dataset_readAll(const void *params); +void extend_readInd(const void *params); +void extend_readAll(const void *params); +void none_selection_chunk(const void *params); +void actual_io_mode_tests(const void *params); +void no_collective_cause_tests(const void *params); +void test_chunk_alloc(const void *params); +void test_chunk_alloc_incr_ser_to_par(const void *params); +void test_filter_read(const void *params); +void compact_dataset(const void *params); +void null_dataset(const void *params); +void big_dataset(const void *params); +void dataset_fillvalue(const void *params); +void coll_chunk1(const void *params); +void coll_chunk2(const void *params); +void coll_chunk3(const void *params); +void coll_chunk4(const void *params); +void coll_chunk5(const void *params); +void coll_chunk6(const void *params); +void coll_chunk7(const void *params); +void coll_chunk8(const void *params); +void coll_chunk9(const void *params); +void coll_chunk10(const void *params); +void coll_irregular_cont_read(const void *params); +void coll_irregular_cont_write(const void *params); +void coll_irregular_simple_chunk_read(const void *params); +void coll_irregular_simple_chunk_write(const void *params); +void coll_irregular_complex_chunk_read(const void *params); +void coll_irregular_complex_chunk_write(const void *params); +void io_mode_confusion(const void *params); +void rr_obj_hdr_flush_confusion(const void *params); +void chunk_align_bug_1(const void *params); +void lower_dim_size_comp_test(const void *params); +void link_chunk_collective_io_test(const void *params); void contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type); void checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type); -void file_image_daisy_chain_test(void); +void file_image_daisy_chain_test(const void *params); #ifdef H5_HAVE_FILTER_DEFLATE -void compress_readAll(void); +void compress_readAll(const void *params); #endif /* H5_HAVE_FILTER_DEFLATE */ -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_coll_io_ind_md_write(void); -void test_oflush(void); +void test_dense_attr(const void *params); +void test_partial_no_selection_coll_md_read(const void *params); +void test_multi_chunk_io_addrmap_issue(const void *params); +void test_link_chunk_io_sort_chunk_issue(const void *params); +void test_collective_global_heap_write(const void *params); +void test_coll_io_ind_md_write(const void *params); +void test_oflush(const void *params); /* commonly used prototypes */ -hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type); MPI_Offset h5_mpi_get_file_size(const char *filename, MPI_Comm comm, MPI_Info info); int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original); -void point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, - hsize_t coords[], int order); #endif /* PHDF5TEST_H */