Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!charon!dik From: dik@cwi.nl (Dik T. Winter) Newsgroups: comp.sys.sgi Subject: Re: Where's the SPARK in my SPARC???? Message-ID: <3001@charon.cwi.nl> Date: 21 Feb 91 22:29:02 GMT References: <1991Feb21.120049.5626@jarvis.csri.toronto.edu> Sender: news@cwi.nl Organization: CWI, Amsterdam Lines: 31 In article <1991Feb21.120049.5626@jarvis.csri.toronto.edu> corkum@csri.toronto.edu (Brent Thomas Corkum) writes: > 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!!). This is part of the problem. > 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. ... > cc -float *.c -lm -o compute -> SGI > cc -fsingle *.c -lm -o compute -> SUN The major problem is that the -fsingle flag is nearly useless for original K&R C. Suppose you have a routine whose declaration reads: void rout(s) float s; { ... } this is effectively the same as declaring: void rout(s) double s; { ... } and within the routine all calculations involving s are effectively done in double rather than float *regardless to whether the -fsingle flag was used or not*. There is an undocumented feature of the C compiler: the flag -fsingle2. When you use that parameters are passed as floats and not as doubles (so this is not really K&R C). You might try to use that and see what happens. One warning though. Use of this flag also implies that all floats to standard library routines are not expanded to double (which they should), so you have to take care of that problem also (e.g. explicit casts to double). Hope this helps. -- dik t. winter, cwi, amsterdam, nederland dik@cwi.nl Brought to you by Super Global Mega Corp .com