Where's the SPARK in my SPARC????

Brent Thomas Corkum corkum at csri.toronto.edu
Fri Feb 22 04:00:49 AEST 1991


We have 2 4D/25's and have just recieved a new SUN SPARCstation 2 GX in order to
port some C code from the Iris to the Sun. Our code is a boundary element 
stress analysis program, similar to finite elements in that you assemble
a matrix and solve it etc. Anyways, I ported my code, had to thange it
to K&R from Ansi because the default compiler that comes with the SUN
doesn't support Ansi (yet!!). So I compiled the program and ran it, and
did I get a surprise, it ran 6.5 times slower than the 4D/25. I thought the
SPARC2 was suppose to be 2-3 times faster in FLOPS.

Now for some information on what I did, I used the following compile statements


cc -float *.c -lm -o compute          -> SGI
cc -fsingle *.c -lm -o compute        -> SUN

Both machines have 16MB of memory and no swapping is occurring. I use floats
instead of doubles (thats why the -float and -fsingle). I'm using the 
default C compiler that comes with the SUN, but would like some information
regarding other C compilers if I can't get this straightened out.

Well, in an effort to make some sense of this problem I wrote a simple
test program to test performance. 

main()
{
  int i,j;
  float val,pi;

  pi = 3.141592654;
  val = 0.0;

  for(i=0;i<5000;++i){
    for(j=0;j<5000;++j){
      val += pi;
      val *= pi;
      val /= pi;
      val -= pi;
    }
  }
}

with the following results for float variables:

IRIS:

cc -float bm.c -o bmfs         42.8 sec cpu time (using "time bmfs").

SUN:

cc -fsingle bm.c -o bmfs         47.7 sec cpu time (using "time bmfs").


Now based on these the SGI is still a little faster ,not 6.5 times, 
but still faster. I would have expected the SUN to be at least twice
as fast. 

Now I tried the same program with double variables and guess what, the
SUN started performing a little better.

IRIS:

cc bm.c -o bm         74.0 sec cpu time (using "time bm").

SUN:

cc bm.c -o bm         62.8 sec cpu time (using "time bm").


Well not twice as fast but right now I'd take equality for my application.
Anyways, what this means , I don't know, I'm just a Civil Engineer trying
to run a stress analysis. 

So if someone out there can explain to me why all this is, it would
be much appreciated.  So far the SPARC is just taking up valuable
space, and I don't need anymore doorstops!

Brent Corkum
Civil Engineering
University of Toronto
Toronto Canada
corkum at boulder.civ.toronto.edu





More information about the Comp.sys.sgi mailing list