summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/h5diff/CMakeLists.txt65
-rw-r--r--tools/h5diff/h5diff_common.c48
-rw-r--r--tools/h5diff/h5diff_common.h3
-rw-r--r--tools/h5diff/h5diff_main.c22
-rw-r--r--tools/h5diff/ph5diff_main.c29
-rw-r--r--tools/lib/CMakeLists.txt2
-rw-r--r--tools/lib/h5diff.h14
-rw-r--r--tools/lib/h5tools_utils.h6
-rw-r--r--tools/lib/ph5diff.h30
9 files changed, 136 insertions, 83 deletions
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
index f0e0695..4cc140a 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 ###
@@ -351,8 +360,38 @@ IF (BUILD_TESTING)
)
SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES DEPENDS "H5DIFF-clear-${resultfile}-objects")
ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
+ 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> ${ARGN})
+ IF (NOT ${resultcode} STREQUAL "0")
+ SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
+ ENDIF (NOT ${resultcode} STREQUAL "0")
+ ELSE (HDF5_ENABLE_USING_MEMCHECKER)
+ 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=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "PH5DIFF-${resultfile}")
+ ENDMACRO (ADD_PH5_TEST file)
+
##############################################################################
##############################################################################
### T H E T E S T S ###
@@ -774,7 +813,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
# ##############################################################################
@@ -810,8 +848,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
# ##############################################################################
@@ -847,19 +883,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)
@@ -912,7 +945,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
# ##############################################################################
@@ -979,8 +1011,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
# ##############################################################################
@@ -1023,7 +1053,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)
@@ -1119,7 +1148,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)
# ##############################################################################
@@ -1201,7 +1229,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)
# ##############################################################################
@@ -1241,8 +1268,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)
##############################################################################
@@ -1262,3 +1288,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 824c529..a014a9e 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -15,6 +15,7 @@
#include <stdlib.h>
#include <assert.h>
+#include <memory.h>
#include "h5diff.h"
#include "h5diff_common.h"
#include "h5tools_utils.h"
@@ -116,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/CMakeLists.txt b/tools/lib/CMakeLists.txt
index 123eafc..1e8afa1 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -68,7 +68,7 @@ IF (APPLE)
IF (HDF5_BUILD_WITH_INSTALL_NAME)
SET_TARGET_PROPERTIES(${HDF5_TOOLS_LIB_TARGET} PROPERTIES
LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}"
- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib/tools"
+ INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME}
)
ENDIF (HDF5_BUILD_WITH_INSTALL_NAME)
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 88ab7ea..a7d06f7 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -32,6 +32,12 @@ extern "C" {
#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
*/
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