[Beowulf] Re: the comparison between OpenMP and MPI

Tim Cutts tjrc at sanger.ac.uk
Mon May 21 10:12:11 PDT 2007


On 21 May 2007, at 5:19 pm, Florent Calvayrac wrote:

> I once discovered a bug in the Cray Fortran compiler for T3E.
> Without optimization the code was running fine but at O2/O3
> results were wrong. It turned out that some code lines I had  
> autogenerated
> from Maple were implying a large number of variables, exceeding
> the number of registers available and wrapping on the first register.
> Without optimization no registers were used so the code was giving
> correct results and at O1 code was optimized on a line per line basis
> and not procedure-wide.
>
> So even commercial code can be wrong...

Some code written here exposed an optimisation bug in Intel's C  
compiler about a year ago.  When I looked at the code, I wasn't  
surprised.  At first glance, my initial reaction was the same as the  
compiler's; "Oh, that's dead code, we can eliminate that".  Wrong!   
It was possible for the code to have an effect, but it was extremely  
indirect, and I didn't blame the compiler for screwing up!

The function in question was FSM_compile() in the following file:

http://cvs.sanger.ac.uk/cgi-bin/viewcvs.cgi/exonerate/src/struct/ 
fsm.c?rev=1.10&view=markup

You will see the last couple of lines in the function look as though  
they have no effect, at first glance, and the Intel compiler thought  
so too.  They've fixed the bug, since.  At the time the workaround  
was either to turn off optimisation altogether for this file, or to  
mark the variable 'out' as volatile.

Tim

PS.  I hasten to add this is not my code.  But it is run on our  
cluster a *lot*.  :-)



More information about the Beowulf mailing list