From 469f6d30b1b6641f62bda85f31ca2b3c03dba428 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Thu, 26 Oct 2006 12:48:36 -0500 Subject: [svn-r12819] h5diff: print a message of "not comparable" in a case where the relative error compare is not possible, due to the denominator being zero. Modified the test file generator program to include a example for this and a new test on the shell script --- tools/h5diff/h5diffgentest.c | 42 ++- tools/h5diff/testh5diff.sh | 4 +- tools/lib/h5diff_array.c | 763 ++++++++++++++++++++++++++++++++++++++- tools/testfiles/h5diff_15.txt | 12 +- tools/testfiles/h5diff_16.txt | 25 +- tools/testfiles/h5diff_17.txt | 2 + tools/testfiles/h5diff_basic1.h5 | Bin 4336 -> 6416 bytes tools/testfiles/h5diff_basic2.h5 | Bin 4240 -> 4240 bytes 8 files changed, 812 insertions(+), 36 deletions(-) diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index e283043..fa4884f 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -129,17 +129,31 @@ int test_basic(const char *fname1, hid_t fid1, fid2; hid_t gid1, gid2, gid3; herr_t status; - hsize_t dims[2] = { 3,2 }; + hsize_t dims32[2] = { 3,2 }; + hsize_t dims42[2] = { 4,2 }; /* Test */ double data1[3][2] = {{1,1},{1,1},{1,1}}; double data2[3][2] = {{1,1.1},{1.01,1.001},{1.0001,1}}; - double data3[3][2] = {{100,110},{100,100},{100,100}}; - double data4[3][2] = {{110,100},{90,80},{140,200}}; int data5[3][2] = {{100,100},{100,100},{100,100}}; int data6[3][2] = {{101,102},{103,104},{150,200}}; unsigned long_long data7[3][2] = {{100,100},{100,100},{100,100}}; unsigned long_long data8[3][2] = {{101,102},{103,104},{150,200}}; + double data3[3][2] = {{100,100},{100,100},{100,100}}; + double data4[3][2] = {{105,120},{160,95},{80,40}}; + double data9[4][2] = {{100,100},{100,100},{100,100},{1,0}}; /* compare divide by zero */ + double data10[4][2] = {{105,120},{160,95},{80,40},{0,1}}; + /* +A B 1-B/A % +100 105 0.05 5 +100 120 0.2 20 +100 160 0.6 60 +100 95 0.05 5 +100 80 0.2 20 +100 40 0.6 60 +1 0 1 100 +0 1 #DIV/0! +*/ /*------------------------------------------------------------------------- * Create two files @@ -154,18 +168,22 @@ int test_basic(const char *fname1, gid2 = H5Gcreate(fid2, "g1", 0); gid3 = H5Gcreate(fid2, "g2", 0); - write_dset(gid1,2,dims,"dset1",H5T_NATIVE_DOUBLE,data1); - write_dset(gid2,2,dims,"dset2",H5T_NATIVE_DOUBLE,data2); - write_dset(gid1,2,dims,"dset3",H5T_NATIVE_DOUBLE,data3); - write_dset(gid2,2,dims,"dset4",H5T_NATIVE_DOUBLE,data4); - write_dset(gid2,2,dims,"dset1",H5T_NATIVE_DOUBLE,data2); + write_dset(gid1,2,dims32,"dset1",H5T_NATIVE_DOUBLE,data1); + write_dset(gid2,2,dims32,"dset2",H5T_NATIVE_DOUBLE,data2); + write_dset(gid1,2,dims32,"dset3",H5T_NATIVE_DOUBLE,data3); + write_dset(gid2,2,dims32,"dset4",H5T_NATIVE_DOUBLE,data4); + write_dset(gid2,2,dims32,"dset1",H5T_NATIVE_DOUBLE,data2); /* relative (int) */ - write_dset(gid1,2,dims,"dset5",H5T_NATIVE_INT,data5); - write_dset(gid1,2,dims,"dset6",H5T_NATIVE_INT,data6); + write_dset(gid1,2,dims32,"dset5",H5T_NATIVE_INT,data5); + write_dset(gid1,2,dims32,"dset6",H5T_NATIVE_INT,data6); /* relative (unsigned long_long) */ - write_dset(gid1,2,dims,"dset7",H5T_NATIVE_ULLONG,data7); - write_dset(gid1,2,dims,"dset8",H5T_NATIVE_ULLONG,data8); + write_dset(gid1,2,dims32,"dset7",H5T_NATIVE_ULLONG,data7); + write_dset(gid1,2,dims32,"dset8",H5T_NATIVE_ULLONG,data8); + + /* test divide by zero in percente case */ + write_dset(gid1,2,dims42,"dset9",H5T_NATIVE_DOUBLE,data9); + write_dset(gid1,2,dims42,"dset10",H5T_NATIVE_DOUBLE,data10); /*------------------------------------------------------------------------- * Close diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 697de8d..ce16ecc 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -284,8 +284,8 @@ TOOLTEST h5diff_14.txt $FILE1 $FILE2 -r g1/dset1 g1/dset2 # 1.5 with -d TOOLTEST h5diff_15.txt $FILE1 $FILE2 -r -d 5 g1/dset3 g1/dset4 -# 1.6 with -p -TOOLTEST h5diff_16.txt $FILE1 $FILE2 -r -p 0.05 g1/dset3 g1/dset4 +# 1.6 with -p (test divide by zero case) +TOOLTEST h5diff_16.txt $FILE1 $FILE1 g1/dset9 g1/dset10 -p 0.01 -v # 1.7 verbose mode TOOLTEST h5diff_17.txt $FILE1 $FILE2 -v diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 30aa852..89e0c4a 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -22,6 +22,7 @@ *------------------------------------------------------------------------- */ +#define COMP_0 #define F_FORMAT "%-15f %-15f %-15f\n" #define I_FORMAT "%-15d %-15d %-15d\n" #define C_FORMAT "%-16c %-17c\n" @@ -42,6 +43,18 @@ #define ULLI_FORMAT_P "%-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"d %-14f\n" #define SPACES " " +/* not comparable */ +#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n" +#define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n" +#define UI_FORMAT_P_NOTCOMP "%-15u %-15u %-15u not comparable\n" +#define LI_FORMAT_P_NOTCOMP "%-15ld %-15ld %-15ld not comparable\n" +#define ULI_FORMAT_P_NOTCOMP "%-15lu %-15lu %-15lu not comparable\n" +#define LLI_FORMAT_P_NOTCOMP "%-15"H5_PRINTF_LL_WIDTH"d %-15"H5_PRINTF_LL_WIDTH"d %-15"H5_PRINTF_LL_WIDTH"d not comparable\n" +#define ULLI_FORMAT_P_NOTCOMP "%-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"d not comparable\n" + + + + /*------------------------------------------------------------------------- * -p relative error formula *------------------------------------------------------------------------- @@ -66,7 +79,6 @@ static hsize_t character_compare_opt(unsigned char *mem1,unsigned char *mem2,hsi #ifdef NOT_YET #define EPSILON .0000001 static hbool_t equal_float(float value, float expected); -#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n" #endif @@ -759,6 +771,20 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_char,temp2_char); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, + fabs(temp1_char-temp2_char)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -776,6 +802,21 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_char,temp2_char); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, + fabs(temp1_char-temp2_char)); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent && abs(temp1_char-temp2_char) > options->delta ) { if ( print_data(options) ) @@ -832,6 +873,20 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_uchar,temp2_uchar); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, + fabs(temp1_uchar-temp2_uchar)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -849,6 +904,20 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_uchar,temp2_uchar); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, + fabs(temp1_uchar-temp2_uchar)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && abs(temp1_uchar-temp2_uchar) > options->delta ) { if ( print_data(options) ) @@ -907,6 +976,21 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_short,temp2_short); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, + fabs(temp1_short-temp2_short)); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent ) { if ( print_data(options) ) @@ -924,6 +1008,20 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_short,temp2_short); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, + fabs(temp1_short-temp2_short)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && abs(temp1_short-temp2_short) > options->delta ) { if ( print_data(options) ) @@ -983,6 +1081,20 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_ushort,temp2_ushort); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, + fabs(temp1_ushort-temp2_ushort)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -1000,6 +1112,20 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_ushort,temp2_ushort); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, + fabs(temp1_ushort-temp2_ushort)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && abs(temp1_ushort-temp2_ushort) > options->delta ) { if ( print_data(options) ) @@ -1057,6 +1183,20 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_int,temp2_int); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, + fabs(temp1_int-temp2_int)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -1075,6 +1215,20 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_int,temp2_int); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, + fabs(temp1_int-temp2_int)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && abs(temp1_int-temp2_int) > options->delta ) { if ( print_data(options) ) @@ -1132,6 +1286,21 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_uint,temp2_uint); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint, + fabs(temp1_uint-temp2_uint)); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent ) { if ( print_data(options) ) @@ -1149,6 +1318,20 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_uint,temp2_uint); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint, + fabs(temp1_uint-temp2_uint)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && abs((int)(temp1_uint-temp2_uint)) > options->delta ) { if ( print_data(options) ) @@ -1206,6 +1389,20 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_long,temp2_long); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, + fabs(temp1_long-temp2_long)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -1223,6 +1420,20 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_long,temp2_long); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, + fabs(temp1_long-temp2_long)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && labs(temp1_long-temp2_long) > (long)options->delta ) { if ( print_data(options) ) @@ -1279,6 +1490,20 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_ulong,temp2_ulong); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong, + fabs(temp1_ulong-temp2_ulong)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -1296,6 +1521,20 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_ulong,temp2_ulong); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong, + fabs(temp1_ulong-temp2_ulong)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta ) { if ( print_data(options) ) @@ -1355,6 +1594,20 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_llong,temp2_llong); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong, + (long_long)labs((long)(temp1_llong-temp2_llong))); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -1372,6 +1625,20 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_llong,temp2_llong); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong, + (long_long)labs((long)(temp1_llong-temp2_llong))); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && labs((long)(temp1_llong-temp2_llong)) > (long)options->delta ) { if ( print_data(options) ) @@ -1433,6 +1700,21 @@ hsize_t diff_datum(void *_mem1, ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent ) { @@ -1453,6 +1735,20 @@ hsize_t diff_datum(void *_mem1, ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && labs((long)(temp1_ullong-temp2_ullong)) > (long)options->delta ) { @@ -1516,6 +1812,9 @@ hsize_t diff_datum(void *_mem1, /* !-d and -p */ else if (!options->d && options->p) { + + +#if 0 if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent ) { @@ -1523,15 +1822,50 @@ hsize_t diff_datum(void *_mem1, { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_float,temp2_float,fabs(temp1_float-temp2_float), fabs(1-temp2_float/temp1_float)); + parallel_print(F_FORMAT_P,temp1_float,temp2_float,fabs(temp1_float-temp2_float), + fabs(1-temp2_float/temp1_float)); } nfound++; } } +#endif + + + PER(temp1_float,temp2_float); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, + fabs(temp1_float-temp2_float)); + options->not_cmp=1; + nfound++; + } + + else +#endif + + if ( per > options->percent && fabs(temp1_float-temp2_float) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_float,temp2_float, + fabs(temp1_float-temp2_float), + fabs(1-temp2_float/temp1_float)); + } + nfound++; + } + } /* -d and -p */ else if ( options->d && options->p) { + +#if 0 if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent && fabs(temp1_float-temp2_float) > options->delta ) { @@ -1540,11 +1874,44 @@ hsize_t diff_datum(void *_mem1, print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_float,temp2_float,fabs(temp1_float-temp2_float), fabs(1-temp2_float/temp1_float)); + parallel_print(F_FORMAT_P,temp1_float,temp2_float,fabs(temp1_float-temp2_float), + fabs(1-temp2_float/temp1_float)); } nfound++; } } +#endif + + PER(temp1_float,temp2_float); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, + fabs(temp1_float-temp2_float)); + options->not_cmp=1; + nfound++; + } + + else +#endif + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_float,temp2_float, + fabs(temp1_float-temp2_float), + fabs(1-temp2_float/temp1_float)); + } + nfound++; + } + } + else if (temp1_float != temp2_float) { @@ -1590,6 +1957,8 @@ hsize_t diff_datum(void *_mem1, /* !-d and -p */ else if (!options->d && options->p) { + +#if 0 if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent ) { if ( print_data(options) ) @@ -1601,9 +1970,44 @@ hsize_t diff_datum(void *_mem1, nfound++; } } +#endif + + PER(temp1_double,temp2_double); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + fabs(temp1_double-temp2_double)); + options->not_cmp=1; + nfound++; + } + + else +#endif + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,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 0 if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && fabs(temp1_double-temp2_double) > options->delta ) { @@ -1617,6 +2021,41 @@ hsize_t diff_datum(void *_mem1, nfound++; } } +#endif + + PER(temp1_double,temp2_double); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + fabs(temp1_double-temp2_double)); + options->not_cmp=1; + nfound++; + } + + else +#endif + + if ( per > 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(F_FORMAT_P,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) ) @@ -2145,7 +2584,7 @@ hsize_t diff_float(unsigned char *mem1, PER(temp1_float,temp2_float); -#ifdef NOT_YET +#ifdef COMP_0 if (per==-1) /* not comparable */ { print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); @@ -2153,6 +2592,7 @@ hsize_t diff_float(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, fabs(temp1_float-temp2_float)); options->not_cmp=1; + nfound++; } else @@ -2188,7 +2628,7 @@ hsize_t diff_float(unsigned char *mem1, PER(temp1_float,temp2_float); -#ifdef NOT_YET +#ifdef COMP_0 if (per==-1) /* not comparable */ { print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); @@ -2196,6 +2636,7 @@ hsize_t diff_float(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, fabs(temp1_float-temp2_float)); options->not_cmp=1; + nfound++; } else @@ -2316,6 +2757,21 @@ hsize_t diff_double(unsigned char *mem1, memcpy(&temp2_double, mem2, sizeof(double)); PER(temp1_double,temp2_double); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + fabs(temp1_double-temp2_double)); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent ) { if ( print_data(options) ) @@ -2345,6 +2801,21 @@ hsize_t diff_double(unsigned char *mem1, memcpy(&temp2_double, mem2, sizeof(double)); PER(temp1_double,temp2_double); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + fabs(temp1_double-temp2_double)); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent && fabs(temp1_double-temp2_double) > options->delta ) { if ( print_data(options) ) @@ -2458,6 +2929,21 @@ hsize_t diff_schar(unsigned char *mem1, memcpy(&temp2_char, mem2, sizeof(char)); PER(temp1_char,temp2_char); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, + fabs(temp1_char-temp2_char)); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent ) { if ( print_data(options) ) @@ -2487,6 +2973,21 @@ hsize_t diff_schar(unsigned char *mem1, memcpy(&temp2_char, mem2, sizeof(char)); PER(temp1_char,temp2_char); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, + fabs(temp1_char-temp2_char)); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent && abs(temp1_char-temp2_char) > options->delta ) { if ( print_data(options) ) @@ -2604,6 +3105,21 @@ hsize_t diff_uchar(unsigned char *mem1, memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); PER(temp1_uchar,temp2_uchar); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, + fabs(temp1_uchar-temp2_uchar)); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent ) { if ( print_data(options) ) @@ -2633,6 +3149,21 @@ hsize_t diff_uchar(unsigned char *mem1, memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); PER(temp1_uchar,temp2_uchar); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, + fabs(temp1_uchar-temp2_uchar)); + options->not_cmp=1; + nfound++; + } + + else +#endif + if ( per > options->percent && abs(temp1_uchar-temp2_uchar) > options->delta ) { if ( print_data(options) ) @@ -2748,6 +3279,20 @@ hsize_t diff_short(unsigned char *mem1, memcpy(&temp2_short, mem2, sizeof(short)); PER(temp1_short,temp2_short); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, + fabs(temp1_short-temp2_short)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -2779,6 +3324,20 @@ hsize_t diff_short(unsigned char *mem1, memcpy(&temp2_short, mem2, sizeof(short)); PER(temp1_short,temp2_short); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, + fabs(temp1_short-temp2_short)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && abs(temp1_short-temp2_short) > options->delta ) { if ( print_data(options) ) @@ -2894,6 +3453,20 @@ hsize_t diff_ushort(unsigned char *mem1, memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); PER(temp1_ushort,temp2_ushort); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, + fabs(temp1_ushort-temp2_ushort)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -2925,6 +3498,20 @@ hsize_t diff_ushort(unsigned char *mem1, memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); PER(temp1_ushort,temp2_ushort); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, + fabs(temp1_ushort-temp2_ushort)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && abs(temp1_ushort-temp2_ushort) > options->delta ) { if ( print_data(options) ) @@ -3041,6 +3628,20 @@ hsize_t diff_int(unsigned char *mem1, memcpy(&temp2_int, mem2, sizeof(int)); PER(temp1_int,temp2_int); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, + fabs(temp1_int-temp2_int)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -3072,6 +3673,20 @@ hsize_t diff_int(unsigned char *mem1, memcpy(&temp2_int, mem2, sizeof(int)); PER(temp1_int,temp2_int); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, + fabs(temp1_int-temp2_int)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && abs(temp1_int-temp2_int) > options->delta ) { if ( print_data(options) ) @@ -3188,6 +3803,20 @@ hsize_t diff_uint(unsigned char *mem1, memcpy(&temp2_uint, mem2, sizeof(unsigned int)); PER(temp1_uint,temp2_uint); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint, + fabs(temp1_uint-temp2_uint)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -3219,6 +3848,20 @@ hsize_t diff_uint(unsigned char *mem1, memcpy(&temp2_uint, mem2, sizeof(unsigned int)); PER(temp1_uint,temp2_uint); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint, + fabs(temp1_uint-temp2_uint)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && abs(temp1_uint-temp2_uint) > options->delta ) { if ( print_data(options) ) @@ -3338,6 +3981,20 @@ hsize_t diff_long(unsigned char *mem1, memcpy(&temp2_long, mem2, sizeof(long)); PER(temp1_long,temp2_long); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, + fabs(temp1_long-temp2_long)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -3369,6 +4026,20 @@ hsize_t diff_long(unsigned char *mem1, memcpy(&temp2_long, mem2, sizeof(long)); PER(temp1_long,temp2_long); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, + fabs(temp1_long-temp2_long)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && labs(temp1_long-temp2_long) > options->delta ) { if ( print_data(options) ) @@ -3492,6 +4163,20 @@ hsize_t diff_ulong(unsigned char *mem1, memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); PER(temp1_ulong,temp2_ulong); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong, + fabs(temp1_ulong-temp2_ulong)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -3523,6 +4208,20 @@ hsize_t diff_ulong(unsigned char *mem1, memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); PER(temp1_ulong,temp2_ulong); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong, + fabs(temp1_ulong-temp2_ulong)); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && labs(temp1_ulong-temp2_ulong) > options->delta ) { if ( print_data(options) ) @@ -3640,6 +4339,19 @@ hsize_t diff_llong(unsigned char *mem1, memcpy(&temp2_llong, mem2, sizeof(long_long)); PER(temp1_llong,temp2_llong); +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong, + (long_long)labs((long)(temp1_llong-temp2_llong))); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -3671,6 +4383,19 @@ hsize_t diff_llong(unsigned char *mem1, memcpy(&temp2_llong, mem2, sizeof(long_long)); PER(temp1_llong,temp2_llong); +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong, + (long_long)labs((long)(temp1_llong-temp2_llong))); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && labs((long)(temp1_llong-temp2_llong)) > options->delta ) { if ( print_data(options) ) @@ -3792,6 +4517,20 @@ hsize_t diff_ullong(unsigned char *mem1, ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent ) { if ( print_data(options) ) @@ -3825,6 +4564,20 @@ hsize_t diff_ullong(unsigned char *mem1, ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); + +#ifdef COMP_0 + if (per==-1) /* not comparable */ + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); + options->not_cmp=1; + nfound++; + } + + else +#endif if ( per > options->percent && labs((long)(temp1_ullong-temp2_ullong)) > options->delta ) { if ( print_data(options) ) diff --git a/tools/testfiles/h5diff_15.txt b/tools/testfiles/h5diff_15.txt index 7f47408..30f5aa2 100644 --- a/tools/testfiles/h5diff_15.txt +++ b/tools/testfiles/h5diff_15.txt @@ -4,10 +4,8 @@ Expected output for 'h5diff h5diff_basic1.h5 h5diff_basic2.h5 -r -d 5 g1/dset3 g Dataset: and position dset3 dset4 difference ------------------------------------------------------------ -[ 0 0 ] 100.000000 110.000000 10.000000 -[ 0 1 ] 110.000000 100.000000 10.000000 -[ 1 0 ] 100.000000 90.000000 10.000000 -[ 1 1 ] 100.000000 80.000000 20.000000 -[ 2 0 ] 100.000000 140.000000 40.000000 -[ 2 1 ] 100.000000 200.000000 100.000000 -6 differences found +[ 0 1 ] 100.000000 120.000000 20.000000 +[ 1 0 ] 100.000000 160.000000 60.000000 +[ 2 0 ] 100.000000 80.000000 20.000000 +[ 2 1 ] 100.000000 40.000000 60.000000 +4 differences found diff --git a/tools/testfiles/h5diff_16.txt b/tools/testfiles/h5diff_16.txt index 7e1ed34..a0855c3 100644 --- a/tools/testfiles/h5diff_16.txt +++ b/tools/testfiles/h5diff_16.txt @@ -1,13 +1,18 @@ ############################# -Expected output for 'h5diff h5diff_basic1.h5 h5diff_basic2.h5 -r -p 0.05 g1/dset3 g1/dset4' +Expected output for 'h5diff h5diff_basic1.h5 h5diff_basic1.h5 g1/dset9 g1/dset10 -p 0.01 -v' ############################# -Dataset: and -position dset3 dset4 difference relative +Dataset: and +position dset9 dset10 difference relative ------------------------------------------------------------------------ -[ 0 0 ] 100 110 10 0.1 -[ 0 1 ] 110 100 10 0.09090909091 -[ 1 0 ] 100 90 10 0.1 -[ 1 1 ] 100 80 20 0.2 -[ 2 0 ] 100 140 40 0.4 -[ 2 1 ] 100 200 100 1 -6 differences found +[ 0 0 ] 100 105 5 0.05 +[ 0 1 ] 100 120 20 0.2 +[ 1 0 ] 100 160 60 0.6 +[ 1 1 ] 100 95 5 0.05 +[ 2 0 ] 100 80 20 0.2 +[ 2 1 ] 100 40 60 0.6 +[ 3 0 ] 1 0 1 1 +[ 3 1 ] 0 1 1 not comparable +8 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- diff --git a/tools/testfiles/h5diff_17.txt b/tools/testfiles/h5diff_17.txt index ada1c0a..1119ebb 100644 --- a/tools/testfiles/h5diff_17.txt +++ b/tools/testfiles/h5diff_17.txt @@ -6,6 +6,7 @@ file1 file2 --------------------------------------- x x /g1 x x /g1/dset1 + x /g1/dset10 x /g1/dset2 x /g1/dset3 x /g1/dset4 @@ -13,6 +14,7 @@ file1 file2 x /g1/dset6 x /g1/dset7 x /g1/dset8 + x /g1/dset9 x /g2 Group: and diff --git a/tools/testfiles/h5diff_basic1.h5 b/tools/testfiles/h5diff_basic1.h5 index 7282220..58c399f 100644 Binary files a/tools/testfiles/h5diff_basic1.h5 and b/tools/testfiles/h5diff_basic1.h5 differ diff --git a/tools/testfiles/h5diff_basic2.h5 b/tools/testfiles/h5diff_basic2.h5 index 8f65bfe..aa7e81e 100644 Binary files a/tools/testfiles/h5diff_basic2.h5 and b/tools/testfiles/h5diff_basic2.h5 differ -- cgit v0.12