diff options
-rw-r--r-- | tools/h5diff/CMakeLists.txt | 102 | ||||
-rw-r--r-- | tools/h5diff/h5diff_common.c | 48 | ||||
-rw-r--r-- | tools/h5diff/h5diff_common.h | 3 | ||||
-rw-r--r-- | tools/h5diff/h5diff_main.c | 21 | ||||
-rw-r--r-- | tools/h5diff/ph5diff_main.c | 29 | ||||
-rw-r--r-- | tools/lib/h5diff.h | 14 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.h | 30 | ||||
-rw-r--r-- | tools/lib/ph5diff.h | 30 |
8 files changed, 171 insertions, 106 deletions
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index 1fc3bbe..95a599d 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -19,6 +19,15 @@ TARGET_LINK_LIBRARIES (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5diff) +IF (H5_HAVE_PARALLEL) + ADD_EXECUTABLE (ph5diff + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/ph5diff_main.c + ) + TARGET_NAMING (ph5diff ${LIB_TYPE}) + TARGET_LINK_LIBRARIES (ph5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +ENDIF (H5_HAVE_PARALLEL) + ############################################################################## ############################################################################## ### T E S T I N G ### @@ -329,8 +338,17 @@ IF (BUILD_TESTING) IF (NOT ${resultcode} STREQUAL "0") SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") ENDIF (NOT ${resultcode} STREQUAL "0") + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DIFF-${resultfile}") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( + NAME H5DIFF-clear-${resultfile}-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${resultfile}.out ${resultfile}.out.err + ) + ADD_TEST ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>" @@ -342,13 +360,46 @@ IF (BUILD_TESTING) -D "TEST_APPEND=EXIT CODE:" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES DEPENDS "H5DIFF-clear-${resultfile}-objects") ENDIF (HDF5_ENABLE_USING_MEMCHECKER) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DIFF-${resultfile}") + IF (H5_HAVE_PARALLEL) + ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) + ENDIF (H5_HAVE_PARALLEL) ENDMACRO (ADD_H5_TEST file) + MACRO (ADD_PH5_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME PH5DIFF-${resultfile} COMMAND $<TARGET_FILE:ph5diff> ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} ${ARGN}) + IF (NOT ${resultcode} STREQUAL "0") + SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") + ENDIF (NOT ${resultcode} STREQUAL "0") + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "PH5DIFF-${resultfile}") + ELSE (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST ( + NAME PH5DIFF-clear-${resultfile}-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${resultfile}_p.out ${resultfile}_p.out.err + ) + ADD_TEST ( + NAME PH5DIFF-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=${MPIEXEC};${MPIEXEC_PREFLAGS};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_POSTFLAGS};$<TARGET_FILE:ph5diff>" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=P_${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_SKIP_COMPARE=TRUE" + -P "${HDF5_RESOURCES_DIR}/prunTest.cmake" + ) + SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES DEPENDS "PH5DIFF-clear-${resultfile}-objects") + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_PH5_TEST file) + # ADD_H5_NO_OUTPUT_TEST # Purpose to verify only exitcode without output comparison # Don't use this if possible; this may be removed. @@ -428,9 +479,9 @@ IF (BUILD_TESTING) SET (ATTR_VERBOSE_LEVEL_FILE1 h5diff_attr_v_level1.h5) SET (ATTR_VERBOSE_LEVEL_FILE2 h5diff_attr_v_level2.h5) - - # Remove any output file left over from previous test run - ADD_TEST ( + IF (HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + ADD_TEST ( NAME H5DIFF-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -746,11 +797,12 @@ IF (BUILD_TESTING) h5diff_80.out.err h5diff_90.out h5diff_90.out.err - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DIFF-clearall-objects") + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DIFF-clearall-objects") + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) # ############################################################################ # # Common usage @@ -798,7 +850,6 @@ ADD_H5_TEST (h5diff_18 1 -q ${FILE1} ${FILE2}) # 1.8 -v and -q ADD_H5_TEST (h5diff_18_1 2 -v -q ${FILE1} ${FILE2}) - # ############################################################################## # # not comparable types # ############################################################################## @@ -834,8 +885,6 @@ ADD_H5_TEST (h5diff_27 1 -v ${FILE3} ${FILE3} t1 t2) # 2.8 ADD_H5_TEST (h5diff_28 1 -v ${FILE3} ${FILE3} l1 l2) - - # ############################################################################## # # Dataset datatypes # ############################################################################## @@ -871,19 +920,16 @@ ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg) # # Error messages # ############################################################################## - # 6.0: Check if the command line number of arguments is less than 3 ADD_H5_TEST (h5diff_600 1 ${FILE1}) # 6.1: Check if non-exist object name is specified ADD_H5_TEST (h5diff_601 2 ${FILE1} ${FILE1} nono_obj) - # ############################################################################## # # -d # ############################################################################## - # 6.3: negative value ADD_H5_TEST (h5diff_603 1 -d -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4) @@ -936,7 +982,6 @@ ADD_H5_TEST (h5diff_618 0 -p 2 ${FILE1} ${FILE2} g1/dset3 g1/dset4) # 6.19: number smaller than smallest difference ADD_H5_TEST (h5diff_619 1 -p 0.005 ${FILE1} ${FILE2} g1/dset3 g1/dset4) - # ############################################################################## # # -n # ############################################################################## @@ -1010,8 +1055,6 @@ ADD_H5_TEST (h5diff_709 0 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_F # file vs file ADD_H5_TEST (h5diff_710 1 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2}) - - # ############################################################################## # 8. all dataset datatypes # ############################################################################## @@ -1054,7 +1097,6 @@ ADD_H5_TEST (h5diff_204 0 -c ${FILE2} ${FILE2} g2/dset4 g2/dset5) ADD_H5_TEST (h5diff_205 0 -c ${FILE2} ${FILE2} g2/dset5 g2/dset6) - # not comparable in compound ADD_H5_TEST (h5diff_206 0 -c ${FILE2} ${FILE2} g2/dset7 g2/dset8) @@ -1150,7 +1192,6 @@ ADD_H5_TEST (h5diff_424 1 --follow-symlinks -v ${FILE18} ${FILE17} /dset2 /ext_l # extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2" ADD_H5_TEST (h5diff_425 1 --follow-symlinks -v ${FILE17} ${FILE17} /ext_link_to_slink1 /ext_link_to_slink2) - # ############################################################################## # # Dangling links compare (--follow-symlinks and --no-dangling-links) # ############################################################################## @@ -1232,7 +1273,6 @@ ADD_H5_TEST (h5diff_516 0 -v --follow-symlinks ${GRP_RECURSE1_EXT} ${GRP_RECURSE ADD_H5_TEST (h5diff_517 1 -v ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1} /g1) ADD_H5_TEST (h5diff_518 0 -v --follow-symlinks ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1} /g1) - # ############################################################################## # # Exclude path (--exclude-path) # ############################################################################## @@ -1272,8 +1312,7 @@ ADD_H5_TEST (h5diff_643 1 -v -d 5 --use-system-epsilon ${FILE1} ${FILE2} /g1/dse ADD_H5_TEST (h5diff_644 1 -v --use-system-epsilon -d 5 ${FILE1} ${FILE2} /g1/dset3 /g1/dset4) ADD_H5_TEST (h5diff_645 1 -v -p 0.05 --use-system-epsilon ${FILE1} ${FILE2} /g1/dset3 /g1/dset4) ADD_H5_TEST (h5diff_646 1 -v --use-system-epsilon -p 0.05 ${FILE1} ${FILE2} /g1/dset3 /g1/dset4) - - + ENDIF (BUILD_TESTING) ############################################################################## @@ -1293,3 +1332,14 @@ INSTALL ( COMPONENT toolsapplications ) + +IF (H5_HAVE_PARALLEL) + INSTALL ( + TARGETS + ph5diff + RUNTIME DESTINATION + ${HDF5_INSTALL_BIN_DIR}/tools + COMPONENT + toolsapplications + ) +ENDIF (H5_HAVE_PARALLEL) diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 141e81d..3427fbc 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -129,27 +129,27 @@ void parse_command_line(int argc, * short opt */ if (!strcmp (argv[i], "-v")) /* no arg */ - { + { opt_ind--; options->m_verbose_level = 0; break; - } + } else if (!strncmp (argv[i], "-v", 2)) - { + { options->m_verbose_level = atoi(&argv[i][2]); break; - } + } /* * long opt */ if (!strcmp (argv[i], "--verbose")) /* no arg */ - { + { options->m_verbose_level = 0; break; - } - else if ( !strncmp (argv[i], "--verbose", 9) && argv[i][9]=='=') - { + } + else if ( !strncmp (argv[i], "--verbose", 9) && argv[i][9]=='=') + { options->m_verbose_level = atoi(&argv[i][10]); break; } @@ -592,35 +592,3 @@ void usage(void) printf(" '/g1/dset1' and '/g1/dset2' in the same file\n"); printf("\n"); } - - -/*------------------------------------------------------------------------- - * Function: h5diff_exit - * - * Purpose: dismiss phdiff worker processes and exit - * - * Return: none - * - * Programmer: Albert Cheng - * Date: Feb 6, 2005 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -void h5diff_exit(int status) -{ -#ifdef H5_HAVE_PARALLEL - /* if in parallel mode, dismiss workers, close down MPI, then exit */ - if((g_nTasks > 1) && g_Parallel) { - phdiff_dismiss_workers(); - MPI_Barrier(MPI_COMM_WORLD); - } - if(g_Parallel) - MPI_Finalize(); -#endif - exit(status); -} - diff --git a/tools/h5diff/h5diff_common.h b/tools/h5diff/h5diff_common.h index c4035a6..5b1317f 100644 --- a/tools/h5diff/h5diff_common.h +++ b/tools/h5diff/h5diff_common.h @@ -24,9 +24,6 @@ extern "C" { #endif -H5TOOLS_DLLVAR unsigned char g_Parallel; -H5TOOLS_DLLVAR int g_nTasks; - void usage(void); void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* options); void h5diff_exit(int status); diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index 5113d3f..a014a9e 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -117,3 +117,24 @@ out: return ret; } +/*------------------------------------------------------------------------- + * Function: h5diff_exit + * + * Purpose: dismiss phdiff worker processes and exit + * + * Return: none + * + * Programmer: Albert Cheng + * Date: Feb 6, 2005 + * + * Comments: + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void h5diff_exit(int status) +{ + exit(status); +} + diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c index 871b93b..67b0c92 100644 --- a/tools/h5diff/ph5diff_main.c +++ b/tools/h5diff/ph5diff_main.c @@ -245,3 +245,32 @@ ph5diff_worker(int nID) } } +/*------------------------------------------------------------------------- + * Function: h5diff_exit + * + * Purpose: dismiss phdiff worker processes and exit + * + * Return: none + * + * Programmer: Albert Cheng + * Date: Feb 6, 2005 + * + * Comments: + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void h5diff_exit(int status) +{ + /* if in parallel mode, dismiss workers, close down MPI, then exit */ + if((g_nTasks > 1) && g_Parallel) { + phdiff_dismiss_workers(); + MPI_Barrier(MPI_COMM_WORLD); + } + if(g_Parallel) + MPI_Finalize(); + + exit(status); +} + diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 66c5188..1ff4402 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -82,6 +82,13 @@ H5TOOLS_DLL hsize_t h5diff(const char *fname1, const char *objname2, diff_opt_t *options); +H5TOOLS_DLL hsize_t diff( hid_t file1_id, + const char *path1, + hid_t file2_id, + const char *path2, + diff_opt_t *options, + diff_args_t *argdata); + #ifdef H5_HAVE_PARALLEL H5TOOLS_DLL void phdiff_dismiss_workers(void); H5TOOLS_DLL void print_manager_output(void); @@ -111,13 +118,6 @@ hsize_t diff_datasetid( hid_t dset1_id, const char *obj2_name, diff_opt_t *options); -hsize_t diff( hid_t file1_id, - const char *path1, - hid_t file2_id, - const char *path2, - diff_opt_t *options, - diff_args_t *argdata); - hsize_t diff_compare( hid_t file1_id, const char *file1_name, const char *obj1_name, diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 7cebd15..4d356c7 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -29,8 +29,14 @@ extern "C" { #endif /* ``parallel_print'' information */ -#define PRINT_DATA_MAX_SIZE 512 -#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4) +#define PRINT_DATA_MAX_SIZE 512 +#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4) + +H5TOOLS_DLLVAR int g_nTasks; +H5TOOLS_DLLVAR unsigned char g_Parallel; +H5TOOLS_DLLVAR char outBuff[]; +H5TOOLS_DLLVAR int outBuffOffset; +H5TOOLS_DLLVAR FILE * overflow_file; /* * begin get_option section @@ -41,7 +47,7 @@ H5TOOLS_DLLVAR const char *opt_arg; /* flag argument (or value) enum { no_arg = 0, /* doesn't take an argument */ - require_arg, /* requires an argument */ + require_arg, /* requires an argument */ optional_arg /* argument is optional */ }; @@ -52,23 +58,23 @@ enum { * the option. The long options are specified in the following way: * * struct long_options foo[] = { - * { "filename", require_arg, 'f' }, - * { "append", no_arg, 'a' }, - * { "width", require_arg, 'w' }, - * { NULL, 0, 0 } + * { "filename", require_arg, 'f' }, + * { "append", no_arg, 'a' }, + * { "width", require_arg, 'w' }, + * { NULL, 0, 0 } * }; * * Long named options can have arguments specified as either: * - * ``--param=arg'' or ``--param arg'' + * ``--param=arg'' or ``--param arg'' * * Short named options can have arguments specified as either: * - * ``-w80'' or ``-w 80'' + * ``-w80'' or ``-w 80'' * * and can have more than one short named option specified at one time: * - * -aw80 + * -aw80 * * in which case those options which expect an argument need to come at the * end. @@ -126,7 +132,7 @@ H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table table_t **dset_table, table_t **type_table); H5TOOLS_DLL obj_t *search_obj(table_t *temp, haddr_t objno); #ifndef H5_HAVE_TMPFILE -H5TOOLS_DLL FILE * tmpfile(void); +H5TOOLS_DLL FILE * tmpfile(void); #endif /************************************************************* @@ -168,4 +174,4 @@ H5TOOLS_DLL void h5tools_setstatus(int d_status); } #endif -#endif /* H5TOOLS_UTILS_H__ */ +#endif /* H5TOOLS_UTILS_H__ */ diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h index 9476a71..becbd6c 100644 --- a/tools/lib/ph5diff.h +++ b/tools/lib/ph5diff.h @@ -17,37 +17,31 @@ #define _PH5DIFF_H__ /* Send from manager to workers */ -#define MPI_TAG_ARGS 1 -#define MPI_TAG_PRINT_TOK 2 +#define MPI_TAG_ARGS 1 +#define MPI_TAG_PRINT_TOK 2 /*Sent from workers to manager */ -#define MPI_TAG_TOK_REQUEST 3 -#define MPI_TAG_DONE 4 -#define MPI_TAG_TOK_RETURN 5 -#define MPI_TAG_PRINT_DATA 6 +#define MPI_TAG_TOK_REQUEST 3 +#define MPI_TAG_DONE 4 +#define MPI_TAG_TOK_RETURN 5 +#define MPI_TAG_PRINT_DATA 6 /* Operational tags used to init and complete diff */ -#define MPI_TAG_END 7 -#define MPI_TAG_PARALLEL 8 - -H5TOOLS_DLLVAR int g_nTasks; -H5TOOLS_DLLVAR unsigned char g_Parallel; -H5TOOLS_DLLVAR char outBuff[]; -H5TOOLS_DLLVAR int outBuffOffset; -H5TOOLS_DLLVAR FILE * overflow_file; +#define MPI_TAG_END 7 +#define MPI_TAG_PARALLEL 8 struct diff_mpi_args { - char name1[256]; - char name2[256]; - diff_opt_t options; + char name1[256]; + char name2[256]; + diff_opt_t options; diff_args_t argdata; /* rest args */ }; struct diffs_found { hsize_t nfound; - int not_cmp; + int not_cmp; }; #ifdef H5_HAVE_PARALLEL |