Subject: Bug in Sun CC

From: [email-masked] (David van der Spoel)
Date: Sun, 11 Aug 1996 22:01:59 +0200 (MET DST)

Hi.

I am running my MD code (Ansi-C plus a little Fortran)
on various platforms. Recently I found out that
on my Sun SparcStation 5 the code produces erroneous results. Moreover,
with the same input, results may be different from time to time. 
Note that I don't use any random generators or whatsoever. 
On a Sun SS-10 there is no problem (using the same executable),
and neither is there on a Silicon Graphics. 
The errors do only show up when optimization is set to -xO4, at -xO2
there is no problem either.

I have had similar problems with the GNU C compiler.

Did anyone ever find something similar ?
	
David van der Spoel
---------------------------------------------------------
EMAIL:	[email-masked]
WWW:	http://rugmd0.chem.rug.nl/~spoel
PHONE:	31-50-3634327	FAX: 31-50-3634800
MAIL:	Nijenborgh 4, 9747 AG Groningen, The Netherlands.
---------------------------------------------------------

---

From: Kenneth Geisshirt <[email-masked]>
Date: Sun, 11 Aug 1996 16:11:39 -0600 (MDT)

> there is no problem either.

How large is the error? Some compiler may violate the IEEE standard for
floating-point operations in order to get faster code. And then, there
might be problems. Check the man-page for that.

I guess it is a well-known problem that optimized code and non-optimized
code produce different results. If you have code like

  foo = x*y - x*z

it will be rearranged to

  foo = x*(y-z)

since multiplication is very slow. Due to round-off error, this might get
you a different result.

I don't know how your MD program works, but from your name I guess that it
is a parallel MD program (gromacs?). I have some experience with parallel
MD programs, so let me ask a few 'silly' questions:

(i) Do you get the same result with 1 processor and 2 processors at low
optimization?

(ii) Can you see the error after one time step? I.e. run only one time
step and see what happens. 

(iii) Is the error independent of integrator?

If you can answer NO to (i), you have a bug in the parallization. If you
can say YES to (ii) and (iii) it might be the force calculation, otherwise
it is the integrator. 

You have tried Sun and SGI, any other platforms? 

Best regards
  Kenneth

+-----------------------------------------------------------------+
| Kenneth Geisshirt                                 Ph.D.-student |
| Department of Life Sciences and Chemistry,  Roskilde University |
| Currently at: University of Colorado at Boulder                 |
+-----------------------------------------------------------------+
| E-mail: [email-masked]                                      | 
| Homepage: http://virgil.ruc.dk/~KNETH                           |
+-----------------------------------------------------------------+
|     Old chemists don't die - they just reach equilibrium        |
+-----------------------------------------------------------------+