summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2005-01-26 23:03:29 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2005-01-26 23:03:29 (GMT)
commit42754e6246d6916d88720b32a4a2d2b6cbabb312 (patch)
treec6999853ed938b197eea6e40c1c9f9907e2a7a7a /tools
parent3cb812ae8a610f5e3801c89f915c680a3f1a4f5b (diff)
downloadhdf5-42754e6246d6916d88720b32a4a2d2b6cbabb312.zip
hdf5-42754e6246d6916d88720b32a4a2d2b6cbabb312.tar.gz
hdf5-42754e6246d6916d88720b32a4a2d2b6cbabb312.tar.bz2
[svn-r9872] Purpose:
New feature. Description: Added new tool ph5diff. (Code done by Leon Arber.) Code is changed but test is not working yet. For now, it skipped all tests. Platforms tested: Tested in heping, serial and parallel modes.
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/h5diff_main.c631
-rwxr-xr-xtools/h5diff/testh5diff.sh4
-rw-r--r--tools/lib/h5diff.c1108
-rw-r--r--tools/lib/h5diff.h217
-rw-r--r--tools/lib/h5diff_array.c4067
-rw-r--r--tools/lib/h5diff_attr.c8
-rw-r--r--tools/lib/h5diff_dset.c18
-rw-r--r--tools/lib/h5diff_util.c49
-rw-r--r--tools/lib/ph5diff.h57
9 files changed, 3316 insertions, 2843 deletions
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index ff3b2e1..bab980a 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -13,6 +13,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5diff.h"
+#include "ph5diff.h"
#include <stdlib.h>
#include <assert.h>
@@ -20,11 +21,10 @@ static void usage(void);
static int check_n_input( const char* );
static int check_f_input( const char* );
-
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose: h5diff main program
+ * Purpose: ph5diff main program
*
* Return: An exit status of 0 means no differences were found, 1 means some
* differences were found.
@@ -42,193 +42,310 @@ static int check_f_input( const char* );
* Verbose mode: print the above plus a list of objects and warnings
* Quiet mode: do not print output
*
+ * November 2004: Leon Arber (larber@uiuc.edu)
+ * Additions that allow h5diff to be run in parallel
*-------------------------------------------------------------------------
*/
int main(int argc, const char *argv[])
{
- int i;
- const char *s = NULL;
- const char *fname1 = NULL;
- const char *fname2 = NULL;
- const char *objname1 = NULL;
- const char *objname2 = NULL;
- hsize_t nfound=0;
- int ret;
- diff_opt_t options;
-
- memset(&options, 0, sizeof (diff_opt_t));
+ int i;
+ const char *s = NULL;
+ const char *fname1 = NULL;
+ const char *fname2 = NULL;
+ const char *objname1 = NULL;
+ const char *objname2 = NULL;
+ hsize_t nfound=0;
+ int ret;
+ diff_opt_t options;
-/*-------------------------------------------------------------------------
- * initial check of command line options
- *-------------------------------------------------------------------------
- */
+#ifdef H5_HAVE_PH5DIFF
+ int nID;
+ MPI_Status Status;
- if ( argc==2 && (strcmp("-h",argv[1])==0) )
- usage();
-
- if ( argc<3 )
- {
- printf("Number of arguments is only %d\n", argc );
- usage();
- }
-/*-------------------------------------------------------------------------
- * file names are first
- *-------------------------------------------------------------------------
- */
- if ( argc>=3 )
- {
- fname1 = argv[1];
- fname2 = argv[2];
- }
-/*-------------------------------------------------------------------------
- * parse command line options
- *-------------------------------------------------------------------------
- */
- for (i=3; i<argc ; i++)
- {
- /* get the single-letter switches */
- if ( '-'==argv[i][0] )
- {
- for (s=argv[i]+1; *s; s++)
- {
- switch (*s) {
- default:
- printf("-%s is an invalid option\n", s );
- usage();
- break;
- case 'h':
- usage();
- break;
- case 'v':
- options.m_verbose = 1;
- break;
- case 'q':
- /* use quiet mode; supress the message "0 differences found" */
- options.m_quiet = 1;
- break;
- case 'r':
- options.m_report = 1;
- break;
- case 'd':
- /* if it is not another option */
- if ( i<argc-1 &&'-' != argv[i+1][0] )
- {
- options.d=1;
- if ( check_f_input(argv[i+1])==-1)
- {
- printf("<-d %s> is not a valid option\n", argv[i+1] );
- usage();
- }
- options.delta = atof(argv[i+1]);
- i++; /* go to next */
- }
- else
- {
- printf("Not a valid -d option\n");
- usage();
- }
- break;
- case 'p':
- if ( i<argc-1 &&'-' !=argv[i+1][0] )
- {
- options.p=1;
- if ( check_f_input(argv[i+1])==-1)
- {
- printf("<-p %s> is not a valid option\n", argv[i+1] );
- usage();
- }
- options.percent = atof(argv[i+1]);
- i++; /* go to next */
- }
- else
- {
- printf("Not a valid -p option\n");
- usage();
- }
- break;
- case 'n':
- if ( i<argc-1 && '-' !=argv[i+1][0] )
- {
- options.n=1;
- if ( check_n_input(argv[i+1])==-1)
- {
- printf("<-n %s> is not a valid option\n", argv[i+1] );
- usage();
- }
- options.count = atoi(argv[i+1]);
- i++; /* go to next */
- }
- else
- {
- printf("Not a valid -n option\n");
- usage();
- }
- break;
- } /*switch*/
- } /*for*/
- } /*if*/
-
- else /* not single-letter switches */
-
- {
- /* check if it is not a -d, -p parameter */
- if ( '-'==argv[i-1][0] && ('d'==argv[i-1][1] ||'p'==argv[i-1][1] ))
- continue;
- else
- {
- if ( objname1==NULL )
- objname1 = argv[i];
- if ( objname2==NULL )
+ /*-------------------------------------------------------------------------
+ * Initialize the MPI environment
+ *-------------------------------------------------------------------------
+ */
+ MPI_Init(&argc, (char***) &argv);
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &nID);
+ MPI_Comm_size(MPI_COMM_WORLD, &g_nTasks);
+
+ if(g_nTasks < 2)
{
- /* check if we have a second object name */
- if ( i+1<argc && '-' !=argv[i+1][0] ) {
- /* yes */
- objname2 = argv[i+1];
- i++; /* go to next */
- }
- else
- /* no */
- objname2 = objname1;
- } /*objname2*/
- } /*else*/
- } /*else*/
-
- }/*for*/
-
- nfound = h5diff(fname1,fname2,objname1,objname2,&options);
+ printf("Must have at least 2 tasks to run parallel diff\n");
+ MPI_Finalize();
+ exit(-1);
+ }
-/*-------------------------------------------------------------------------
- * print how many differences were found
- *-------------------------------------------------------------------------
- */
- if (!options.m_quiet)
- {
- if (options.cmn_objs==0)
- {
- printf("No common objects found. Files are not comparable.\n");
- if (!options.m_verbose)
- printf("Use -v for a list of objects.\n");
- }
- else
- {
- if (!options.err_stat)
- print_found(nfound);
- }
- }
+ /* Have the manager process the command-line */
+ if(nID == 0)
+ {
+#endif
+ memset(&options, 0, sizeof (diff_opt_t));
-/*-------------------------------------------------------------------------
- * exit code
- * >0 if differences, 0 if no differences, <0 if error
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * initial check of command line options
+ *-------------------------------------------------------------------------
+ */
+
+ if ( argc==2 && (strcmp("-h",argv[1])==0) )
+ usage();
+
+ if ( argc<3 )
+ {
+ printf("Number of arguments is only %d\n", argc );
+ usage();
+ }
+
+ /*-------------------------------------------------------------------------
+ * file names are first
+ *-------------------------------------------------------------------------
+ */
+ if ( argc>=3 )
+ {
+ fname1 = argv[1];
+ fname2 = argv[2];
+ }
+ /*-------------------------------------------------------------------------
+ * parse command line options
+ *-------------------------------------------------------------------------
+ */
+ for (i=3; i<argc ; i++)
+ {
+ /* get the single-letter switches */
+ if ( '-'==argv[i][0] )
+ {
+ for (s=argv[i]+1; *s; s++)
+ {
+ switch (*s) {
+ default:
+ printf("-%s is an invalid option\n", s );
+ usage();
+ break;
+ case 'h':
+ usage();
+ break;
+ case 'v':
+ options.m_verbose = 1;
+ break;
+ case 'q':
+ /* use quiet mode; supress the message "0 differences found" */
+ options.m_quiet = 1;
+ break;
+ case 'r':
+ options.m_report = 1;
+ break;
+ case 'd':
+ /* if it is not another option */
+ if ( i<argc-1 &&'-' != argv[i+1][0] )
+ {
+ options.d=1;
+ if ( check_f_input(argv[i+1])==-1)
+ {
+ printf("<-d %s> is not a valid option\n", argv[i+1] );
+ usage();
+ }
+ options.delta = atof(argv[i+1]);
+ i++; /* go to next */
+ }
+ else
+ {
+ printf("Not a valid -d option\n");
+ usage();
+ }
+ break;
+ case 'p':
+ if ( i<argc-1 &&'-' !=argv[i+1][0] )
+ {
+ options.p=1;
+ if ( check_f_input(argv[i+1])==-1)
+ {
+ printf("<-p %s> is not a valid option\n", argv[i+1] );
+ usage();
+ }
+ options.percent = atof(argv[i+1]);
+ i++; /* go to next */
+ }
+ else
+ {
+ printf("Not a valid -p option\n");
+ usage();
+ }
+ break;
+ case 'n':
+ if ( i<argc-1 && '-' !=argv[i+1][0] )
+ {
+ options.n=1;
+ if ( check_n_input(argv[i+1])==-1)
+ {
+ printf("<-n %s> is not a valid option\n", argv[i+1] );
+ usage();
+ }
+ options.count = atoi(argv[i+1]);
+ i++; /* go to next */
+ }
+ else
+ {
+ printf("Not a valid -n option\n");
+ usage();
+ }
+ break;
+ } /*switch*/
+ } /*for*/
+ } /*if*/
+
+ else /* not single-letter switches */
- ret= (nfound==0 ? 0 : 1 );
- if (options.err_stat)
- ret=-1;
- return ret;
-
+ {
+ /* check if it is not a -d, -p parameter */
+ if ( '-'==argv[i-1][0] && ('d'==argv[i-1][1] ||'p'==argv[i-1][1] ))
+ continue;
+ else
+ {
+ if ( objname1==NULL )
+ objname1 = argv[i];
+ if ( objname2==NULL )
+ {
+ /* check if we have a second object name */
+ if ( i+1<argc && '-' !=argv[i+1][0] ) {
+ /* yes */
+ objname2 = argv[i+1];
+ i++; /* go to next */
+ }
+ else
+ /* no */
+ objname2 = objname1;
+ } /*objname2*/
+ } /*else*/
+ } /*else*/
+
+ }/*for*/
+
+ nfound = h5diff(fname1,fname2,objname1,objname2,&options);
+
+#ifdef H5_HAVE_PH5DIFF
+ MPI_Barrier(MPI_COMM_WORLD);
+#endif
+
+ /*-------------------------------------------------------------------------
+ * print how many differences were found
+ *-------------------------------------------------------------------------
+ */
+ if (!options.m_quiet)
+ {
+ if (options.cmn_objs==0)
+ {
+ printf("No common objects found. Files are not comparable.\n");
+ if (!options.m_verbose)
+ printf("Use -v for a list of objects.\n");
+ }
+ else
+ {
+ if (!options.err_stat)
+ print_found(nfound);
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * exit code
+ * >0 if differences, 0 if no differences, <0 if error
+ *-------------------------------------------------------------------------
+ */
+
+#ifdef H5_HAVE_PH5DIFF
+ MPI_Finalize();
+#endif
+
+ ret= (nfound==0 ? 0 : 1 );
+ if (options.err_stat)
+ ret=-1;
+ return ret;
+#ifdef H5_HAVE_PH5DIFF
+ }
+ /* All the other tasks just sit around and wait to be assigned something to diff */
+ else
+ {
+ struct diff_args args;
+ hid_t file1_id, file2_id;
+ char filenames[2][255];
+
+ outBuffOffset = 0;
+
+ MPI_Recv(filenames, 255*2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+ if(Status.MPI_TAG == MPI_TAG_PARALLEL)
+ {
+ printf("We're in parallel mode...opening the files\n");
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* Open the files */
+ if ((file1_id = H5Fopen (filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ {
+ printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, fname1);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ }
+ if ((file2_id = H5Fopen (filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ {
+ printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, fname2);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ }
+ /* enable error reporting */
+ }
+ H5E_END_TRY;
+
+
+ while(1)
+ {
+ MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+
+ if(Status.MPI_TAG == MPI_TAG_ARGS)
+ {
+ /*Recv parameters for diff from manager task */
+ MPI_Recv(&args, sizeof(struct diff_args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status);
+ /*Do the diff */
+ nfound = diff(file1_id, args.name, file2_id, args.name, &(args.options), args.type);
+
+ /*If print buffer has something in it, request print token.*/
+ if(outBuffOffset>0)
+ {
+ MPI_Send(NULL, 0, MPI_BYTE, 0, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD);
+
+ /*Wait for print token. */
+ MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status);
+
+ /*When get token, print stuff out and return token */
+ printf("%s", outBuff);
+ memset(outBuff, 0, OUTBUFF_SIZE);
+ outBuffOffset = 0;
+
+ MPI_Send(&nfound, 1, MPI_LONG_LONG, 0, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD);
+ }
+ else
+ MPI_Send(&nfound, 1, MPI_LONG_LONG, 0, MPI_TAG_DONE, MPI_COMM_WORLD);
+
+ }
+ else if(Status.MPI_TAG == MPI_TAG_END)
+ {
+ MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status);
+ printf("exiting..., task: %d\n", nID);
+ break;
+ }
+ else
+ {
+ printf("ERROR....invalid tag received\n");
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ }
+
+ }
+ }
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Finalize();
+ }
+#endif
}
/*-------------------------------------------------------------------------
@@ -248,25 +365,25 @@ int main(int argc, const char *argv[])
*
*-------------------------------------------------------------------------
*/
-static
+ static
int check_n_input( const char *str )
{
- unsigned i;
- char c;
-
- for ( i = 0; i < strlen(str); i++)
- {
- c = str[i];
- if ( i==0 )
- {
- if ( c < 49 || c > 57 ) /* ascii values between 1 and 9 */
- return -1;
- }
- else
- if ( c < 48 || c > 57 ) /* 0 also */
- return -1;
- }
- return 1;
+ unsigned i;
+ char c;
+
+ for ( i = 0; i < strlen(str); i++)
+ {
+ c = str[i];
+ if ( i==0 )
+ {
+ if ( c < 49 || c > 57 ) /* ascii values between 1 and 9 */
+ return -1;
+ }
+ else
+ if ( c < 48 || c > 57 ) /* 0 also */
+ return -1;
+ }
+ return 1;
}
/*-------------------------------------------------------------------------
@@ -284,23 +401,23 @@ int check_n_input( const char *str )
*
*-------------------------------------------------------------------------
*/
-static
+ static
int check_f_input( const char *str )
{
- double x;
+ double x;
- /*
- the atof return value on a hexadecimal input is different
- on some systems; we do a character check for this
- */
- if (strlen(str)>2 && str[0]=='0' && str[1]=='x')
- return -1;
-
- x=atof(str);
- if (x==0)
- return -1;
-
- return 1;
+ /*
+ the atof return value on a hexadecimal input is different
+ on some systems; we do a character check for this
+ */
+ if (strlen(str)>2 && str[0]=='0' && str[1]=='x')
+ return -1;
+
+ x=atof(str);
+ if (x==0)
+ return -1;
+
+ return 1;
}
/*-------------------------------------------------------------------------
@@ -312,57 +429,57 @@ int check_f_input( const char *str )
*
*-------------------------------------------------------------------------
*/
-static
+ static
void usage(void)
{
- printf("Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] \n");
- printf("\n");
- printf("file1 File name of the first HDF5 file\n");
- printf("file2 File name of the second HDF5 file\n");
- printf("[obj1] Name of an HDF5 object, in absolute path\n");
- printf("[obj2] Name of an HDF5 object, in absolute path\n");
- printf("[OPTIONS] are:\n");
- printf("[-h] Print out this information\n");
- printf("[-r] Report mode. Print the differences\n");
- printf("[-v] Verbose mode. Print the differences, list of objects, warnings\n");
- printf("[-q] Quiet mode. Do not do output\n");
- printf("[-n count] Print difference up to count number\n");
- printf("[-d delta] Print difference when it is greater than limit delta\n");
- printf("[-p relative] Print difference when it is greater than a relative limit\n");
- printf("\n");
- printf("Items in [] are optional\n");
- printf("[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)\n");
- printf("The 'count' value must be a positive integer\n");
- printf("The 'delta' and 'relative' values must be positive numbers\n");
- printf("The -d compare criteria is |a - b| > delta\n");
- printf("The -p compare criteria is |1 - b/a| > relative\n");
- printf("\n");
- printf("h5diff has four modes of output:\n");
- printf(" Normal mode: print the number of differences found and where they occured\n");
- printf(" Report mode: print the above plus the differences\n");
- printf(" Verbose mode: print the above plus a list of objects and warnings\n");
- printf(" Quiet mode: do not print output (h5diff always returns an exit code of 1 when differences are found)\n");
- printf("\n");
- printf("Examples of use:\n");
- printf("\n");
- printf("1) h5diff file1 file2 /g1/dset1 /g1/dset2\n");
- printf("\n");
- printf(" Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n");
- printf("\n");
- printf("2) h5diff file1 file2 /g1/dset1\n");
- printf("\n");
- printf(" Compares object '/g1/dset1' in both files\n");
- printf("\n");
- printf("3) h5diff file1 file2\n");
- printf("\n");
- printf(" Compares all objects in both files\n");
- printf("\n");
- printf("Note) file1 and file2 can be the same file. Use\n");
- printf("\n");
- printf(" h5diff file1 file1 /g1/dset1 /g1/dset2\n");
- printf("\n");
- printf(" to compare '/g1/dset1' and '/g1/dset2' in the same file\n");
- exit(0);
+ printf("Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] \n");
+ printf("\n");
+ printf("file1 File name of the first HDF5 file\n");
+ printf("file2 File name of the second HDF5 file\n");
+ printf("[obj1] Name of an HDF5 object, in absolute path\n");
+ printf("[obj2] Name of an HDF5 object, in absolute path\n");
+ printf("[OPTIONS] are:\n");
+ printf("[-h] Print out this information\n");
+ printf("[-r] Report mode. Print the differences\n");
+ printf("[-v] Verbose mode. Print the differences, list of objects, warnings\n");
+ printf("[-q] Quiet mode. Do not do output\n");
+ printf("[-n count] Print difference up to count number\n");
+ printf("[-d delta] Print difference when it is greater than limit delta\n");
+ printf("[-p relative] Print difference when it is greater than a relative limit\n");
+ printf("\n");
+ printf("Items in [] are optional\n");
+ printf("[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)\n");
+ printf("The 'count' value must be a positive integer\n");
+ printf("The 'delta' and 'relative' values must be positive numbers\n");
+ printf("The -d compare criteria is |a - b| > delta\n");
+ printf("The -p compare criteria is |1 - b/a| > relative\n");
+ printf("\n");
+ printf("h5diff has four modes of output:\n");
+ printf(" Normal mode: print the number of differences found and where they occured\n");
+ printf(" Report mode: print the above plus the differences\n");
+ printf(" Verbose mode: print the above plus a list of objects and warnings\n");
+ printf(" Quiet mode: do not print output (h5diff always returns an exit code of 1 when differences are found)\n");
+ printf("\n");
+ printf("Examples of use:\n");
+ printf("\n");
+ printf("1) h5diff file1 file2 /g1/dset1 /g1/dset2\n");
+ printf("\n");
+ printf(" Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n");
+ printf("\n");
+ printf("2) h5diff file1 file2 /g1/dset1\n");
+ printf("\n");
+ printf(" Compares object '/g1/dset1' in both files\n");
+ printf("\n");
+ printf("3) h5diff file1 file2\n");
+ printf("\n");
+ printf(" Compares all objects in both files\n");
+ printf("\n");
+ printf("Note) file1 and file2 can be the same file. Use\n");
+ printf("\n");
+ printf(" h5diff file1 file1 /g1/dset1 /g1/dset2\n");
+ printf("\n");
+ printf(" to compare '/g1/dset1' and '/g1/dset2' in the same file\n");
+ exit(0);
}
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 91a2eb5..f8e70d7 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -47,6 +47,9 @@ TESTING() {
# non-zero value.
#
TOOLTEST() {
+ if test -n "$RUNPARALLEL"; then
+ echo $* SKIPPED
+ else
expect="$srcdir/../testfiles/$1"
actual="../testfiles/`basename $1 .txt`.out"
actual_err="../testfiles/`basename $1 .txt`.err"
@@ -86,6 +89,7 @@ TOOLTEST() {
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err
fi
+ fi
}
##############################################################################
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 592b016..1807f4b 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -14,7 +14,8 @@
#include <stdlib.h>
#include "h5diff.h"
-#include "H5private.h"
+#include "H5private.h"
+#include "ph5diff.h"
@@ -26,9 +27,10 @@
* 2) when diff was found (normal mode)
*-------------------------------------------------------------------------
*/
-int print_objname(diff_opt_t *options, hsize_t nfound)
+int
+print_objname (diff_opt_t * options, hsize_t nfound)
{
- return ( (options->m_verbose || nfound) && !options->m_quiet) ?1:0;
+ return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0;
}
/*-------------------------------------------------------------------------
@@ -46,123 +48,162 @@ int print_objname(diff_opt_t *options, hsize_t nfound)
*-------------------------------------------------------------------------
*/
-hsize_t h5diff(const char *fname1,
- const char *fname2,
- const char *objname1,
- const char *objname2,
- diff_opt_t *options)
+hsize_t
+h5diff (const char *fname1,
+ const char *fname2,
+ const char *objname1, const char *objname2, diff_opt_t * options)
{
- int nobjects1, nobjects2;
- trav_info_t *info1=NULL;
- trav_info_t *info2=NULL;
- hid_t file1_id=(-1), file2_id=(-1);
- hsize_t nfound=0;
-
- if (options->m_quiet &&
- (options->m_verbose || options->m_report))
- {
- printf("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
- options->err_stat=1;
- return 0;
- }
+ int nobjects1, nobjects2, i;
+ trav_info_t *info1 = NULL;
+ trav_info_t *info2 = NULL;
+ hid_t file1_id=(-1), file2_id=(-1);
+ char filenames[2][255];
+ hsize_t nfound = 0;
+
+ memset(filenames, 0, 255*2);
+
+
+ if (options->m_quiet && (options->m_verbose || options->m_report))
+ {
+ printf
+ ("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
+ options->err_stat = 1;
+ return 0;
+ }
/*-------------------------------------------------------------------------
* open the files first; if they are not valid, no point in continuing
*-------------------------------------------------------------------------
*/
- /* disable error reporting */
- H5E_BEGIN_TRY {
- /* Open the files */
- if ((file1_id=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
- {
- printf("h5diff: <%s>: unable to open file\n", fname1 );
- options->err_stat=1;
- goto out;
- }
- if ((file2_id=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
- {
- printf("h5diff: <%s>: unable to open file\n", fname2 );
- options->err_stat=1;
- goto out;
- }
- /* enable error reporting */
- } H5E_END_TRY;
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* Open the files */
+ if ((file1_id = H5Fopen (fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ {
+ printf ("h5diff: <%s>: unable to open file\n", fname1);
+ options->err_stat = 1;
+
+#ifdef H5_HAVE_PH5DIFF
+ /* Let tasks know that they won't be needed */
+ for(i=1; i<g_nTasks; i++)
+ MPI_Send(filenames, 255*2, MPI_CHAR, i, MPI_TAG_END, MPI_COMM_WORLD);
+#endif
+
+ goto out;
+ }
+ if ((file2_id = H5Fopen (fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ {
+ printf ("h5diff: <%s>: unable to open file\n", fname2);
+ options->err_stat = 1;
+
+#ifdef H5_HAVE_PH5DIFF
+ /* Let tasks know that they won't be needed */
+ for(i=1; i<g_nTasks; i++)
+ MPI_Send(filenames, 255*2, MPI_CHAR, i, MPI_TAG_END, MPI_COMM_WORLD);
+#endif
+
+ goto out;
+ }
+ /* enable error reporting */
+ }
+ H5E_END_TRY;
/*-------------------------------------------------------------------------
* get the number of objects in the files
*-------------------------------------------------------------------------
*/
- nobjects1 = h5trav_getinfo( file1_id, NULL, 0 );
- nobjects2 = h5trav_getinfo( file2_id, NULL, 0 );
+ nobjects1 = h5trav_getinfo (file1_id, NULL, 0);
+ nobjects2 = h5trav_getinfo (file2_id, NULL, 0);
- if (nobjects1<0 || nobjects2<0)
- {
- printf("Error: Could not get get file contents\n");
- options->err_stat=1;
- goto out;
- }
+ if (nobjects1 < 0 || nobjects2 < 0)
+ {
+ printf ("Error: Could not get get file contents\n");
+ options->err_stat = 1;
+ goto out;
+ }
- assert(nobjects1>0);
- assert(nobjects2>0);
+ assert (nobjects1 > 0);
+ assert (nobjects2 > 0);
/*-------------------------------------------------------------------------
* get the list of objects in the files
*-------------------------------------------------------------------------
*/
- info1 = (trav_info_t*) malloc( nobjects1 * sizeof(trav_info_t));
- info2 = (trav_info_t*) malloc( nobjects2 * sizeof(trav_info_t));
- if (info1==NULL || info2==NULL)
- {
- printf("Error: Not enough memory for object list\n");
- options->err_stat=1;
- if (info1) h5trav_freeinfo(info1,nobjects1);
- if (info2) h5trav_freeinfo(info2,nobjects1);
- goto out;
- }
-
- h5trav_getinfo( file1_id, info1, 0 );
- h5trav_getinfo( file2_id, info2, 0 );
+ info1 = (trav_info_t *) malloc (nobjects1 * sizeof (trav_info_t));
+ info2 = (trav_info_t *) malloc (nobjects2 * sizeof (trav_info_t));
+ if (info1 == NULL || info2 == NULL)
+ {
+ printf ("Error: Not enough memory for object list\n");
+ options->err_stat = 1;
+ if (info1)
+ h5trav_freeinfo (info1, nobjects1);
+ if (info2)
+ h5trav_freeinfo (info2, nobjects1);
+ goto out;
+ }
+
+ h5trav_getinfo (file1_id, info1, 0);
+ h5trav_getinfo (file2_id, info2, 0);
/*-------------------------------------------------------------------------
* object name was supplied
*-------------------------------------------------------------------------
*/
- if ( objname1 )
- {
- assert(objname2);
- options->cmn_objs=1; /* eliminate warning */
- nfound=diff_compare(file1_id,fname1,objname1,nobjects1,info1,
- file2_id,fname2,objname2,nobjects2,info2,options);
- }
+ if (objname1)
+ {
+
+#ifdef H5_HAVE_PH5DIFF
+ /* Let tasks know that they won't be needed */
+ for(i=1; i<g_nTasks; i++)
+ MPI_Send(filenames, 255*2, MPI_CHAR, i, MPI_TAG_END, MPI_COMM_WORLD);
+#endif
+ assert (objname2);
+ options->cmn_objs = 1; /* eliminate warning */
+ nfound = diff_compare (file1_id, fname1, objname1, nobjects1, info1,
+ file2_id, fname2, objname2, nobjects2, info2,
+ options);
+ }
/*-------------------------------------------------------------------------
* compare all
*-------------------------------------------------------------------------
*/
- else
- {
- nfound=diff_match(file1_id,nobjects1,info1,
- file2_id,nobjects2,info2,options);
- }
-
-
- h5trav_freeinfo(info1,nobjects1);
- h5trav_freeinfo(info2,nobjects2);
+ else
+ {
+
+#ifdef H5_HAVE_PH5DIFF
+ strncpy(filenames[0], fname1, 255);
+ strncpy(filenames[1], fname2, 255);
+
+ /* Alert the worker tasks that there's going to be work. */
+
+ for(i=1; i<g_nTasks; i++)
+ MPI_Send(filenames, 255*2, MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD);
+#endif
+ nfound = diff_match (file1_id, nobjects1, info1,
+ file2_id, nobjects2, info2, options);
+ }
-out:
- /* close */
- H5E_BEGIN_TRY {
- H5Fclose(file1_id);
- H5Fclose(file2_id);
- } H5E_END_TRY;
+ h5trav_freeinfo (info1, nobjects1);
+ h5trav_freeinfo (info2, nobjects2);
- return nfound;
+out:
+ /* close */
+ H5E_BEGIN_TRY
+ {
+ H5Fclose (file1_id);
+ H5Fclose (file2_id);
+ }
+ H5E_END_TRY;
+
+ return nfound;
}
@@ -182,141 +223,338 @@ out:
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_match( hid_t file1_id,
- int nobjects1,
- trav_info_t *info1,
- hid_t file2_id,
- int nobjects2,
- trav_info_t *info2,
- diff_opt_t *options )
+hsize_t
+diff_match (hid_t file1_id,
+ int nobjects1,
+ trav_info_t * info1,
+ hid_t file2_id,
+ int nobjects2, trav_info_t * info2, diff_opt_t * options)
{
- int more_names_exist = (nobjects1>0 && nobjects2>0) ? 1 : 0;
- trav_table_t *table=NULL;
- int cmp;
- int curr1=0;
- int curr2=0;
- unsigned infile[2];
- char c1, c2;
- hsize_t nfound=0;
- int i;
-
-/*-------------------------------------------------------------------------
- * build the list
- *-------------------------------------------------------------------------
- */
- trav_table_init( &table );
-
- while ( more_names_exist )
- {
- /* criteria is string compare */
- cmp = strcmp( info1[curr1].name, info2[curr2].name );
- if ( cmp == 0 )
- {
- infile[0]=1; infile[1]=1;
- trav_table_addflags(infile, info1[curr1].name, info1[curr1].type, table );
-
- curr1++;
- curr2++;
- }
- else if ( cmp < 0 )
- {
- infile[0]=1; infile[1]=0;
- trav_table_addflags(infile, info1[curr1].name, info1[curr1].type, table );
- curr1++;
- }
- else
- {
- infile[0]=0; infile[1]=1;
- trav_table_addflags(infile, info2[curr2].name, info2[curr2].type, table );
- curr2++;
- }
-
- more_names_exist = (curr1<nobjects1 && curr2<nobjects2) ? 1 : 0;
-
-
- } /* end while */
-
- /* list1 did not end */
- if (curr1<nobjects1)
- {
- while ( curr1<nobjects1 )
- {
- infile[0]=1; infile[1]=0;
- trav_table_addflags(infile, info1[curr1].name, info1[curr1].type, table );
- curr1++;
- }
- }
-
- /* list2 did not end */
- if (curr2<nobjects2)
- {
- while ( curr2<nobjects2 )
- {
- infile[0]=0; infile[1]=1;
- trav_table_addflags(infile, info2[curr2].name, info2[curr2].type, table );
- curr2++;
- }
- }
-
-/*-------------------------------------------------------------------------
- * print the list
- *-------------------------------------------------------------------------
- */
-
- if (options->m_verbose)
- {
- printf("\n");
- printf("file1 file2\n");
- printf("---------------------------------------\n");
- for (i = 0; i < table->nobjs; i++)
- {
- c1 = (table->objs[i].flags[0]) ? 'x' : ' ';
- c2 = (table->objs[i].flags[1]) ? 'x' : ' ';
- printf("%5c %6c %-15s\n", c1, c2, table->objs[i].name);
- }
- printf("\n");
- }
-
-
-/*-------------------------------------------------------------------------
- * do the diff for common objects
- *-------------------------------------------------------------------------
- */
-
- for (i = 0; i < table->nobjs; i++)
- {
- if ( table->objs[i].flags[0] && table->objs[i].flags[1] )
- {
- options->cmn_objs=1;
- nfound+=diff( file1_id,
- table->objs[i].name,
- file2_id,
- table->objs[i].name,
- options,
- table->objs[i].type );
- }
- }
-
- /* free table */
- trav_table_free(table);
-
-
-/*-------------------------------------------------------------------------
- * do the diff for the root.
- * this is a special case, we get an ID for the root group and call diff()
- * with this ID; it compares only the root group attributes
- *-------------------------------------------------------------------------
- */
-
- nfound+=diff( file1_id,
- "/",
- file2_id,
- "/",
- options,
- H5G_GROUP );
-
-
- return nfound;
+ int more_names_exist = (nobjects1 > 0 && nobjects2 > 0) ? 1 : 0;
+ trav_table_t *table = NULL;
+ int cmp;
+ int curr1 = 0;
+ int curr2 = 0;
+ unsigned infile[2];
+ char c1, c2;
+ hsize_t nfound = 0;
+ int i;
+
+ /*-------------------------------------------------------------------------
+ * build the list
+ *-------------------------------------------------------------------------
+ */
+ trav_table_init (&table);
+
+ while (more_names_exist)
+ {
+ /* criteria is string compare */
+ cmp = strcmp (info1[curr1].name, info2[curr2].name);
+ if (cmp == 0)
+ {
+ infile[0] = 1;
+ infile[1] = 1;
+ trav_table_addflags (infile, info1[curr1].name, info1[curr1].type,
+ table);
+
+ curr1++;
+ curr2++;
+ }
+ else if (cmp < 0)
+ {
+ infile[0] = 1;
+ infile[1] = 0;
+ trav_table_addflags (infile, info1[curr1].name, info1[curr1].type,
+ table);
+ curr1++;
+ }
+ else
+ {
+ infile[0] = 0;
+ infile[1] = 1;
+ trav_table_addflags (infile, info2[curr2].name, info2[curr2].type,
+ table);
+ curr2++;
+ }
+
+ more_names_exist = (curr1 < nobjects1 && curr2 < nobjects2) ? 1 : 0;
+
+
+ } /* end while */
+
+ /* list1 did not end */
+ if (curr1 < nobjects1)
+ {
+ while (curr1 < nobjects1)
+ {
+ infile[0] = 1;
+ infile[1] = 0;
+ trav_table_addflags (infile, info1[curr1].name, info1[curr1].type,
+ table);
+ curr1++;
+ }
+ }
+
+ /* list2 did not end */
+ if (curr2 < nobjects2)
+ {
+ while (curr2 < nobjects2)
+ {
+ infile[0] = 0;
+ infile[1] = 1;
+ trav_table_addflags (infile, info2[curr2].name, info2[curr2].type,
+ table);
+ curr2++;
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * print the list
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->m_verbose)
+ {
+ printf ("\n");
+ printf ("file1 file2\n");
+ printf ("---------------------------------------\n");
+ for (i = 0; i < table->nobjs; i++)
+ {
+ c1 = (table->objs[i].flags[0]) ? 'x' : ' ';
+ c2 = (table->objs[i].flags[1]) ? 'x' : ' ';
+ printf ("%5c %6c %-15s\n", c1, c2, table->objs[i].name);
+ }
+ printf ("\n");
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * do the diff for common objects
+ *-------------------------------------------------------------------------
+ */
+ {
+#ifdef H5_HAVE_PH5DIFF
+ /*SEND NAMES/OBJS OFF TO WORKER TASKS FOR DIFF'ING HERE */
+ char* workerTasks = malloc((g_nTasks-1) * sizeof(char));
+ int n;
+ int busyTasks=0;
+ hsize_t nFoundbyWorker;
+ struct diff_args args;
+ int havePrintToken = 1;
+ MPI_Status Status;
+
+ /*set all tasks as free */
+ memset(workerTasks, 1, g_nTasks-1);
+#endif
+
+ for (i = 0; i < table->nobjs; i++)
+ {
+ if (table->objs[i].flags[0] && table->objs[i].flags[1])
+ {
+ int workerFound = 0;
+ options->cmn_objs = 1;
+#ifndef H5_HAVE_PH5DIFF
+ nfound += diff (file1_id,
+ table->objs[i].name,
+ file2_id,
+ table->objs[i].name, options, table->objs[i].type);
+#else
+ /* We're in parallel mode */
+
+ /*Set up args to pass to worker task. */
+ strncpy(args.name, table->objs[i].name, 255);
+ args.options = *options;
+ args.type= table->objs[i].type;
+
+ /* if there are any outstanding print requests, let's handle one. */
+ if(busyTasks > 0)
+ {
+ int incomingMessage;
+ /* check if any tasks freed up, and didn't need to print. */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status);
+
+ if(incomingMessage)
+ {
+ workerTasks[Status.MPI_SOURCE-1] = 1;
+ MPI_Recv(&nFoundbyWorker, 1, MPI_LONG_LONG, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker;
+ busyTasks--;
+ }
+
+ /* check to see if the print token was returned. */
+ if(!havePrintToken)
+ {
+
+ /* check incoming queue for token */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+
+ /* incoming token implies free task. */
+ if(incomingMessage)
+ {
+ workerTasks[Status.MPI_SOURCE-1] = 1;
+ MPI_Recv(&nFoundbyWorker, 1, MPI_LONG_LONG, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker;
+ busyTasks--;
+ havePrintToken = 1;
+ }
+ }
+
+ /* check to see if anyone needs the print token. */
+ if(havePrintToken)
+ {
+ /* check incoming queue for print token requests */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &incomingMessage, &Status);
+ if(incomingMessage)
+ {
+ MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
+ MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+ havePrintToken = 0;
+ }
+ }
+ }
+
+ /* check array of tasks to see which ones are free.
+ * Manager task never does work, so freeTasks[0] is really
+ * worker task 0. */
+
+ for(n=1; (n<g_nTasks) && !workerFound; n++)
+ {
+ if(workerTasks[n-1])
+ {
+ /* send file id's and names to first free worker */
+ MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD);
+
+ /* increment counter for total number of prints. */
+ busyTasks++;
+
+ /* mark worker as busy */
+ workerTasks[n-1] = 0;
+ workerFound = 1;
+ }
+
+ }
+
+
+ if(!workerFound)
+ {
+ /* if they were all busy, we've got to wait for one free up before we can move on.
+ * if we don't have the token, some task is currently printing so we'll wait for that task to return it. */
+ if(!havePrintToken)
+ {
+ MPI_Probe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+
+ if(Status.MPI_TAG == MPI_TAG_TOK_RETURN)
+ {
+ MPI_Recv(&nFoundbyWorker, 1, MPI_LONG_LONG, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ havePrintToken = 1;
+ nfound += nFoundbyWorker;
+ /* send this task the work unit. */
+ MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
+ }
+ else
+ {
+ printf("ERROR: Invalid (%d) tag received\n", Status.MPI_TAG);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ MPI_Finalize();
+ }
+ }
+ /* if we do have the token, check for task to free up, or wait for a task to request it */
+ else
+ {
+ MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+
+ if(Status.MPI_TAG == MPI_TAG_DONE)
+ {
+ MPI_Recv(&nFoundbyWorker, 1, MPI_LONG_LONG, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker;
+ MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
+ }
+ else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST)
+ {
+ MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
+ MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+
+ MPI_Recv(&nFoundbyWorker, 1, MPI_LONG_LONG, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker;
+ MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
+ }
+ else
+ {
+ printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ MPI_Finalize();
+ }
+ }
+
+
+
+ }
+#endif
+ }
+ }
+
+#ifdef H5_HAVE_PH5DIFF
+ while(busyTasks > 0) /* make sure all tasks are done */
+ {
+ MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+ if(Status.MPI_TAG == MPI_TAG_DONE)
+ {
+ MPI_Recv(&nFoundbyWorker, 1, MPI_LONG_LONG, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker;
+ busyTasks--;
+ }
+ else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST)
+ {
+ MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
+ if(havePrintToken)
+ {
+ MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+ MPI_Recv(&nFoundbyWorker, 1, MPI_LONG_LONG, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker;
+ busyTasks--;
+ }
+ else /* someone else must have it...wait for them to return it, then give it to the task that just asked for it. */
+ {
+ int source = Status.MPI_SOURCE;
+ MPI_Recv(&nFoundbyWorker, 1, MPI_LONG_LONG, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker;
+ busyTasks--;
+ MPI_Send(NULL, 0, MPI_BYTE, source, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+ }
+ }
+ else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN)
+ {
+ MPI_Recv(&nFoundbyWorker, 1, MPI_LONG_LONG, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker;
+ busyTasks--;
+ havePrintToken = 1;
+ }
+ else
+ {
+ printf("ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ }
+ }
+
+ for(i=1; i<g_nTasks; i++)
+ MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD);
+#endif
+ }
+ /* free table */
+ trav_table_free (table);
+
+
+ /*-------------------------------------------------------------------------
+ * do the diff for the root.
+ * this is a special case, we get an ID for the root group and call diff()
+ * with this ID; it compares only the root group attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /* the manager can do this. */
+ nfound += diff (file1_id, "/", file2_id, "/", options, H5G_GROUP);
+
+ return nfound;
}
@@ -334,57 +572,61 @@ hsize_t diff_match( hid_t file1_id,
*-------------------------------------------------------------------------
*/
-hsize_t diff_compare( hid_t file1_id,
- const char *file1_name,
- const char *obj1_name,
- int nobjects1,
- trav_info_t *info1,
- hid_t file2_id,
- const char *file2_name,
- const char *obj2_name,
- int nobjects2,
- trav_info_t *info2,
- diff_opt_t *options )
+hsize_t
+diff_compare (hid_t file1_id,
+ const char *file1_name,
+ const char *obj1_name,
+ int nobjects1,
+ trav_info_t * info1,
+ hid_t file2_id,
+ const char *file2_name,
+ const char *obj2_name,
+ int nobjects2, trav_info_t * info2, diff_opt_t * options)
{
- int f1=0, f2=0;
- hsize_t nfound=0;
-
- int i = h5trav_getindex( obj1_name, nobjects1, info1 );
- int j = h5trav_getindex( obj2_name, nobjects2, info2 );
-
- if ( i == -1 )
- {
- printf( "Object <%s> could not be found in <%s>\n", obj1_name, file1_name );
- f1=1;
- }
- if ( j == -1 )
- {
- printf( "Object <%s> could not be found in <%s>\n", obj2_name, file2_name );
- f2=1;
- }
- if ( f1 || f2 ) {
- options->err_stat=1;
- return 0;
- }
-
- /* use the name with "/" first, as obtained by iterator function */
- obj1_name=info1[i].name;
- obj2_name=info2[j].name;
-
- /* objects are not the same type */
- if ( info1[i].type != info2[j].type)
- {
- if (options->m_verbose)
- printf("Comparison not possible: <%s> is of type %s and <%s> is of type %s\n",
- obj1_name, get_type(info1[i].type),
- obj2_name, get_type(info2[j].type) );
- return 0;
- }
-
- nfound=diff( file1_id, obj1_name, file2_id, obj2_name, options, info1[i].type );
-
- return nfound;
+ int f1 = 0, f2 = 0;
+ hsize_t nfound = 0;
+
+ int i = h5trav_getindex (obj1_name, nobjects1, info1);
+ int j = h5trav_getindex (obj2_name, nobjects2, info2);
+
+ if (i == -1)
+ {
+ printf ("Object <%s> could not be found in <%s>\n", obj1_name,
+ file1_name);
+ f1 = 1;
+ }
+ if (j == -1)
+ {
+ printf ("Object <%s> could not be found in <%s>\n", obj2_name,
+ file2_name);
+ f2 = 1;
+ }
+ if (f1 || f2)
+ {
+ options->err_stat = 1;
+ return 0;
+ }
+
+ /* use the name with "/" first, as obtained by iterator function */
+ obj1_name = info1[i].name;
+ obj2_name = info2[j].name;
+
+ /* objects are not the same type */
+ if (info1[i].type != info2[j].type)
+ {
+ if (options->m_verbose)
+ printf
+ ("Comparison not possible: <%s> is of type %s and <%s> is of type %s\n",
+ obj1_name, get_type (info1[i].type), obj2_name,
+ get_type (info2[j].type));
+ return 0;
+ }
+
+ nfound =
+ diff (file1_id, obj1_name, file2_id, obj2_name, options, info1[i].type);
+
+ return nfound;
}
@@ -407,204 +649,206 @@ hsize_t diff_compare( hid_t file1_id,
*-------------------------------------------------------------------------
*/
-hsize_t diff( hid_t file1_id,
- const char *path1,
- hid_t file2_id,
- const char *path2,
- diff_opt_t *options,
- H5G_obj_t type )
+hsize_t
+diff (hid_t file1_id,
+ const char *path1,
+ hid_t file2_id, const char *path2, diff_opt_t * options, H5G_obj_t type)
{
- hid_t type1_id=(-1);
- hid_t type2_id=(-1);
- hid_t grp1_id=(-1);
- hid_t grp2_id=(-1);
- int ret;
- H5G_stat_t sb1;
- H5G_stat_t sb2;
- char *buf1=NULL;
- char *buf2=NULL;
- hsize_t nfound=0;
-
- switch ( type )
- {
+ hid_t type1_id=(-1);
+ hid_t type2_id=(-1);
+ hid_t grp1_id=(-1);
+ hid_t grp2_id=(-1);
+ int ret;
+ H5G_stat_t sb1;
+ H5G_stat_t sb2;
+ char *buf1 = NULL;
+ char *buf2 = NULL;
+ hsize_t nfound = 0;
+
+ switch (type)
+ {
/*-------------------------------------------------------------------------
* H5G_DATASET
*-------------------------------------------------------------------------
*/
- case H5G_DATASET:
-
- /* always print name */
- if (options->m_verbose)
- {
- if (print_objname(options,(hsize_t)1))
- printf( "Dataset: <%s> and <%s>\n",path1,path2);
- nfound=diff_dataset(file1_id,file2_id,path1,path2,options);
-
- }
- /* check first if we have differences */
- else
- {
- if (options->m_quiet==0)
- {
- /* shut up temporarily */
- options->m_quiet=1;
- nfound=diff_dataset(file1_id,file2_id,path1,path2,options);
- /* print again */
- options->m_quiet=0;
- if (nfound)
- {
- if (print_objname(options,nfound))
- printf( "Dataset: <%s> and <%s>\n",path1,path2);
- nfound=diff_dataset(file1_id,file2_id,path1,path2,options);
- } /*if*/
- } /*if*/
- /* in quiet mode, just count differences */
- else
- {
- nfound=diff_dataset(file1_id,file2_id,path1,path2,options);
- }
- }/*else*/
-
- break;
+ case H5G_DATASET:
+
+ /* always print name */
+ if (options->m_verbose)
+ {
+ if (print_objname (options, (hsize_t)1))
+ parallel_print("Dataset: <%s> and <%s>\n", path1, path2);
+ nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
+
+ }
+ /* check first if we have differences */
+ else
+ {
+ if (options->m_quiet == 0)
+ {
+ /* shut up temporarily */
+ options->m_quiet = 1;
+ nfound =
+ diff_dataset (file1_id, file2_id, path1, path2, options);
+ /* print again */
+ options->m_quiet = 0;
+ if (nfound)
+ {
+ if (print_objname (options, nfound))
+ parallel_print("Dataset: <%s> and <%s>\n", path1, path2);
+ nfound =
+ diff_dataset (file1_id, file2_id, path1, path2, options);
+ } /*if */
+ } /*if */
+ /* in quiet mode, just count differences */
+ else
+ {
+ nfound =
+ diff_dataset (file1_id, file2_id, path1, path2, options);
+ }
+ } /*else */
+
+ break;
/*-------------------------------------------------------------------------
* H5G_TYPE
*-------------------------------------------------------------------------
*/
- case H5G_TYPE:
- if ((type1_id = H5Topen(file1_id, path1))<0)
- goto out;
- if ((type2_id = H5Topen(file2_id, path2))<0)
- goto out;
-
- if ((ret = H5Tequal(type1_id,type2_id))<0)
- goto out;
-
- /* if H5Tequal is > 0 then the datatypes refer to the same datatype */
- nfound = (ret>0) ? 0 : 1;
-
- if (print_objname(options,nfound))
- printf( "Datatype: <%s> and <%s>\n",path1,path2);
-
+ case H5G_TYPE:
+ if ((type1_id = H5Topen (file1_id, path1)) < 0)
+ goto out;
+ if ((type2_id = H5Topen (file2_id, path2)) < 0)
+ goto out;
+
+ if ((ret = H5Tequal (type1_id, type2_id)) < 0)
+ goto out;
+
+ /* if H5Tequal is > 0 then the datatypes refer to the same datatype */
+ nfound = (ret > 0) ? 0 : 1;
+
+ if (print_objname (options, nfound))
+ parallel_print("Datatype: <%s> and <%s>\n", path1, path2);
+
/*-------------------------------------------------------------------------
* compare attributes
* the if condition refers to cases when the dataset is a referenced object
*-------------------------------------------------------------------------
*/
- if (path1)
- diff_attr(type1_id,type2_id,path1,path2,options);
-
- if ( H5Tclose(type1_id)<0)
- goto out;
- if ( H5Tclose(type2_id)<0)
- goto out;
-
- break;
+ if (path1)
+ diff_attr (type1_id, type2_id, path1, path2, options);
+
+ if (H5Tclose (type1_id) < 0)
+ goto out;
+ if (H5Tclose (type2_id) < 0)
+ goto out;
+
+ break;
/*-------------------------------------------------------------------------
* H5G_GROUP
*-------------------------------------------------------------------------
*/
- case H5G_GROUP:
- if ((grp1_id = H5Gopen(file1_id, path1))<0)
- goto out;
- if ((grp2_id = H5Gopen(file2_id, path2))<0)
- goto out;
-
- ret = HDstrcmp(path1,path2);
-
- /* if "path1" != "path2" then the groups are "different" */
- nfound = (ret!=0) ? 1 : 0;
-
- if (print_objname(options,nfound))
- printf( "Group: <%s> and <%s>\n",path1,path2);
-
+ case H5G_GROUP:
+ if ((grp1_id = H5Gopen (file1_id, path1)) < 0)
+ goto out;
+ if ((grp2_id = H5Gopen (file2_id, path2)) < 0)
+ goto out;
+
+ ret = HDstrcmp (path1, path2);
+
+ /* if "path1" != "path2" then the groups are "different" */
+ nfound = (ret != 0) ? 1 : 0;
+
+ if (print_objname (options, nfound))
+ parallel_print("Group: <%s> and <%s>\n", path1, path2);
+
/*-------------------------------------------------------------------------
* compare attributes
* the if condition refers to cases when the dataset is a referenced object
*-------------------------------------------------------------------------
*/
- if (path1)
- diff_attr(grp1_id,grp2_id,path1,path2,options);
-
- if ( H5Gclose(grp1_id)<0)
- goto out;
- if ( H5Gclose(grp2_id)<0)
- goto out;
-
- break;
+ if (path1)
+ diff_attr (grp1_id, grp2_id, path1, path2, options);
+
+ if (H5Gclose (grp1_id) < 0)
+ goto out;
+ if (H5Gclose (grp2_id) < 0)
+ goto out;
+
+ break;
/*-------------------------------------------------------------------------
* H5G_LINK
*-------------------------------------------------------------------------
*/
- case H5G_LINK:
- if (H5Gget_objinfo(file1_id,path1,FALSE,&sb1)<0)
- goto out;
- if (H5Gget_objinfo(file1_id,path1,FALSE,&sb2)<0)
- goto out;
-
- buf1 = malloc(sb1.linklen);
- buf2 = malloc(sb2.linklen);
-
- if (H5Gget_linkval(file1_id,path1,sb1.linklen,buf1)<0)
- goto out;
- if (H5Gget_linkval(file2_id,path2,sb1.linklen,buf2)<0)
- goto out;
-
- ret = HDstrcmp(buf1,buf2);
-
- /* if "buf1" != "buf2" then the links are "different" */
- nfound = (ret!=0) ? 1 : 0;
-
- if (print_objname(options,nfound))
- printf( "Link: <%s> and <%s>\n",path1,path2);
-
- if (buf1) {
- free(buf1);
- buf1=NULL;
- }
-
- if (buf2) {
- free(buf2);
- buf2=NULL;
- }
-
- break;
-
-
- default:
- nfound=0;
- if (options->m_verbose) {
- printf("Comparison not supported: <%s> and <%s> are of type %s\n",
- path1, path2, get_type(type) );
- }
- break;
- }
-
-
- out:
-
- /* close */
- /* disable error reporting */
- H5E_BEGIN_TRY {
- H5Tclose(type1_id);
- H5Tclose(type2_id);
- H5Gclose(grp1_id);
- H5Tclose(grp2_id);
- /* enable error reporting */
- } H5E_END_TRY;
-
- if (buf1)
- free(buf1);
- if (buf2)
- free(buf2);
-
- return nfound;
-}
+ case H5G_LINK:
+ if (H5Gget_objinfo (file1_id, path1, FALSE, &sb1) < 0)
+ goto out;
+ if (H5Gget_objinfo (file1_id, path1, FALSE, &sb2) < 0)
+ goto out;
+
+ buf1 = malloc (sb1.linklen);
+ buf2 = malloc (sb2.linklen);
+
+ if (H5Gget_linkval (file1_id, path1, sb1.linklen, buf1) < 0)
+ goto out;
+ if (H5Gget_linkval (file2_id, path2, sb1.linklen, buf2) < 0)
+ goto out;
+
+ ret = HDstrcmp (buf1, buf2);
+
+ /* if "buf1" != "buf2" then the links are "different" */
+ nfound = (ret != 0) ? 1 : 0;
+
+ if (print_objname (options, nfound))
+ parallel_print("Link: <%s> and <%s>\n", path1, path2);
+
+ if (buf1)
+ {
+ free (buf1);
+ buf1 = NULL;
+ }
+
+ if (buf2)
+ {
+ free (buf2);
+ buf2 = NULL;
+ }
+
+ break;
+
+
+ default:
+ nfound = 0;
+ if (options->m_verbose)
+ {
+ parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n",
+ path1, path2, get_type (type));
+ }
+
+ break;
+ }
+out:
+ /* close */
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ H5Tclose (type1_id);
+ H5Tclose (type2_id);
+ H5Gclose (grp1_id);
+ H5Tclose (grp2_id);
+ /* enable error reporting */
+ }
+ H5E_END_TRY;
+ if (buf1)
+ free (buf1);
+ if (buf2)
+ free (buf2);
+ return nfound;
+}
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 4a29259..f69719f 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -174,6 +174,7 @@ int diff_attr(hid_t loc1_id,
*/
void print_found(hsize_t nfound);
+void parallel_print(const char* format, ... );
void print_type(hid_t type);
const char* diff_basename(const char *name);
const char* get_type(int type);
@@ -239,136 +240,136 @@ hsize_t diff_datum(void *_mem1,
hsize_t diff_float(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_double(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_schar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_uchar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_short(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_ushort(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_int(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_uint(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_long(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_ulong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_llong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_ullong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index f1c4a74..60060e4 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -14,9 +14,9 @@
#include <math.h>
#include "h5diff.h"
+#include "ph5diff.h"
#include "H5private.h"
-
/* local functions */
static void close_obj(H5G_obj_t obj_type, hid_t obj_id);
static int diff_region(hid_t region1_id, hid_t region2_id);
@@ -61,124 +61,124 @@ hsize_t diff_array( void *_mem1,
hid_t container1_id,
hid_t container2_id) /* dataset where the reference came from*/
{
- hsize_t nfound=0; /* number of differences found */
- size_t size; /* size of datum */
- unsigned char *mem1 = (unsigned char*)_mem1;
- unsigned char *mem2 = (unsigned char*)_mem2;
- unsigned char *tmp1;
- unsigned char *tmp2;
- hsize_t acc[32]; /* accumulator position */
- hsize_t pos[32]; /* matrix position */
- int ph=1; /* print header */
- hsize_t i;
- int j;
-
- /* get the size. */
- size = H5Tget_size( m_type );
-
- acc[rank-1]=1;
- for(j=(rank-2); j>=0; j--)
- {
- acc[j]=acc[j+1]*(int)dims[j+1];
- }
- for ( j = 0; j < rank; j++)
- pos[j]=0;
+ hsize_t nfound=0; /* number of differences found */
+ size_t size; /* size of datum */
+ unsigned char *mem1 = (unsigned char*)_mem1;
+ unsigned char *mem2 = (unsigned char*)_mem2;
+ unsigned char *tmp1;
+ unsigned char *tmp2;
+ hsize_t acc[32]; /* accumulator position */
+ hsize_t pos[32]; /* matrix position */
+ int ph=1; /* print header */
+ hsize_t i;
+ int j;
+
+ /* get the size. */
+ size = H5Tget_size( m_type );
+
+ acc[rank-1]=1;
+ for(j=(rank-2); j>=0; j--)
+ {
+ acc[j]=acc[j+1]*(int)dims[j+1];
+ }
+ for ( j = 0; j < rank; j++)
+ pos[j]=0;
- if(H5Tis_variable_str(m_type))
- {
- tmp1 = ((unsigned char**)mem1)[0];
- tmp2 = ((unsigned char**)mem2)[0];
- nfound+=diff_datum(
- tmp1,
- tmp2,
- m_type,
- (hsize_t)0,
- rank,
- acc,
- pos,
- options,
- name1,
- name2,
- container1_id,
- container2_id,
- &ph);
- }
+ if(H5Tis_variable_str(m_type))
+ {
+ tmp1 = ((unsigned char**)mem1)[0];
+ tmp2 = ((unsigned char**)mem2)[0];
+ nfound+=diff_datum(
+ tmp1,
+ tmp2,
+ m_type,
+ (hsize_t)0,
+ rank,
+ acc,
+ pos,
+ options,
+ name1,
+ name2,
+ container1_id,
+ container2_id,
+ &ph);
+ }
- else
-
- {
-
- switch (H5Tget_class(m_type))
+ else
+
+ {
+
+ switch (H5Tget_class(m_type))
+ {
+ default:
+ assert(0);
+ break;
+
+ case H5T_FLOAT:
+ if (H5Tequal(m_type, H5T_NATIVE_FLOAT))
+ nfound=diff_float(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
+ nfound=diff_double(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ break;
+
+ case H5T_INTEGER:
+
+ if (H5Tequal(m_type, H5T_NATIVE_SCHAR))
+ nfound=diff_schar(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_UCHAR))
+ nfound=diff_uchar(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_SHORT))
+ nfound=diff_short(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_USHORT))
+ nfound=diff_ushort(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_INT))
+ nfound=diff_int(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_UINT))
+ nfound=diff_uint(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_LONG))
+ nfound=diff_long(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_ULONG))
+ nfound=diff_ulong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_LLONG))
+ nfound=diff_llong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+ else if (H5Tequal(m_type, H5T_NATIVE_ULLONG))
+ nfound=diff_ullong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
+
+ break;
+
+ case H5T_COMPOUND:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ case H5T_VLEN:
+ case H5T_REFERENCE:
+
+ for ( i = 0; i < nelmts; i++)
{
- default:
- assert(0);
- break;
-
- case H5T_FLOAT:
- if (H5Tequal(m_type, H5T_NATIVE_FLOAT))
- nfound=diff_float(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
- nfound=diff_double(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- break;
-
- case H5T_INTEGER:
-
- if (H5Tequal(m_type, H5T_NATIVE_SCHAR))
- nfound=diff_schar(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_UCHAR))
- nfound=diff_uchar(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_SHORT))
- nfound=diff_short(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_USHORT))
- nfound=diff_ushort(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_INT))
- nfound=diff_int(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_UINT))
- nfound=diff_uint(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_LONG))
- nfound=diff_long(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_ULONG))
- nfound=diff_ulong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_LLONG))
- nfound=diff_llong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
- else if (H5Tequal(m_type, H5T_NATIVE_ULLONG))
- nfound=diff_ullong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph);
-
- break;
-
- case H5T_COMPOUND:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- case H5T_VLEN:
- case H5T_REFERENCE:
-
- for ( i = 0; i < nelmts; i++)
- {
- nfound+=diff_datum(
- mem1 + i * size,
- mem2 + i * size, /* offset */
- m_type,
- i,
- rank,
- acc,
- pos,
- options,
- name1,
- name2,
- container1_id,
- container2_id,
- &ph);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* i */
- } /* switch */
- } /* else */
-
- return nfound;
+ nfound+=diff_datum(
+ mem1 + i * size,
+ mem2 + i * size, /* offset */
+ m_type,
+ i,
+ rank,
+ acc,
+ pos,
+ options,
+ name1,
+ name2,
+ container1_id,
+ container2_id,
+ &ph);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* i */
+ } /* switch */
+ } /* else */
+
+ return nfound;
}
@@ -223,721 +223,717 @@ hsize_t diff_array( void *_mem1,
*/
hsize_t diff_datum(void *_mem1,
- void *_mem2,
- hid_t m_type,
- hsize_t i,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- hid_t container1_id,
- hid_t container2_id, /*where the reference came from*/
- int *ph) /*print header */
+ void *_mem2,
+ hid_t m_type,
+ hsize_t i,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ hid_t container1_id,
+ hid_t container2_id, /*where the reference came from*/
+ int *ph) /*print header */
{
- static char fmt_llong[255];
- static char fmt_ullong[255];
- static char fmt_llongp[255];
- static char fmt_ullongp[255];
- hsize_t dims[H5S_MAX_RANK];
- unsigned char *mem1 = (unsigned char*)_mem1;
- unsigned char *mem2 = (unsigned char*)_mem2;
- unsigned u;
- hid_t memb_type;
- size_t type_size;
- size_t offset;
- int nmembs;
- int j;
- hsize_t nelmts;
- hsize_t ndims;
- size_t size;
- int iszero1;
- int iszero2;
- H5G_obj_t obj1_type;
- H5G_obj_t obj2_type;
- hid_t obj1_id;
- hid_t obj2_id;
- H5G_stat_t sb1;
- H5G_stat_t sb2;
- hsize_t nfound=0; /* differences found */
- int ret=0; /* check return error */
-
- if (!fmt_llong[0]) {
-
- /* Build default formats for long long types */
- sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
- sprintf(fmt_ullong, "%%%su %%%su %%%su\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
- sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
- sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
-
- }
-
- type_size = H5Tget_size( m_type );
-
- switch (H5Tget_class(m_type))
- {
- default:
- assert(0);
- break;
- case H5T_TIME:
- assert(0);
- break;
-
-/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
- case H5T_COMPOUND:
- nmembs = H5Tget_nmembers(m_type);
- for (j = 0; j < nmembs; j++)
- {
- offset = H5Tget_member_offset(m_type, (unsigned)j);
- memb_type = H5Tget_member_type(m_type, (unsigned)j);
- nfound+=diff_datum(
- mem1+offset,
- mem2+offset,
- memb_type,
- i,
- rank,
- acc,
- pos,
- options,
- obj1,
- obj2,
- container1_id,
- container2_id,
- ph);
- H5Tclose(memb_type);
- }
- break;
-
-/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
- case H5T_STRING:
-
- if(H5Tis_variable_str(m_type))
- type_size = HDstrlen((char*)mem1);
- else
- type_size = H5Tget_size(m_type);
-
- for (u=0; u<type_size; u++)
- nfound+=diff_char(
- mem1 + u,
- mem2 + u, /* offset */
- i, /* index position */
- rank,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
-
+ static char fmt_llong[255];
+ static char fmt_ullong[255];
+ static char fmt_llongp[255];
+ static char fmt_ullongp[255];
+ hsize_t dims[H5S_MAX_RANK];
+ unsigned char *mem1 = (unsigned char*)_mem1;
+ unsigned char *mem2 = (unsigned char*)_mem2;
+ unsigned u;
+ hid_t memb_type;
+ size_t type_size;
+ size_t offset;
+ int nmembs;
+ int j;
+ hsize_t nelmts;
+ hsize_t ndims;
+ size_t size;
+ int iszero1;
+ int iszero2;
+ H5G_obj_t obj1_type;
+ H5G_obj_t obj2_type;
+ hid_t obj1_id;
+ hid_t obj2_id;
+ H5G_stat_t sb1;
+ H5G_stat_t sb2;
+ hsize_t nfound=0; /* differences found */
+ int ret=0; /* check return error */
+
+ if (!fmt_llong[0]) {
+
+ /* Build default formats for long long types */
+ sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n",
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ sprintf(fmt_ullong, "%%%su %%%su %%%su\n",
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n",
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n",
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
- break;
-
-/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
- case H5T_BITFIELD:
- {
- /* byte-by-byte comparison */
- for (u=0; u<type_size; u++)
- nfound+=diff_native_uchar(
- mem1 + u,
- mem2 + u, /* offset */
- i, /* index position */
- rank,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
-
- }
- break;
-/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
- case H5T_OPAQUE:
-
- /* byte-by-byte comparison */
- for (u=0; u<type_size; u++)
- nfound+=diff_native_uchar(
- mem1 + u,
- mem2 + u, /* offset */
- i, /* index position */
- rank,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
+ }
- break;
+ type_size = H5Tget_size( m_type );
+ switch (H5Tget_class(m_type))
+ {
+ default:
+ assert(0);
+ break;
+ case H5T_TIME:
+ assert(0);
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ case H5T_COMPOUND:
+ nmembs = H5Tget_nmembers(m_type);
+ for (j = 0; j < nmembs; j++)
+ {
+ offset = H5Tget_member_offset(m_type, (unsigned)j);
+ memb_type = H5Tget_member_type(m_type, (unsigned)j);
+ nfound+=diff_datum(
+ mem1+offset,
+ mem2+offset,
+ memb_type,
+ i,
+ rank,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ container1_id,
+ container2_id,
+ ph);
+ H5Tclose(memb_type);
+ }
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ case H5T_STRING:
+
+ if(H5Tis_variable_str(m_type))
+ type_size = HDstrlen((char*)mem1);
+ else
+ type_size = H5Tget_size(m_type);
+
+ for (u=0; u<type_size; u++)
+ nfound+=diff_char(
+ mem1 + u,
+ mem2 + u, /* offset */
+ i, /* index position */
+ rank,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ ph);
+
+
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+ case H5T_BITFIELD:
+ {
+ /* byte-by-byte comparison */
+ for (u=0; u<type_size; u++)
+ nfound+=diff_native_uchar(
+ mem1 + u,
+ mem2 + u, /* offset */
+ i, /* index position */
+ rank,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ ph);
+
+ }
+ break;
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ case H5T_OPAQUE:
+
+ /* byte-by-byte comparison */
+ for (u=0; u<type_size; u++)
+ nfound+=diff_native_uchar(
+ mem1 + u,
+ mem2 + u, /* offset */
+ i, /* index position */
+ rank,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ ph);
+
+ break;
+
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ case H5T_ENUM:
+
+ /* For enumeration types we compare the names instead of the
+ integer values. For each pair of elements being
+ compared, we convert both bit patterns to their corresponding
+ enumeration constant and do a string comparison */
+
+ {
+ char enum_name1[1024];
+ char enum_name2[1024];
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY {
+
+ if ((H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1) >= 0) &&
+ (H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2) >= 0))
+ {
+ if (HDstrcmp(enum_name1,enum_name2)!=0)
+ {
+ nfound=1;
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(SFORMAT,enum_name1,enum_name2);
+ }
+ }
+ else
+ {
+ for (u=0; u<type_size; u++)
+ nfound+=diff_native_uchar(
+ mem1 + u,
+ mem2 + u, /* offset */
+ i, /* index position */
+ rank,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ ph);
+ }
+ }
+ /* enable error reporting */
+ } H5E_END_TRY;
+ }
+
+
+ break;
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ case H5T_ARRAY:
+ /* get the array's base datatype for each element */
+ memb_type = H5Tget_super(m_type);
+ size = H5Tget_size(memb_type);
+ ndims = H5Tget_array_ndims(m_type);
+ H5Tget_array_dims(m_type, dims, NULL);
+ assert(ndims >= 1 && ndims <= H5S_MAX_RANK);
+
+ /* calculate the number of array elements */
+ for (u = 0, nelmts = 1; u <ndims; u++)
+ nelmts *= dims[u];
+ for (u = 0; u < nelmts; u++)
+ nfound+=diff_datum(
+ mem1 + u * size,
+ mem2 + u * size, /* offset */
+ memb_type,
+ i, /* index position */
+ rank,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ container1_id,
+ container2_id,
+ ph);
+ H5Tclose(memb_type);
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+ case H5T_VLEN:
+
+ /* get the VL sequences's base datatype for each element */
+ memb_type = H5Tget_super(m_type);
+ size = H5Tget_size(memb_type);
+
+ /* get the number of sequence elements */
+ nelmts = ((hvl_t *)mem1)->len;
+
+ for (j = 0; j < (int)nelmts; j++)
+ nfound+=diff_datum(
+ ((char *)(((hvl_t *)mem1)->p)) + j * size,
+ ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */
+ memb_type,
+ i, /* index position */
+ rank,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ container1_id,
+ container2_id,
+ ph);
+
+ H5Tclose(memb_type);
+
+ break;
+
+
+ case H5T_REFERENCE:
+
+ iszero1=is_zero(_mem1, H5Tget_size(m_type));
+ iszero2=is_zero(_mem2, H5Tget_size(m_type));
+ if (iszero1==1 && iszero2==1)
+ return 0;
+ else if (iszero1!=iszero2)
+ return 1;
+ else
+ {
+
+ /*-------------------------------------------------------------------------
+ * H5T_STD_REF_DSETREG
+ * Dataset region reference
+ *-------------------------------------------------------------------------
+ */
+
+ if (H5Tequal(m_type, H5T_STD_REF_DSETREG))
+ {
+ hid_t region1_id;
+ hid_t region2_id;
+
+ if ((obj1_id = H5Rdereference(container1_id, H5R_DATASET_REGION, _mem1))<0)
+ ret= -1;
+ if ((obj2_id = H5Rdereference(container2_id, H5R_DATASET_REGION, _mem2))<0)
+ ret= -1;
+ if (H5Gget_objinfo(obj1_id, ".", FALSE, &sb1)<0)
+ ret= -1;
+ if (H5Gget_objinfo(obj2_id, ".", FALSE, &sb2)<0)
+ ret= -1;
+ if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1))<0)
+ ret= -1;
+ if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2))<0)
+ ret= -1;
+
+ if (ret==-1) {
+ options->err_stat=1;
+ return 0;
+ }
+
+ if (diff_region(region1_id,region2_id))
+ {
+ parallel_print("Different region referenced\n");
+ }
+
+ close_obj(H5G_DATASET,obj1_id);
+ close_obj(H5G_DATASET,obj2_id);
+ H5Sclose(region1_id);
+ H5Sclose(region2_id);
+
+ }/*dataset reference*/
+
+
+ /*-------------------------------------------------------------------------
+ * H5T_STD_REF_OBJ
+ * Object references. get the type and OID of the referenced object
+ *-------------------------------------------------------------------------
+ */
+ else if (H5Tequal(m_type, H5T_STD_REF_OBJ))
+ {
-/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
- case H5T_ENUM:
+ if ((obj1_type = H5Rget_obj_type(container1_id, H5R_OBJECT, _mem1))<0)
+ ret= -1;
+ if ((obj2_type = H5Rget_obj_type(container2_id, H5R_OBJECT, _mem2))<0)
+ ret= -1;
+ if (ret==-1) {
+ options->err_stat=1;
+ return 0;
+ }
+
+ /* check object type */
+ if (obj1_type!=obj2_type)
+ {
+ parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
+ return 1;
+ }
+
+ if ((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1))<0)
+ ret= -1;
+ if ((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2))<0)
+ ret= -1;
+ if (ret==-1) {
+ options->err_stat=1;
+ return 0;
+ }
+
+
+ /*deep compare */
+ switch (obj1_type) {
+ case H5G_DATASET:
+ nfound=diff_datasetid(obj1_id,
+ obj2_id,
+ NULL,
+ NULL,
+ options);
+ break;
+ default:
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>",
+ obj1, obj2);
+ break;
+ }
+
+ close_obj(obj1_type,obj1_id);
+ close_obj(obj2_type,obj2_id);
+
+ }/*object reference*/
+
+ }/*is zero*/
+
+
+ break;
+
+
+ case H5T_INTEGER:
+
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_SCHAR
+ *-------------------------------------------------------------------------
+ */
+ if (H5Tequal(m_type, H5T_NATIVE_SCHAR))
+ {
+ char temp1_char;
+ char temp2_char;
+ assert(type_size==sizeof(char));
+ memcpy(&temp1_char, mem1, sizeof(char));
+ memcpy(&temp2_char, mem2, sizeof(char));
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ if (abs(temp1_char-temp2_char) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
+ }
+ nfound++;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char), abs(1-temp2_char/temp1_char));
+ }
+ nfound++;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent &&
+ abs(temp1_char-temp2_char) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char), abs(1-temp2_char/temp1_char));
+ }
+ nfound++;
+ }
+ }
+ else if (temp1_char != temp2_char)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
+ }
+ nfound++;
+ }
-/* For enumeration types we compare the names instead of the
- integer values. For each pair of elements being
- compared, we convert both bit patterns to their corresponding
- enumeration constant and do a string comparison */
+ } /*H5T_NATIVE_SCHAR*/
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_UCHAR
+ *-------------------------------------------------------------------------
+ */
+ else if (H5Tequal(m_type, H5T_NATIVE_UCHAR))
+ {
+ unsigned char temp1_uchar;
+ unsigned char temp2_uchar;
+ assert(type_size==sizeof(unsigned char));
+
+ memcpy(&temp1_uchar, mem1, sizeof(unsigned char));
+ memcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ if (abs(temp1_uchar-temp2_uchar) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
+ }
+ nfound++;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar), abs(1-temp2_uchar/temp1_uchar));
+ }
+ nfound++;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent &&
+ abs(temp1_uchar-temp2_uchar) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar), abs(1-temp2_uchar/temp1_uchar));
+ }
+ nfound++;
+ }
+ }
+ else if (temp1_uchar != temp2_uchar)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
+
+ }
+ nfound++;
+ }
- {
- char enum_name1[1024];
- char enum_name2[1024];
-
- /* disable error reporting */
- H5E_BEGIN_TRY {
-
- if ((H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1) >= 0) &&
- (H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2) >= 0))
- {
- if (HDstrcmp(enum_name1,enum_name2)!=0)
- {
- nfound=1;
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(SFORMAT,enum_name1,enum_name2);
- }
- }
- }
- else
- {
- for (u=0; u<type_size; u++)
- nfound+=diff_native_uchar(
- mem1 + u,
- mem2 + u, /* offset */
- i, /* index position */
- rank,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
- }
-
- /* enable error reporting */
- } H5E_END_TRY;
- }
+ } /*H5T_NATIVE_UCHAR*/
-
- break;
-/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
- case H5T_ARRAY:
- /* get the array's base datatype for each element */
- memb_type = H5Tget_super(m_type);
- size = H5Tget_size(memb_type);
- ndims = H5Tget_array_ndims(m_type);
- H5Tget_array_dims(m_type, dims, NULL);
- assert(ndims >= 1 && ndims <= H5S_MAX_RANK);
-
- /* calculate the number of array elements */
- for (u = 0, nelmts = 1; u <ndims; u++)
- nelmts *= dims[u];
- for (u = 0; u < nelmts; u++)
- nfound+=diff_datum(
- mem1 + u * size,
- mem2 + u * size, /* offset */
- memb_type,
- i, /* index position */
- rank,
- acc,
- pos,
- options,
- obj1,
- obj2,
- container1_id,
- container2_id,
- ph);
- H5Tclose(memb_type);
- break;
-/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
- case H5T_VLEN:
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_SHORT
+ *-------------------------------------------------------------------------
+ */
- /* get the VL sequences's base datatype for each element */
- memb_type = H5Tget_super(m_type);
- size = H5Tget_size(memb_type);
-
- /* get the number of sequence elements */
- nelmts = ((hvl_t *)mem1)->len;
-
- for (j = 0; j < (int)nelmts; j++)
- nfound+=diff_datum(
- ((char *)(((hvl_t *)mem1)->p)) + j * size,
- ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */
- memb_type,
- i, /* index position */
- rank,
- acc,
- pos,
- options,
- obj1,
- obj2,
- container1_id,
- container2_id,
- ph);
-
- H5Tclose(memb_type);
-
- break;
+ else if (H5Tequal(m_type, H5T_NATIVE_SHORT))
+ {
+ short temp1_short;
+ short temp2_short;
+ assert(type_size==sizeof(short));
+ memcpy(&temp1_short, mem1, sizeof(short));
+ memcpy(&temp2_short, mem2, sizeof(short));
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ if (abs(temp1_short-temp2_short) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
+ }
+ nfound++;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short), abs(1-temp2_short/temp1_short));
+ }
+ nfound++;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent &&
+ abs(temp1_short-temp2_short) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short), abs(1-temp2_short/temp1_short));
- case H5T_REFERENCE:
-
- iszero1=is_zero(_mem1, H5Tget_size(m_type));
- iszero2=is_zero(_mem2, H5Tget_size(m_type));
- if (iszero1==1 && iszero2==1)
- return 0;
- else if (iszero1!=iszero2)
- return 1;
- else
- {
+ }
+ nfound++;
+ }
+ }
+ else if (temp1_short != temp2_short)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
+ }
+ nfound++;
+ }
-/*-------------------------------------------------------------------------
- * H5T_STD_REF_DSETREG
- * Dataset region reference
- *-------------------------------------------------------------------------
- */
-
- if (H5Tequal(m_type, H5T_STD_REF_DSETREG))
- {
- hid_t region1_id;
- hid_t region2_id;
-
- if ((obj1_id = H5Rdereference(container1_id, H5R_DATASET_REGION, _mem1))<0)
- ret= -1;
- if ((obj2_id = H5Rdereference(container2_id, H5R_DATASET_REGION, _mem2))<0)
- ret= -1;
- if (H5Gget_objinfo(obj1_id, ".", FALSE, &sb1)<0)
- ret= -1;
- if (H5Gget_objinfo(obj2_id, ".", FALSE, &sb2)<0)
- ret= -1;
- if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1))<0)
- ret= -1;
- if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2))<0)
- ret= -1;
-
- if (ret==-1) {
- options->err_stat=1;
- return 0;
- }
- if (diff_region(region1_id,region2_id))
- {
- printf("Different region referenced\n");
- }
-
- close_obj(H5G_DATASET,obj1_id);
- close_obj(H5G_DATASET,obj2_id);
- H5Sclose(region1_id);
- H5Sclose(region2_id);
-
- }/*dataset reference*/
+ } /*H5T_NATIVE_SHORT*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_USHORT
+ *-------------------------------------------------------------------------
+ */
-/*-------------------------------------------------------------------------
- * H5T_STD_REF_OBJ
- * Object references. get the type and OID of the referenced object
- *-------------------------------------------------------------------------
- */
- else if (H5Tequal(m_type, H5T_STD_REF_OBJ))
- {
-
- if ((obj1_type = H5Rget_obj_type(container1_id, H5R_OBJECT, _mem1))<0)
- ret= -1;
- if ((obj2_type = H5Rget_obj_type(container2_id, H5R_OBJECT, _mem2))<0)
- ret= -1;
- if (ret==-1) {
- options->err_stat=1;
- return 0;
- }
+ else if (H5Tequal(m_type, H5T_NATIVE_USHORT))
+ {
+ unsigned short temp1_ushort;
+ unsigned short temp2_ushort;
+ assert(type_size==sizeof(short));
- /* check object type */
- if (obj1_type!=obj2_type)
- {
- printf("Different object types referenced: <%s> and <%s>", obj1, obj2);
- return 1;
- }
+ memcpy(&temp1_ushort, mem1, sizeof(unsigned short));
+ memcpy(&temp2_ushort, mem2, sizeof(unsigned short));
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ if (abs(temp1_ushort-temp2_ushort) > options->delta)
+ {
- if ((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1))<0)
- ret= -1;
- if ((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2))<0)
- ret= -1;
- if (ret==-1) {
- options->err_stat=1;
- return 0;
- }
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort));
+ }
+ nfound++;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- /*deep compare */
- switch (obj1_type) {
- case H5G_DATASET:
- nfound=diff_datasetid(obj1_id,
- obj2_id,
- NULL,
- NULL,
- options);
- break;
- default:
- printf("Warning: Comparison not possible of object types referenced: <%s> and <%s>",
- obj1, obj2);
- break;
- }
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort), abs(1-temp2_ushort/temp1_ushort));
+ }
+ nfound++;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent &&
+ abs(temp1_ushort-temp2_ushort) > options->delta )
+ {
- close_obj(obj1_type,obj1_id);
- close_obj(obj2_type,obj2_id);
-
- }/*object reference*/
-
- }/*is zero*/
-
-
- break;
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort), abs(1-temp2_ushort/temp1_ushort));
+ }
+ nfound++;
+ }
+ }
+ else if (temp1_ushort != temp2_ushort)
+ {
- case H5T_INTEGER:
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort));
+ }
+ nfound++;
+ }
-/*-------------------------------------------------------------------------
- * H5T_NATIVE_SCHAR
- *-------------------------------------------------------------------------
- */
- if (H5Tequal(m_type, H5T_NATIVE_SCHAR))
- {
- char temp1_char;
- char temp2_char;
- assert(type_size==sizeof(char));
- memcpy(&temp1_char, mem1, sizeof(char));
- memcpy(&temp2_char, mem2, sizeof(char));
- /* -d and !-p */
- if (options->d && !options->p)
- {
- if (abs(temp1_char-temp2_char) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!options->d && options->p)
- {
- if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char),
- abs(1-temp2_char/temp1_char));
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if ( options->d && options->p)
- {
- if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent &&
- abs(temp1_char-temp2_char) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char),
- abs(1-temp2_char/temp1_char));
- }
- nfound++;
- }
- }
- else if (temp1_char != temp2_char)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
- }
- nfound++;
- }
-
- } /*H5T_NATIVE_SCHAR*/
+ } /*H5T_NATIVE_USHORT*/
-/*-------------------------------------------------------------------------
- * H5T_NATIVE_UCHAR
- *-------------------------------------------------------------------------
- */
- else if (H5Tequal(m_type, H5T_NATIVE_UCHAR))
- {
- unsigned char temp1_uchar;
- unsigned char temp2_uchar;
- assert(type_size==sizeof(unsigned char));
-
- memcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- memcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- /* -d and !-p */
- if (options->d && !options->p)
- {
- if (abs(temp1_uchar-temp2_uchar) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!options->d && options->p)
- {
- if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar),
- abs(1-temp2_uchar/temp1_uchar));
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if ( options->d && options->p)
- {
- if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent &&
- abs(temp1_uchar-temp2_uchar) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar),
- abs(1-temp2_uchar/temp1_uchar));
- }
- nfound++;
- }
- }
- else if (temp1_uchar != temp2_uchar)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
- }
- nfound++;
- }
-
- } /*H5T_NATIVE_UCHAR*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
-/*-------------------------------------------------------------------------
- * H5T_NATIVE_SHORT
- *-------------------------------------------------------------------------
- */
-
- else if (H5Tequal(m_type, H5T_NATIVE_SHORT))
- {
- short temp1_short;
- short temp2_short;
- assert(type_size==sizeof(short));
-
- memcpy(&temp1_short, mem1, sizeof(short));
- memcpy(&temp2_short, mem2, sizeof(short));
- /* -d and !-p */
- if (options->d && !options->p)
- {
- if (abs(temp1_short-temp2_short) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!options->d && options->p)
- {
- if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short),
- abs(1-temp2_short/temp1_short));
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if ( options->d && options->p)
- {
- if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent &&
- abs(temp1_short-temp2_short) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short),
- abs(1-temp2_short/temp1_short));
- }
- nfound++;
- }
- }
- else if (temp1_short != temp2_short)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
- }
- nfound++;
- }
-
-
- } /*H5T_NATIVE_SHORT*/
-
-/*-------------------------------------------------------------------------
- * H5T_NATIVE_USHORT
- *-------------------------------------------------------------------------
- */
-
- else if (H5Tequal(m_type, H5T_NATIVE_USHORT))
- {
- unsigned short temp1_ushort;
- unsigned short temp2_ushort;
- assert(type_size==sizeof(short));
-
- memcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- memcpy(&temp2_ushort, mem2, sizeof(unsigned short));
- /* -d and !-p */
- if (options->d && !options->p)
- {
- if (abs(temp1_ushort-temp2_ushort) > options->delta)
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!options->d && options->p)
- {
- if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent )
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort),
- abs(1-temp2_ushort/temp1_ushort));
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if ( options->d && options->p)
- {
- if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent &&
- abs(temp1_ushort-temp2_ushort) > options->delta )
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort),
- abs(1-temp2_ushort/temp1_ushort));
- }
- nfound++;
- }
- }
- else if (temp1_ushort != temp2_ushort)
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort));
- }
- nfound++;
- }
-
-
- } /*H5T_NATIVE_USHORT*/
+ else if (H5Tequal(m_type, H5T_NATIVE_INT))
+ {
+ int temp1_int;
+ int temp2_int;
+ assert(type_size==sizeof(int));
+ memcpy(&temp1_int, mem1, sizeof(int));
+ memcpy(&temp2_int, mem2, sizeof(int));
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ if (abs(temp1_int-temp2_int) > options->delta)
+ {
-/*-------------------------------------------------------------------------
- * H5T_NATIVE_INT
- *-------------------------------------------------------------------------
- */
-
- else if (H5Tequal(m_type, H5T_NATIVE_INT))
- {
- int temp1_int;
- int temp2_int;
- assert(type_size==sizeof(int));
-
- memcpy(&temp1_int, mem1, sizeof(int));
- memcpy(&temp2_int, mem2, sizeof(int));
- /* -d and !-p */
- if (options->d && !options->p)
- {
- if (abs(temp1_int-temp2_int) > options->delta)
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
}
nfound++;
}
@@ -951,9 +947,9 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int),
- abs(1-temp2_int/temp1_int));
+
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int), abs(1-temp2_int/temp1_int));
}
nfound++;
}
@@ -968,9 +964,9 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int),
- abs(1-temp2_int/temp1_int));
+
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int), abs(1-temp2_int/temp1_int));
}
nfound++;
}
@@ -981,8 +977,8 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
}
nfound++;
}
@@ -1012,9 +1008,9 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(UIFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)));
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(UIFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)));
}
nfound++;
}
@@ -1028,9 +1024,9 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(UIPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)),
- abs((int)(1-temp2_uint/temp1_uint)));
+
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), abs((int)(1-temp2_uint/temp1_uint)));
}
nfound++;
}
@@ -1045,27 +1041,28 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(UIPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)),
- abs((int)(1-temp2_uint/temp1_uint)));
+
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), abs((int)(1-temp2_uint/temp1_uint)));
}
nfound++;
}
}
else if (temp1_uint != temp2_uint)
{
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(UIFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)));
- }
- nfound++;
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+
+ parallel_print(SPACES);
+ parallel_print(UIFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)));
+ }
+ nfound++;
}
-
-
-
+
+
+
} /*H5T_NATIVE_UINT*/
@@ -1091,8 +1088,8 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
+ parallel_print(SPACES);
+ parallel_print(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
}
nfound++;
}
@@ -1106,11 +1103,10 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long),
- labs(1-temp2_long/temp1_long));
+ parallel_print(SPACES);
+ parallel_print(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long), labs(1-temp2_long/temp1_long));
}
- nfound++;
+ nfound++;
}
}
/* -d and -p */
@@ -1122,26 +1118,25 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long),
- labs(1-temp2_long/temp1_long));
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long), labs(1-temp2_long/temp1_long));
}
nfound++;
}
}
else if (temp1_long != temp2_long)
{
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
- }
- nfound++;
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
+ }
+ nfound++;
}
-
+
} /*H5T_NATIVE_LONG*/
@@ -1168,8 +1163,8 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(ULIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)));
+ parallel_print(SPACES);
+ parallel_print(ULIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)));
}
nfound++;
}
@@ -1182,10 +1177,9 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(ULPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)),
- labs((long)(1-temp2_ulong/temp1_ulong)));
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)), labs((long)(1-temp2_ulong/temp1_ulong)));
}
nfound++;
}
@@ -1196,25 +1190,24 @@ hsize_t diff_datum(void *_mem1,
if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)options->percent &&
labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta )
{
-
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(ULPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)),
- labs((long)(1-temp2_ulong/temp1_ulong)));
- }
- nfound++;
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)), labs((long)(1-temp2_ulong/temp1_ulong)));
+ }
+ nfound++;
}
}
else if (temp1_ulong != temp2_ulong)
{
-
+
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(ULIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)));
+ parallel_print(SPACES);
+ parallel_print(ULIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)));
}
nfound++;
}
@@ -1244,8 +1237,8 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_llong,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)));
+ parallel_print(SPACES);
+ parallel_print(fmt_llong,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)));
}
nfound++;
}
@@ -1258,10 +1251,9 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_llongp,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)),
- (long_long)labs((long)(1-temp2_llong/temp1_llong)));
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_llongp,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)), (long_long)labs((long)(1-temp2_llong/temp1_llong)));
}
nfound++;
}
@@ -1269,29 +1261,29 @@ hsize_t diff_datum(void *_mem1,
/* -d and -p */
else if ( options->d && options->p)
{
- if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options->percent &&
- labs((long)(temp1_llong-temp2_llong)) > (long)options->delta )
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_llongp,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)),
- (long_long)labs((long)(1-temp2_llong/temp1_llong)));
- }
- nfound++;
- }
+ if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options->percent &&
+ labs((long)(temp1_llong-temp2_llong)) > (long)options->delta )
+ {
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_llongp,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)), (long_long)labs((long)(1-temp2_llong/temp1_llong)));
+ }
+ nfound++;
+ }
}
else if (temp1_llong != temp2_llong)
{
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_llong,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)));
- }
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+
+ parallel_print(SPACES);
+ parallel_print(fmt_llong,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)));
+ }
nfound++;
}
@@ -1320,9 +1312,8 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_ullong,temp1_ullong,temp2_ullong,
- (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)));
+ parallel_print(SPACES);
+ parallel_print(fmt_ullong,temp1_ullong,temp2_ullong, (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)));
}
nfound++;
}
@@ -1336,10 +1327,8 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_ullongp,temp1_ullong,temp2_ullong,
- (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)),
- (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong)));
+ parallel_print(SPACES);
+ parallel_print(fmt_ullongp,temp1_ullong,temp2_ullong, (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong)));
}
nfound++;
}
@@ -1354,10 +1343,9 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_ullongp,temp1_ullong,temp2_ullong,
- (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)),
- (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong)));
+
+ parallel_print(SPACES);
+ parallel_print(fmt_ullongp,temp1_ullong,temp2_ullong, (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong)));
}
nfound++;
}
@@ -1368,9 +1356,8 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_ullong,temp1_ullong,temp2_ullong,
- (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)));
+ parallel_print(SPACES);
+ parallel_print(fmt_ullong,temp1_ullong,temp2_ullong, (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)));
}
nfound++;
}
@@ -1379,260 +1366,260 @@ hsize_t diff_datum(void *_mem1,
break; /* H5T_INTEGER class */
- case H5T_FLOAT:
+ case H5T_FLOAT:
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
-/*-------------------------------------------------------------------------
- * H5T_NATIVE_FLOAT
- *-------------------------------------------------------------------------
- */
-
if (H5Tequal(m_type, H5T_NATIVE_FLOAT))
{
- float temp1_float;
- float temp2_float;
- assert(type_size==sizeof(float));
-
- memcpy(&temp1_float, mem1, sizeof(float));
- memcpy(&temp2_float, mem2, sizeof(float));
+ float temp1_float;
+ float temp2_float;
+ assert(type_size==sizeof(float));
+ memcpy(&temp1_float, mem1, sizeof(float));
+ memcpy(&temp2_float, mem2, sizeof(float));
- /* -d and !-p */
- if (options->d && !options->p)
- {
- if (fabs(temp1_float-temp2_float) > options->delta)
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!options->d && options->p)
- {
- if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent )
- {
-
- if ( print_data(options) )
+
+ /* -d and !-p */
+ if (options->d && !options->p)
{
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float),
- fabs(1-temp2_float/temp1_float));
+ if (fabs(temp1_float-temp2_float) > options->delta)
+ {
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
+ }
+ nfound++;
+ }
}
- nfound++;
- }
- }
- /* -d and -p */
- else if ( options->d && options->p)
- {
- if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent &&
- fabs(temp1_float-temp2_float) > options->delta )
- {
-
- if ( print_data(options) )
+ /* !-d and -p */
+ else if (!options->d && options->p)
{
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float),
- fabs(1-temp2_float/temp1_float));
+ if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent )
+ {
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float), fabs(1-temp2_float/temp1_float));
+ }
+ nfound++;
+ }
}
- nfound++;
- }
- }
- else if (temp1_float != temp2_float)
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
- }
- nfound++;
- }
- } /*H5T_NATIVE_FLOAT*/
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent &&
+ fabs(temp1_float-temp2_float) > options->delta )
+ {
-/*-------------------------------------------------------------------------
- * H5T_NATIVE_DOUBLE
- *-------------------------------------------------------------------------
- */
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+
+ parallel_print(SPACES);
+ parallel_print(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float), fabs(1-temp2_float/temp1_float));
+ }
+ nfound++;
+ }
+ }
+ else if (temp1_float != temp2_float)
+ {
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+
+ parallel_print(SPACES);
+ parallel_print(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
+ }
+ nfound++;
+ }
+
+ } /*H5T_NATIVE_FLOAT*/
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
+
+ else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
+ {
+ double temp1_double;
+ double temp2_double;
+ assert(type_size==sizeof(double));
+
+ memcpy(&temp1_double, mem1, sizeof(double));
+ memcpy(&temp2_double, mem2, sizeof(double));
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ if (fabs(temp1_double-temp2_double) > options->delta)
+ {
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
+ }
+ nfound++;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent )
+ {
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double), fabs(1-temp2_double/temp1_double));
+ }
+ nfound++;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent &&
+ fabs(temp1_double-temp2_double) > options->delta )
+ {
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+
+ parallel_print(SPACES);
+ parallel_print(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double), fabs(1-temp2_double/temp1_double));
+ }
+ nfound++;
+ }
+ }
+ else if (temp1_double != temp2_double)
+ {
+
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+
+ parallel_print(SPACES);
+ parallel_print(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
+
+ }
+ nfound++;
+ }
+
+ } /*H5T_NATIVE_DOUBLE*/
+
+
+ break; /* H5T_FLOAT class */
+
+ } /* switch */
+
+
+ return nfound;
+ }
+
+
+
+ /*-------------------------------------------------------------------------
+ * Function: diff_native_uchar
+ *
+ * Purpose: do a byte-by-byte comparison and print in numerical format
+ *
+ * Return: number of differences found
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: October 29, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+hsize_t diff_native_uchar(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t i,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph)
+{
+ hsize_t nfound=0; /* differences found */
+ unsigned char temp1_uchar;
+ unsigned char temp2_uchar;
+
+ memcpy(&temp1_uchar, mem1, sizeof(unsigned char));
+ memcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
- {
- double temp1_double;
- double temp2_double;
- assert(type_size==sizeof(double));
-
- memcpy(&temp1_double, mem1, sizeof(double));
- memcpy(&temp2_double, mem2, sizeof(double));
/* -d and !-p */
if (options->d && !options->p)
{
- if (fabs(temp1_double-temp2_double) > options->delta)
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
- }
- nfound++;
- }
+ if (abs(temp1_uchar-temp2_uchar) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
+ }
+ nfound++;
+ }
}
/* !-d and -p */
else if (!options->d && options->p)
{
- if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent )
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double),
- fabs(1-temp2_double/temp1_double));
- }
- nfound++;
- }
+ if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar), abs(1-temp2_uchar/temp1_uchar));
+ }
+ nfound++;
+ }
}
/* -d and -p */
else if ( options->d && options->p)
{
- if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent &&
- fabs(temp1_double-temp2_double) > options->delta )
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double),
- fabs(1-temp2_double/temp1_double));
- }
- nfound++;
- }
+ if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent &&
+ abs(temp1_uchar-temp2_uchar) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar), abs(1-temp2_uchar/temp1_uchar));
+ }
+ nfound++;
+ }
}
- else if (temp1_double != temp2_double)
+ else if (temp1_uchar != temp2_uchar)
{
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
- }
- nfound++;
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
+ }
+ nfound++;
}
-
- } /*H5T_NATIVE_DOUBLE*/
-
-
- break; /* H5T_FLOAT class */
-
- } /* switch */
-
-
- return nfound;
-}
-
-
-
-/*-------------------------------------------------------------------------
- * Function: diff_native_uchar
- *
- * Purpose: do a byte-by-byte comparison and print in numerical format
- *
- * Return: number of differences found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October 29, 2003
- *
- *-------------------------------------------------------------------------
- */
-
-hsize_t diff_native_uchar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t i,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-{
- hsize_t nfound=0; /* differences found */
- unsigned char temp1_uchar;
- unsigned char temp2_uchar;
-
- memcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- memcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- /* -d and !-p */
- if (options->d && !options->p)
- {
- if (abs(temp1_uchar-temp2_uchar) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!options->d && options->p)
- {
- if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar),
- abs(1-temp2_uchar/temp1_uchar));
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if ( options->d && options->p)
- {
- if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent &&
- abs(temp1_uchar-temp2_uchar) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar),
- abs(1-temp2_uchar/temp1_uchar));
- }
- nfound++;
- }
- }
- else if (temp1_uchar != temp2_uchar)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
- }
- nfound++;
- }
-
- return nfound;
+ return nfound;
}
@@ -1661,32 +1648,32 @@ hsize_t diff_char(unsigned char *mem1,
const char *obj2,
int *ph)
{
- hsize_t nfound=0; /* differences found */
- unsigned char temp1_uchar;
- unsigned char temp2_uchar;
-
- memcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- memcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+ hsize_t nfound=0; /* differences found */
+ unsigned char temp1_uchar;
+ unsigned char temp2_uchar;
- if (temp1_uchar != temp2_uchar)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(CFORMAT,temp1_uchar,temp2_uchar);
- }
- nfound++;
- }
-
- return nfound;
+ memcpy(&temp1_uchar, mem1, sizeof(unsigned char));
+ memcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+
+ if (temp1_uchar != temp2_uchar)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(CFORMAT,temp1_uchar,temp2_uchar);
+ }
+ nfound++;
+ }
+
+ return nfound;
}
/*-------------------------------------------------------------------------
- * Function: is_zero
+ * Function: is_zero
*
* Purpose: Determines if memory is initialized to all zero bytes.
*
@@ -1800,14 +1787,14 @@ static int diff_region(hid_t region1_id, hid_t region2_id)
/* start coordinates and opposite corner */
for (j = 0; j < ndims1; j++)
- printf("%s%lu", j ? "," : "(",
+ parallel_print("%s%lu", j ? "," : "(",
(unsigned long)ptdata1[i * 2 * ndims1 + j]);
for (j = 0; j < ndims1; j++)
- printf("%s%lu", j ? "," : ")-(",
+ parallel_print("%s%lu", j ? "," : ")-(",
(unsigned long)ptdata1[i * 2 * ndims1 + j + ndims1]);
- printf(")\n");
+ parallel_print(")\n");
}
#endif
@@ -1837,15 +1824,15 @@ static int diff_region(hid_t region1_id, hid_t region2_id)
{
int j;
- printf("%sPt%lu: " ,
+ parallel_print("%sPt%lu: " ,
i ? "," : "",
(unsigned long)i);
for (j = 0; j < ndims1; j++)
- printf("%s%lu", j ? "," : "(",
+ parallel_print("%s%lu", j ? "," : "(",
(unsigned long)(ptdata1[i * ndims1 + j]));
- printf(")");
+ parallel_print(")");
}
#endif
@@ -1868,131 +1855,131 @@ static int diff_region(hid_t region1_id, hid_t region2_id)
*-------------------------------------------------------------------------
*/
hsize_t diff_float(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph)
+
{
- hsize_t nfound=0; /* number of differences found */
- float temp1_float;
- float temp2_float;
- hsize_t i;
-
-
- /* -d and !-p */
- if (options->d && !options->p)
+ hsize_t nfound=0; /* number of differences found */
+ float temp1_float;
+ float temp2_float;
+ hsize_t i;
+
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_float, mem1, sizeof(float));
+ memcpy(&temp2_float, mem2, sizeof(float));
+
+ if (fabs(temp1_float-temp2_float) > options->delta)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_float, mem1, sizeof(float));
- memcpy(&temp2_float, mem2, sizeof(float));
-
- if (fabs(temp1_float-temp2_float) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
- }
- nfound++;
- }
- mem1+=sizeof(float);
- mem2+=sizeof(float);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
}
+ nfound++;
+ }
+ mem1+=sizeof(float);
+ mem2+=sizeof(float);
+ if (options->n && nfound>=options->count)
+ return nfound;
}
-
- /* !-d and -p */
- else if (!options->d && options->p)
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_float, mem1, sizeof(float));
+ memcpy(&temp2_float, mem2, sizeof(float));
+
+ if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_float, mem1, sizeof(float));
- memcpy(&temp2_float, mem2, sizeof(float));
-
- if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float),
- fabs(1-temp2_float/temp1_float));
- }
- nfound++;
- }
- mem1+=sizeof(float);
- mem2+=sizeof(float);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float),
+ fabs(1-temp2_float/temp1_float));
}
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
+ nfound++;
+ }
+ mem1+=sizeof(float);
+ mem2+=sizeof(float);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_float, mem1, sizeof(float));
+ memcpy(&temp2_float, mem2, sizeof(float));
+
+ if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent &&
+ fabs(temp1_float-temp2_float) > options->delta )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_float, mem1, sizeof(float));
- memcpy(&temp2_float, mem2, sizeof(float));
-
- if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent &&
- fabs(temp1_float-temp2_float) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float),
- fabs(1-temp2_float/temp1_float));
- }
- nfound++;
- }
- mem1+=sizeof(float);
- mem2+=sizeof(float);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float),
+ fabs(1-temp2_float/temp1_float));
}
- }
- else
+ nfound++;
+ }
+ mem1+=sizeof(float);
+ mem2+=sizeof(float);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_float, mem1, sizeof(float));
+ memcpy(&temp2_float, mem2, sizeof(float));
+
+ if (temp1_float != temp2_float)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_float, mem1, sizeof(float));
- memcpy(&temp2_float, mem2, sizeof(float));
-
- if (temp1_float != temp2_float)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
- }
- nfound++;
- }
-
- mem1+=sizeof(float);
- mem2+=sizeof(float);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
-
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(float);
+ mem2+=sizeof(float);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+
+ return nfound;
}
@@ -2007,132 +1994,132 @@ hsize_t diff_float(unsigned char *mem1,
*-------------------------------------------------------------------------
*/
hsize_t diff_double(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- int rank,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+ unsigned char *mem2,
+ hsize_t nelmts,
+ int rank,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph)
+
{
- hsize_t nfound=0; /* number of differences found */
- double temp1_double;
- double temp2_double;
- hsize_t i;
-
-
- /* -d and !-p */
- if (options->d && !options->p)
+ hsize_t nfound=0; /* number of differences found */
+ double temp1_double;
+ double temp2_double;
+ hsize_t i;
+
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_double, mem1, sizeof(double));
+ memcpy(&temp2_double, mem2, sizeof(double));
+
+ if (fabs(temp1_double-temp2_double) > options->delta)
+ {
+
+ if ( print_data(options) )
{
- memcpy(&temp1_double, mem1, sizeof(double));
- memcpy(&temp2_double, mem2, sizeof(double));
-
- if (fabs(temp1_double-temp2_double) > options->delta)
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
- }
- nfound++;
- }
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
}
+ nfound++;
+ }
+ mem1+=sizeof(double);
+ mem2+=sizeof(double);
+ if (options->n && nfound>=options->count)
+ return nfound;
}
-
- /* !-d and -p */
- else if (!options->d && options->p)
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_double, mem1, sizeof(double));
+ memcpy(&temp2_double, mem2, sizeof(double));
+
+ if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_double, mem1, sizeof(double));
- memcpy(&temp2_double, mem2, sizeof(double));
-
- if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double),
- fabs(1-temp2_double/temp1_double));
- }
- nfound++;
- }
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double),
+ fabs(1-temp2_double/temp1_double));
}
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
+ nfound++;
+ }
+ mem1+=sizeof(double);
+ mem2+=sizeof(double);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_double, mem1, sizeof(double));
+ memcpy(&temp2_double, mem2, sizeof(double));
+
+ if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent &&
+ fabs(temp1_double-temp2_double) > options->delta )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_double, mem1, sizeof(double));
- memcpy(&temp2_double, mem2, sizeof(double));
-
- if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent &&
- fabs(temp1_double-temp2_double) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double),
- fabs(1-temp2_double/temp1_double));
- }
- nfound++;
- }
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double),
+ fabs(1-temp2_double/temp1_double));
}
- }
- else
+ nfound++;
+ }
+ mem1+=sizeof(double);
+ mem2+=sizeof(double);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_double, mem1, sizeof(double));
+ memcpy(&temp2_double, mem2, sizeof(double));
+
+ if (temp1_double != temp2_double)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_double, mem1, sizeof(double));
- memcpy(&temp2_double, mem2, sizeof(double));
-
- if (temp1_double != temp2_double)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
- }
- nfound++;
- }
-
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
-
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(double);
+ mem2+=sizeof(double);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+
+ return nfound;
}
@@ -2179,8 +2166,8 @@ hsize_t diff_schar(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
}
nfound++;
}
@@ -2205,8 +2192,8 @@ hsize_t diff_schar(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char),
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char),
abs(1-temp2_char/temp1_char));
}
nfound++;
@@ -2233,8 +2220,8 @@ hsize_t diff_schar(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char),
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char),
abs(1-temp2_char/temp1_char));
}
nfound++;
@@ -2259,8 +2246,8 @@ hsize_t diff_schar(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
}
nfound++;
}
@@ -2319,8 +2306,8 @@ hsize_t diff_uchar(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
}
nfound++;
}
@@ -2346,8 +2333,8 @@ hsize_t diff_uchar(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar),
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar),
abs(1-temp2_uchar/temp1_uchar));
}
nfound++;
@@ -2374,8 +2361,8 @@ hsize_t diff_uchar(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar),
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar),
abs(1-temp2_uchar/temp1_uchar));
}
nfound++;
@@ -2400,8 +2387,8 @@ hsize_t diff_uchar(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar));
}
nfound++;
}
@@ -2461,8 +2448,8 @@ hsize_t diff_short(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
}
nfound++;
}
@@ -2488,8 +2475,8 @@ hsize_t diff_short(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short),
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short),
abs(1-temp2_short/temp1_short));
}
nfound++;
@@ -2518,8 +2505,8 @@ hsize_t diff_short(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short),
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short),
abs(1-temp2_short/temp1_short));
}
nfound++;
@@ -2544,8 +2531,8 @@ hsize_t diff_short(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
}
nfound++;
}
@@ -2603,8 +2590,8 @@ hsize_t diff_ushort(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort));
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort));
}
nfound++;
}
@@ -2630,8 +2617,8 @@ hsize_t diff_ushort(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort),
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort),
abs(1-temp2_ushort/temp1_ushort));
}
nfound++;
@@ -2660,8 +2647,8 @@ hsize_t diff_ushort(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort),
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort),
abs(1-temp2_ushort/temp1_ushort));
}
nfound++;
@@ -2686,8 +2673,8 @@ hsize_t diff_ushort(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort));
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort));
}
nfound++;
}
@@ -2726,124 +2713,124 @@ hsize_t diff_int(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- int temp1_int;
- int temp2_int;
- hsize_t i;
-
-
- /* -d and !-p */
- if (options->d && !options->p)
+ hsize_t nfound=0; /* number of differences found */
+ int temp1_int;
+ int temp2_int;
+ hsize_t i;
+
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_int, mem1, sizeof(int));
+ memcpy(&temp2_int, mem2, sizeof(int));
+
+ if (abs(temp1_int-temp2_int) > options->delta)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_int, mem1, sizeof(int));
- memcpy(&temp2_int, mem2, sizeof(int));
-
- if (abs(temp1_int-temp2_int) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
- }
- nfound++;
- }
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
}
-
+ nfound++;
+ }
+ mem1+=sizeof(int);
+ mem2+=sizeof(int);
+ if (options->n && nfound>=options->count)
+ return nfound;
}
-
- /* !-d and -p */
- else if (!options->d && options->p)
+
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_int, mem1, sizeof(int));
+ memcpy(&temp2_int, mem2, sizeof(int));
+
+ if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_int, mem1, sizeof(int));
- memcpy(&temp2_int, mem2, sizeof(int));
-
- if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int),
- abs(1-temp2_int/temp1_int));
- }
- nfound++;
- }
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int),
+ abs(1-temp2_int/temp1_int));
}
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
+ nfound++;
+ }
+ mem1+=sizeof(int);
+ mem2+=sizeof(int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_int, mem1, sizeof(int));
+ memcpy(&temp2_int, mem2, sizeof(int));
+
+ if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent &&
+ abs(temp1_int-temp2_int) > options->delta )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_int, mem1, sizeof(int));
- memcpy(&temp2_int, mem2, sizeof(int));
-
- if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent &&
- abs(temp1_int-temp2_int) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int),
- abs(1-temp2_int/temp1_int));
- }
- nfound++;
- }
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int),
+ abs(1-temp2_int/temp1_int));
}
-
- }
- else
+ nfound++;
+ }
+ mem1+=sizeof(int);
+ mem2+=sizeof(int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+ }
+ else
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_int, mem1, sizeof(int));
+ memcpy(&temp2_int, mem2, sizeof(int));
+
+ if (temp1_int != temp2_int)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_int, mem1, sizeof(int));
- memcpy(&temp2_int, mem2, sizeof(int));
-
- if (temp1_int != temp2_int)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
- }
- nfound++;
- }
-
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
-
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(int);
+ mem2+=sizeof(int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+
+ return nfound;
}
@@ -2869,124 +2856,124 @@ hsize_t diff_uint(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned int temp1_uint;
- unsigned int temp2_uint;
- hsize_t i;
-
-
- /* -d and !-p */
- if (options->d && !options->p)
+ hsize_t nfound=0; /* number of differences found */
+ unsigned int temp1_uint;
+ unsigned int temp2_uint;
+ hsize_t i;
+
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_uint, mem1, sizeof(unsigned int));
+ memcpy(&temp2_uint, mem2, sizeof(unsigned int));
+
+ if (abs(temp1_uint-temp2_uint) > options->delta)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_uint, mem1, sizeof(unsigned int));
- memcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- if (abs(temp1_uint-temp2_uint) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_uint,temp2_uint,abs(temp1_uint-temp2_uint));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_uint,temp2_uint,abs(temp1_uint-temp2_uint));
}
-
+ nfound++;
+ }
+ mem1+=sizeof(unsigned int);
+ mem2+=sizeof(unsigned int);
+ if (options->n && nfound>=options->count)
+ return nfound;
}
-
- /* !-d and -p */
- else if (!options->d && options->p)
+
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_uint, mem1, sizeof(unsigned int));
+ memcpy(&temp2_uint, mem2, sizeof(unsigned int));
+
+ if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_uint, mem1, sizeof(unsigned int));
- memcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_uint,temp2_uint,abs(temp1_uint-temp2_uint),
- abs(1-temp2_uint/temp1_uint));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uint,temp2_uint,abs(temp1_uint-temp2_uint),
+ abs(1-temp2_uint/temp1_uint));
}
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
+ nfound++;
+ }
+ mem1+=sizeof(unsigned int);
+ mem2+=sizeof(unsigned int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_uint, mem1, sizeof(unsigned int));
+ memcpy(&temp2_uint, mem2, sizeof(unsigned int));
+
+ if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent &&
+ abs(temp1_uint-temp2_uint) > options->delta )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_uint, mem1, sizeof(unsigned int));
- memcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent &&
- abs(temp1_uint-temp2_uint) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IPFORMAT,temp1_uint,temp2_uint,abs(temp1_uint-temp2_uint),
- abs(1-temp2_uint/temp1_uint));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IPFORMAT,temp1_uint,temp2_uint,abs(temp1_uint-temp2_uint),
+ abs(1-temp2_uint/temp1_uint));
}
-
- }
- else
+ nfound++;
+ }
+ mem1+=sizeof(unsigned int);
+ mem2+=sizeof(unsigned int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+ }
+ else
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_uint, mem1, sizeof(unsigned int));
+ memcpy(&temp2_uint, mem2, sizeof(unsigned int));
+
+ if (temp1_uint != temp2_uint)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_uint, mem1, sizeof(unsigned int));
- memcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- if (temp1_uint != temp2_uint)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(IFORMAT,temp1_uint,temp2_uint,abs(temp1_uint-temp2_uint));
- }
- nfound++;
- }
-
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
-
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(IFORMAT,temp1_uint,temp2_uint,abs(temp1_uint-temp2_uint));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(unsigned int);
+ mem2+=sizeof(unsigned int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+
+ return nfound;
}
@@ -3012,17 +2999,51 @@ hsize_t diff_long(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- long temp1_long;
- long temp2_long;
- hsize_t i;
-
-
- /* -d and !-p */
- if (options->d && !options->p)
+ hsize_t nfound=0; /* number of differences found */
+ long temp1_long;
+ long temp2_long;
+ hsize_t i;
+
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_long, mem1, sizeof(long));
+ memcpy(&temp2_long, mem2, sizeof(long));
+
+ if (labs(temp1_long-temp2_long) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(long);
+ mem2+=sizeof(long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
+ {
+ memcpy(&temp1_long, mem1, sizeof(long));
+ memcpy(&temp2_long, mem2, sizeof(long));
+
+ if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent )
+ {
+ if ( print_data(options) )
{
memcpy(&temp1_long, mem1, sizeof(long));
memcpy(&temp2_long, mem2, sizeof(long));
@@ -3032,8 +3053,8 @@ hsize_t diff_long(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
+ parallel_print(SPACES);
+ parallel_print(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
}
nfound++;
}
@@ -3042,43 +3063,56 @@ hsize_t diff_long(unsigned char *mem1,
if (options->n && nfound>=options->count)
return nfound;
}
-
+ nfound++;
+ }
+ mem1+=sizeof(long);
+ mem2+=sizeof(long);
+ if (options->n && nfound>=options->count)
+ return nfound;
}
-
- /* !-d and -p */
- else if (!options->d && options->p)
+
+
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_long, mem1, sizeof(long));
+ memcpy(&temp2_long, mem2, sizeof(long));
+
+ if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent &&
+ labs(temp1_long-temp2_long) > options->delta )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_long, mem1, sizeof(long));
- memcpy(&temp2_long, mem2, sizeof(long));
-
- if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long),
- labs(1-temp2_long/temp1_long));
- }
- nfound++;
- }
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long),
+ labs(1-temp2_long/temp1_long));
}
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
+ nfound++;
+ }
+ mem1+=sizeof(long);
+ mem2+=sizeof(long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+ }
+ else
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_long, mem1, sizeof(long));
+ memcpy(&temp2_long, mem2, sizeof(long));
+
+ if (temp1_long != temp2_long)
+ {
+ if ( print_data(options) )
{
memcpy(&temp1_long, mem1, sizeof(long));
memcpy(&temp2_long, mem2, sizeof(long));
@@ -3089,8 +3123,8 @@ hsize_t diff_long(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long),
+ parallel_print(SPACES);
+ parallel_print(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long),
labs(1-temp2_long/temp1_long));
}
nfound++;
@@ -3100,36 +3134,18 @@ hsize_t diff_long(unsigned char *mem1,
if (options->n && nfound>=options->count)
return nfound;
}
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- memcpy(&temp1_long, mem1, sizeof(long));
- memcpy(&temp2_long, mem2, sizeof(long));
-
- if (temp1_long != temp2_long)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
- }
- nfound++;
- }
-
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
-
- return nfound;
+ nfound++;
+ }
+
+ mem1+=sizeof(long);
+ mem2+=sizeof(long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+
+ return nfound;
}
@@ -3155,14 +3171,17 @@ hsize_t diff_ulong(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned long temp1_ulong;
- unsigned long temp2_ulong;
- hsize_t i;
-
-
- /* -d and !-p */
- if (options->d && !options->p)
+ hsize_t nfound=0; /* number of differences found */
+ unsigned long temp1_ulong;
+ unsigned long temp2_ulong;
+ hsize_t i;
+
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
for ( i = 0; i < nelmts; i++)
@@ -3175,8 +3194,8 @@ hsize_t diff_ulong(unsigned char *mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LIFORMAT,temp1_ulong,temp2_ulong,labs(temp1_ulong-temp2_ulong));
+ parallel_print(SPACES);
+ parallel_print(LIFORMAT,temp1_ulong,temp2_ulong,labs(temp1_ulong-temp2_ulong));
}
nfound++;
}
@@ -3187,92 +3206,94 @@ hsize_t diff_ulong(unsigned char *mem1,
}
}
-
- /* !-d and -p */
- else if (!options->d && options->p)
+
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_ulong, mem1, sizeof(unsigned long));
+ memcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+
+ if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- memcpy(&temp2_ulong, mem2, sizeof(unsigned long));
-
- if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LPIFORMAT,temp1_ulong,temp2_ulong,labs(temp1_ulong-temp2_ulong),
- labs(1-temp2_ulong/temp1_ulong));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LPIFORMAT,temp1_ulong,temp2_ulong,labs(temp1_ulong-temp2_ulong),
+ labs(1-temp2_ulong/temp1_ulong));
}
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long);
+ mem2+=sizeof(unsigned long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_ulong, mem1, sizeof(unsigned long));
+ memcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+
+ if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent &&
+ labs(temp1_ulong-temp2_ulong) > options->delta )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- memcpy(&temp2_ulong, mem2, sizeof(unsigned long));
-
- if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent &&
- labs(temp1_ulong-temp2_ulong) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LPIFORMAT,temp1_ulong,temp2_ulong,labs(temp1_ulong-temp2_ulong),
- labs(1-temp2_ulong/temp1_ulong));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LPIFORMAT,temp1_ulong,temp2_ulong,labs(temp1_ulong-temp2_ulong),
+ labs(1-temp2_ulong/temp1_ulong));
}
-
- }
- else
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long);
+ mem2+=sizeof(unsigned long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+ }
+ else
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_ulong, mem1, sizeof(unsigned long));
+ memcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+
+ if (temp1_ulong != temp2_ulong)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- memcpy(&temp2_ulong, mem2, sizeof(unsigned long));
-
- if (temp1_ulong != temp2_ulong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(LIFORMAT,temp1_ulong,temp2_ulong,labs(temp1_ulong-temp2_ulong));
- }
- nfound++;
- }
-
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
-
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LIFORMAT,temp1_ulong,temp2_ulong,labs(temp1_ulong-temp2_ulong));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(unsigned long);
+ mem2+=sizeof(unsigned long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+
+ return nfound;
}
@@ -3298,134 +3319,134 @@ hsize_t diff_llong(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- long_long temp1_llong;
- long_long temp2_llong;
- hsize_t i;
- static char fmt_llong[255];
- static char fmt_llongp[255];
-
- if (!fmt_llong[0]) {
- /* build default formats for long long types */
- sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
- sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
- }
-
-
- /* -d and !-p */
- if (options->d && !options->p)
+ hsize_t nfound=0; /* number of differences found */
+ long_long temp1_llong;
+ long_long temp2_llong;
+ hsize_t i;
+ static char fmt_llong[255];
+ static char fmt_llongp[255];
+
+ if (!fmt_llong[0]) {
+ /* build default formats for long long types */
+ sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n",
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n",
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ }
+
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_llong, mem1, sizeof(long_long));
+ memcpy(&temp2_llong, mem2, sizeof(long_long));
+
+ if (labs( (long) (temp1_llong-temp2_llong)) > options->delta)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_llong, mem1, sizeof(long_long));
- memcpy(&temp2_llong, mem2, sizeof(long_long));
-
- if (labs( (long) (temp1_llong-temp2_llong)) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_llong,temp1_llong,temp2_llong,labs((long)(temp1_llong-temp2_llong)));
- }
- nfound++;
- }
- mem1+=sizeof(long_long);
- mem2+=sizeof(long_long);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_llong,temp1_llong,temp2_llong,labs((long)(temp1_llong-temp2_llong)));
}
-
+ nfound++;
+ }
+ mem1+=sizeof(long_long);
+ mem2+=sizeof(long_long);
+ if (options->n && nfound>=options->count)
+ return nfound;
}
-
- /* !-d and -p */
- else if (!options->d && options->p)
+
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_llong, mem1, sizeof(long_long));
+ memcpy(&temp2_llong, mem2, sizeof(long_long));
+
+ if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_llong, mem1, sizeof(long_long));
- memcpy(&temp2_llong, mem2, sizeof(long_long));
-
- if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_llongp,temp1_llong,temp2_llong,labs((long)(temp1_llong-temp2_llong)),
- labs((long)(1-temp2_llong/temp1_llong)));
- }
- nfound++;
- }
- mem1+=sizeof(long_long);
- mem2+=sizeof(long_long);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_llongp,temp1_llong,temp2_llong,labs((long)(temp1_llong-temp2_llong)),
+ labs((long)(1-temp2_llong/temp1_llong)));
}
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
+ nfound++;
+ }
+ mem1+=sizeof(long_long);
+ mem2+=sizeof(long_long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_llong, mem1, sizeof(long_long));
+ memcpy(&temp2_llong, mem2, sizeof(long_long));
+
+ if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent &&
+ labs((long)(temp1_llong-temp2_llong)) > options->delta )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_llong, mem1, sizeof(long_long));
- memcpy(&temp2_llong, mem2, sizeof(long_long));
-
- if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent &&
- labs((long)(temp1_llong-temp2_llong)) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_llongp,temp1_llong,temp2_llong,labs((long)(temp1_llong-temp2_llong)),
- labs((long)(1-temp2_llong/temp1_llong)));
- }
- nfound++;
- }
- mem1+=sizeof(long_long);
- mem2+=sizeof(long_long);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_llongp,temp1_llong,temp2_llong,labs((long)(temp1_llong-temp2_llong)),
+ labs((long)(1-temp2_llong/temp1_llong)));
}
-
- }
- else
+ nfound++;
+ }
+ mem1+=sizeof(long_long);
+ mem2+=sizeof(long_long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+ }
+ else
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_llong, mem1, sizeof(long_long));
+ memcpy(&temp2_llong, mem2, sizeof(long_long));
+
+ if (temp1_llong != temp2_llong)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_llong, mem1, sizeof(long_long));
- memcpy(&temp2_llong, mem2, sizeof(long_long));
-
- if (temp1_llong != temp2_llong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_llong,temp1_llong,temp2_llong,labs((long)(temp1_llong-temp2_llong)));
- }
- nfound++;
- }
-
- mem1+=sizeof(long_long);
- mem2+=sizeof(long_long);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
-
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_llong,temp1_llong,temp2_llong,labs((long)(temp1_llong-temp2_llong)));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(long_long);
+ mem2+=sizeof(long_long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+
+ return nfound;
}
@@ -3449,135 +3470,135 @@ hsize_t diff_ullong(unsigned char *mem1,
const char *obj1,
const char *obj2,
int *ph)
-
+
{
- hsize_t nfound=0; /* number of differences found */
- unsigned long_long temp1_ullong;
- unsigned long_long temp2_ullong;
- hsize_t i;
- static char fmt_ullong[255];
- static char fmt_ullongp[255];
-
- if (!fmt_ullong[0]) {
- /* build default formats for long long types */
- sprintf(fmt_ullong, "%%%su %%%su %%%su\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
- sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
- }
-
-
- /* -d and !-p */
- if (options->d && !options->p)
+ hsize_t nfound=0; /* number of differences found */
+ unsigned long_long temp1_ullong;
+ unsigned long_long temp2_ullong;
+ hsize_t i;
+ static char fmt_ullong[255];
+ static char fmt_ullongp[255];
+
+ if (!fmt_ullong[0]) {
+ /* build default formats for long long types */
+ sprintf(fmt_ullong, "%%%su %%%su %%%su\n",
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n",
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ }
+
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long));
+ memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long));
+
+ if (labs((long)(temp1_ullong-temp2_ullong)) > options->delta)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long));
- memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long));
-
- if (labs((long)(temp1_ullong-temp2_ullong)) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_ullong,temp1_ullong,temp2_ullong,labs((long)(temp1_ullong-temp2_ullong)));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long_long);
- mem2+=sizeof(unsigned long_long);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_ullong,temp1_ullong,temp2_ullong,labs((long)(temp1_ullong-temp2_ullong)));
}
-
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long_long);
+ mem2+=sizeof(unsigned long_long);
+ if (options->n && nfound>=options->count)
+ return nfound;
}
-
- /* !-d and -p */
- else if (!options->d && options->p)
+
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long));
+ memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long));
+
+ if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long));
- memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long));
-
- if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_ullongp,temp1_ullong,temp2_ullong,labs((long)(temp1_ullong-temp2_ullong)),
- labs((long)(1-temp2_ullong/temp1_ullong)));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long_long);
- mem2+=sizeof(unsigned long_long);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_ullongp,temp1_ullong,temp2_ullong,labs((long)(temp1_ullong-temp2_ullong)),
+ labs((long)(1-temp2_ullong/temp1_ullong)));
}
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long_long);
+ mem2+=sizeof(unsigned long_long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long));
+ memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long));
+
+ if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent &&
+ labs((long)(temp1_ullong-temp2_ullong)) > options->delta )
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long));
- memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long));
-
- if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent &&
- labs((long)(temp1_ullong-temp2_ullong)) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_ullongp,temp1_ullong,temp2_ullong,labs((long)(temp1_ullong-temp2_ullong)),
- labs((long)(1-temp2_ullong/temp1_ullong)));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long_long);
- mem2+=sizeof(unsigned long_long);
- if (options->n && nfound>=options->count)
- return nfound;
+ print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_ullongp,temp1_ullong,temp2_ullong,labs((long)(temp1_ullong-temp2_ullong)),
+ labs((long)(1-temp2_ullong/temp1_ullong)));
}
-
- }
- else
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long_long);
+ mem2+=sizeof(unsigned long_long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+ }
+ else
+ {
+
+ for ( i = 0; i < nelmts; i++)
{
-
- for ( i = 0; i < nelmts; i++)
+ memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long));
+ memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long));
+
+ if (temp1_ullong != temp2_ullong)
+ {
+ if ( print_data(options) )
{
- memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long));
- memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long));
-
- if (temp1_ullong != temp2_ullong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
- printf(SPACES);
- printf(fmt_ullong,temp1_ullong,temp2_ullong,labs((long)(temp1_ullong-temp2_ullong)));
- }
- nfound++;
- }
-
- mem1+=sizeof(unsigned long_long);
- mem2+=sizeof(unsigned long_long);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
-
- return nfound;
+ print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(fmt_ullong,temp1_ullong,temp2_ullong,labs((long)(temp1_ullong-temp2_ullong)));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(unsigned long_long);
+ mem2+=sizeof(unsigned long_long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+
+ return nfound;
}
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index fb4343f..d1f18df 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -103,7 +103,7 @@ int diff_attr(hid_t loc1_id,
{
if (options->m_verbose)
{
- printf("Different name for attributes: <%s> and <%s>\n", name1, name2);
+ parallel_print("Different name for attributes: <%s> and <%s>\n", name1, name2);
}
H5Aclose(attr1_id);
H5Aclose(attr2_id);
@@ -178,7 +178,7 @@ int diff_attr(hid_t loc1_id,
buf1=(void *) HDmalloc((unsigned)(nelmts1*msize1));
buf2=(void *) HDmalloc((unsigned)(nelmts1*msize2));
if ( buf1==NULL || buf2==NULL){
- printf( "cannot read into memory\n" );
+ parallel_print( "cannot read into memory\n" );
goto error;
}
if (H5Aread(attr1_id,mtype1_id,buf1)<0)
@@ -197,7 +197,7 @@ int diff_attr(hid_t loc1_id,
/* always print name */
if (options->m_verbose)
{
- printf( "Attribute: <%s> and <%s>\n",name1,name2);
+ parallel_print( "Attribute: <%s> and <%s>\n",name1,name2);
nfound = diff_array(buf1,
buf2,
nelmts1,
@@ -234,7 +234,7 @@ int diff_attr(hid_t loc1_id,
options->m_quiet=0;
if (nfound)
{
- printf( "Attribute: <%s> and <%s>\n",name1,name2);
+ parallel_print( "Attribute: <%s> and <%s>\n",name1,name2);
nfound = diff_array(buf1,
buf2,
nelmts1,
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 0cc8324..a558987 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -13,6 +13,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5diff.h"
+#include "ph5diff.h"
#include "H5private.h"
#include "h5tools.h"
@@ -205,9 +206,9 @@ hsize_t diff_datasetid( hid_t dset1_id,
storage_size2=H5Dget_storage_size(dset2_id);
if (storage_size1<=0 && storage_size2<=0)
{
- if (options->m_verbose && obj1_name && obj2_name)
- printf("<%s> and <%s> are empty datasets\n", obj1_name, obj2_name);
- cmp=0;
+ if (options->m_verbose && obj1_name && obj2_name)
+ parallel_print("<%s> and <%s> are empty datasets\n", obj1_name, obj2_name);
+ cmp=0;
}
@@ -289,11 +290,12 @@ hsize_t diff_datasetid( hid_t dset1_id,
sign2=H5Tget_sign(m_type2);
if ( sign1 != sign2 )
{
- if (options->m_verbose && obj1_name) {
- printf("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1));
- printf("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
- }
- cmp=0;
+ if (options->m_verbose && obj1_name) {
+ parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1));
+ parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
+ }
+
+ cmp=0;
}
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index bbd1747..416e808 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -13,10 +13,37 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5diff.h"
+#include "ph5diff.h"
#include "H5private.h"
/*-------------------------------------------------------------------------
+ * Function: parallel_print
+ *
+ * Purpose: wrapper for printf for use in parallel mode.
+ *
+ * Programmer: Leon Arber
+ *
+ * Date: December 1, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+void parallel_print(const char* format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ if(!PARALLEL)
+ vprintf(format, ap);
+ else
+ outBuffOffset += vsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
+
+ va_end(ap);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: print_pos
*
* Purpose: convert an array index position to matrix notation
@@ -46,22 +73,22 @@ void print_pos( int *ph,
*ph=0;
if (per)
{
- printf("%-15s %-15s %-15s %-15s %-15s\n",
+ parallel_print("%-15s %-15s %-15s %-15s %-15s\n",
"position",
(obj1!=NULL) ? obj1 : " ",
(obj2!=NULL) ? obj2 : " ",
"difference",
"relative");
- printf("------------------------------------------------------------------------\n");
+ parallel_print("------------------------------------------------------------------------\n");
}
else
{
- printf("%-15s %-15s %-15s %-20s\n",
+ parallel_print("%-15s %-15s %-15s %-20s\n",
"position",
(obj1!=NULL) ? obj1 : " ",
(obj2!=NULL) ? obj2 : " ",
"difference");
- printf("------------------------------------------------------------\n");
+ parallel_print("------------------------------------------------------------\n");
}
}
@@ -72,12 +99,13 @@ void print_pos( int *ph,
}
assert( curr_pos == 0 );
- printf("[ " );
+ parallel_print("[ " );
for ( i = 0; i < rank; i++)
{
- HDfprintf(stdout,"%Hu ", pos[i] );
+ /* HDfprintf(stdout,"%Hu ", pos[i] ); */
+ parallel_print("%d ",(int) pos[i]);
}
- printf("]" );
+ parallel_print("]" );
}
/*-------------------------------------------------------------------------
@@ -94,13 +122,12 @@ void print_pos( int *ph,
void print_dims( int r, hsize_t *d )
{
int i;
- printf("[ " );
+ parallel_print("[ " );
for ( i=0; i<r; i++ )
- printf("%d ",(int)d[i] );
- printf("] " );
+ parallel_print("%d ",(int)d[i] );
+ parallel_print("] " );
}
-
/*-------------------------------------------------------------------------
* Function: print_type
*
diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h
new file mode 100644
index 0000000..cb28001
--- /dev/null
+++ b/tools/lib/ph5diff.h
@@ -0,0 +1,57 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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 files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _PH5DIFF_H__
+#define _PH5DIFF_H__
+
+
+#define OUTBUFF_SIZE 10000
+/* Send from manager to workers */
+#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
+
+/* Operational tags used to init and complete diff */
+#define MPI_TAG_END 6
+#define MPI_TAG_PARALLEL 7
+
+int g_nTasks;
+char outBuff[OUTBUFF_SIZE];
+unsigned int outBuffOffset;
+
+
+struct diff_args
+{
+ char name[256];
+ H5G_obj_t type;
+ diff_opt_t options;
+};
+
+#ifdef H5_HAVE_PARALLEL
+#define H5_HAVE_PH5DIFF 1
+#endif
+#ifdef H5_HAVE_PH5DIFF
+#define PARALLEL 1
+#include <mpi.h>
+
+#else
+#define PARALLEL 0
+#endif
+
+
+#endif /* _PH5DIFF_H__ */