Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Performance measurements
@ 1998-06-24  8:51 Martin Kahlert
  1998-06-24  9:34 ` Robert Wilhelm
                   ` (4 more replies)
  0 siblings, 5 replies; 35+ messages in thread
From: Martin Kahlert @ 1998-06-24  8:51 UTC (permalink / raw)
  To: egcs; +Cc: axp-list

Hi,
i tried to compare different compilers on my numerical code.
Therefore i extracted a FPU intensive function and surrounded
it with a loop while measuring the execution time.

I will provide the source and the Makefile at the end of this mail.

I work on a Linux 2.0.34 SMP Kernel (libc5). My hardware is a
dual Pentium Pro 200MHz system with 128MB RAM.

pgcc is the portland group compiler and 
tcc the free Tendra compiler system
(from http://alph.dera.gov.uk/TenDRA/)

Here are my results:
%> make
pgcc:
90.11 MFLOPS
gcc-2.7.2.1:
95.46 MFLOPS
gcc-without double align:
23.52 MFLOPS
egcs-2.91.42:
69.96 MFLOPS
tcc:
92.33 MFLOPS

- The difference -malign-double makes on gcc-2.7.2.1 is very 
  impressive. On egcs it doesn't change the result.

- egcs seems to produce worse code than gcc-2.7.2.1
- During my experience, pgcc produces very good code and is very
  reliable. The code usually runs about 25% faster than egcs-code.
- For tcc i have to say, that the result is very dependent on the 
  order, you declare the variables:
  If you put the declarations int i,j; and double *wksph=wksp+n/2;
  in front of the one for c[], the result drops down to 24.70 MFLOPS.
  For all other compilers, this doesn't make much difference.

Could anybody comment on that?

If anyone is interested in the asm code that pgcc produces, i 
can send it offline (388 lines of asm statements are too 
long for the list)


For the axp list: It would be very kind, if anybody could provide
some values for a Linux Alpha (e.g. 533MHz) for comparison.

Thanks in advance,
Martin


Here is the testfile m.c:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>

#define N 1024

void trafo(double *a,const int n,double *wksp,double *const ops)
{
 double c[]={ 3.52262918857095333469e-02,
             -8.54412738820266443041e-02,
             -1.35011020010254584323e-01,
              4.59877502118491543470e-01,
              8.06891509311092547385e-01,
              3.32670552950082631938e-01 };
 int i,j;
 double *wksph=wksp+n/2;

 if(n<6)
    return;

 for(i=j=0;i<n/2-2;i++,j+=2)
    {wksph[i]= c[0]*a[j]+c[1]*a[j+1]
     +c[2]*a[j+2]+c[3]*a[j+3]
         +c[4]*a[j+4]+c[5]*a[j+5];
     wksp[i] = c[5]*a[j]-c[4]*a[j+1]
         +c[3]*a[j+2]-c[2]*a[j+3]
         +c[1]*a[j+4]-c[0]*a[j+5];
    }
 wksph[i]= c[0]*a[j]+c[1]*a[j+1]
     +c[2]*a[j+2]+c[3]*a[j+3]
     +c[4]*a[0]+c[5]*a[1];
 wksp[i] = c[5]*a[j]-c[4]*a[j+1]
     +c[3]*a[j+2]-c[2]*a[j+3]
     +c[1]*a[0]-c[0]*a[1];
 i++;j+=2;
 wksph[i]= c[0]*a[j]+c[1]*a[j+1]
     +c[2]*a[0]+c[3]*a[1]
     +c[4]*a[2]+c[5]*a[3];
 wksp[i] = c[5]*a[j]-c[4]*a[j+1]
     +c[3]*a[0]-c[2]*a[1]
     +c[1]*a[2]-c[0]*a[3];

 memcpy(a,wksp,sizeof(double)*n);
 (*ops)+=((double)11)*n;
 return;
}

int main(int argc,const char *argv[])
{
 double *x,h,ops=0;
 int i;
 clock_t start;

 if(!(x=malloc(2*N*sizeof(double))))
    {
     fputs("out of memory\n",stderr);
     return EXIT_FAILURE;
    }

 for(i=0;i<N;i++)
    {
     h=(double)i;
     x[i]=sin(h*PI/(double)N);
    }

 start=clock();
 for(i=0;i<10000;i++)
     trafo(x,N,x+N,&ops);
 h=(double)(clock()-start)/(double)CLOCKS_PER_SEC;
 printf("%.2f MFLOPS\n",1.0e-6*ops/h);

 free(x);
 return 0;
}

And here is the Makefile:

EXECUTABLES = m.pgcc m.egcs-2.91.42 m.gcc-2.7.2.1 m.not_aligned m.tcc
GCC_OPTS = -O3 -malign-double -fomit-frame-pointer -Wall -malign-loops=2 -malign-jumps=2 -malign-functions=2
all: $(EXECUTABLES) test
clean:
	rm -f  $(EXECUTABLES)
test:
	@echo "pgcc:"
	@m.pgcc
	@echo "gcc-2.7.2.1:"
	@m.gcc-2.7.2.1
	@echo "gcc-without double align:"
	@m.not_aligned
	@echo "egcs-2.91.42:"
	@m.egcs-2.91.42
	@echo "tcc:"
	@m.tcc
m.pgcc: m.c
	pgcc -O2 -tp p6 -Mnoframe -o $@ $< -lm
m.gcc-2.7.2.1: m.c
	/usr/bin/gcc $(GCC_OPTS) -o $@ $< -lm
m.not_aligned: m.c
	/usr/bin/gcc -O3 -fomit-frame-pointer -Wall -malign-loops=2 -malign-jumps=2 -malign-functions=2 -o $@ $< -lm
m.egcs-2.91.42: m.c
	/sw/egcs/bin/gcc $(GCC_OPTS) -o $@ $< -lm
m.tcc: m.c
	tcc -Ysystem -O2 -o $@ $< -lm


^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~1998-06-29 18:16 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-06-24  8:51 Performance measurements Martin Kahlert
1998-06-24  9:34 ` Robert Wilhelm
1998-06-24 19:54   ` Xsuse (Gloria X Server) Gavin
1998-06-24 20:50     ` B. James Phillippe
1998-06-24 23:29       ` Chris Ingrassia
1998-06-24 10:32 ` Performance measurements Stefan Schroepfer
1998-06-24 10:48   ` Martin Kahlert
1998-06-24 11:06     ` Martin Høy
1998-06-24 13:46     ` Stefan Schroepfer
1998-06-24 15:00       ` Robert Wilhelm
1998-06-24 15:16         ` Stefan Schroepfer
1998-06-25  7:46         ` Performance measurements (thanks and conclusion) Martin Kahlert
1998-06-24 15:25       ` Performance measurements Fabio Perroni
1998-06-24 15:28     ` Jeff Sturm
1998-06-24 15:59       ` Christopher C Chimelis
1998-06-24 17:19         ` Jeff Sturm
1998-06-24 18:12           ` Christopher C Chimelis
1998-06-24 19:05             ` Jeff Sturm
1998-06-24 20:38             ` Wes Bauske
1998-06-24 22:30               ` Jeff Sturm
1998-06-25  1:42               ` Richard Henderson
1998-06-25  1:48             ` Richard Henderson
1998-06-25 14:00               ` Jeff Sturm
1998-06-25 16:17                 ` Richard Henderson
1998-06-27 14:30             ` Volker Barthelmann
1998-06-28 16:41               ` Jeff Sturm
1998-06-28 23:01                 ` Volker Barthelmann
1998-06-29 18:11                   ` Jim Paradis
1998-06-29  5:14                 ` jrp
1998-06-24 16:05       ` Stefan Schroepfer
1998-06-24 16:58     ` Wes Bauske
1998-06-24 15:49 ` David S. Miller
     [not found] ` <Pine.GSO.3.96.980624190510.27225p-100000@markab.dbai.tuwien.ac.at>
1998-06-25  7:59   ` Martin Kahlert
1998-06-26  1:26 ` Ryan Kirkpatrick
1998-06-26 14:45   ` Chris Ingrassia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox