[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Compiler question

> Hi,


> I compiled a program to perform relative rate tests on DNA sequences. It
> is supposed to tell me, whether sets of sequences do differ in their
> mutational rate or not.
> This program is available for Mac PPC as well as binary and I did some
> tests on the Mac and some on my Alpha. Besides the fact that the program
> does crash a lot, I encountered a weird thing: Using the same datasets,
> the two computers calculated different probability values. Now I am
> confronted with the problem which computer to trust! The data were
> supposed to be published!

Do you *ever* trust a computer ? ohh..... 8-)

> I did now some testing with one dataset only.
> The probability value that the tested DNA sequence differs from the
> others on the Mac was calculated to be 1.12497e-07.
> I tried then the compilates with both compilers available for Alpha:

[ various compile-command lines deleted.]

> In all the above cases the output was:
> exact probability (P): 1e-07

This is looks weird. Here are some first ideas:

1. Do you compile the source on Mac as well ? What OS/compiler was used ? 64bit PPC system ?
2. Did you verify against another platform ( like linux/x86 ) ?
3. Did you check the output functions for the values ? ( like printf etc ). 
4. Did you check for casts btw float and double ? Or are any other conversions used, like
    atof ?
5. How is the data stored ? if in a file, how is it read ?
6. Did you try gcc with -Wall ? Did you lint the program ?
7. With the various executables, you generated, did you check each with ldd, which libs they
    use ?
> As soon as -fast was included, the value changed:
> ccc -o crrtree -O3 -fast RRTree.c -lcpml -lffm -lm
> ccc -o crrtree -O3 -fast -ieee RRTree.c -lcpml -lffm -lm
> exact probability (P): 6.17021e-07

Hmm. As a guess, I would suspect implicit casts to be the problem.
> The probability values of the first compiling attempts are slightly
> lower than the one from the MacPPC. Can this be explained by 32 bit vs.
> 64 bit? 

Normally not. In both, 32bit and 64bit programming environments ( ILP32, LP64 ), like the
ones used in Linux, sizeof(double) is eight bytes and sizeof(float) is four bytes.
However, there might be some subtle issues with the internal representation of the values.

> And about -fast: It looks to me like this option is introducing a bug.

Don't call it a bug too fast. Since the program behaviour is odd enough without -fast, it's
hard to tell.

> What are the comments of the compiler and c-programming experts?

Without the source and the test-data, it's hard to tell. Is the source and a testdata-set available ?
is it big ? it might be worth, giving it a look.

> Regards,
> Kerstin


Thomas Weyergraf                                                kirk@colinet.de
My Favorite IA64 Opcode-guess ( see arch/ia64/lib/memset.S )
"br.ret.spnt.few" - got back from getting beer, did not spend a lot.

Reply to: