From: Stefan Schroepfer <scr@iis.fhg.de>
To: axp-list@redhat.com
Cc: martin.kahlert@mchp.siemens.de, robert@physiol.med.tu-muenchen.de
Subject: Re: Performance measurements
Date: Wed, 24 Jun 1998 15:46:02 +0200 [thread overview]
Message-ID: <3591031A.2781E494@iis.fhg.de> (raw)
In-Reply-To: 19980624124843.A15248@keksy.mchp.siemens.de
Martin Kahlert wrote:
>
> I thought, these convolution stuff should run like a champ
> on Alpha. But since even Digital's Compiler can't do much
> here, i think it's not egcs/gcc's fault.
> (Alex Rhomberg reported for a 500MHz Alpha:
> "DEC C V5.2-036 on Digital UNIX V4.0 (Rev. 564) 168.97 MFLOPS")
That's right. As this convolution consists of floating point
arithmetics only (besides loading / stroring), it should be
fast on the Alpha.
> Perhaps there could be done some tuning for memory
> access on Alphas? But: all arrays should fit in the cache -
> don't they?
I see only a single array in yout code, whose size is
2*1024*sizeof(double) = 16k. Note that the 21164 has a
L1 data cache of 8k. MFLOPS numbers from your code stay
the same with N=512 instead of 1024.
> There should be higher MFlops possible on these machines.
> Perhaps the factor two results from the fact, that there can't
> be done much more improvement on Intel chips any more.
> 100MFLOP are one mult/add every second cpu cycle on a 200MHz
> machine.
Improvement is possible, at least on Alphas. As a general rule
try to avoid superfluous array accesses, use more local variables
instead (which can more easily be mapped to registers by the
compiler).
I played around with your code and got a version which achives
324.00 MFLOPS now (compared to 187.86 MFLOPS with your code).
Note that in my version memcpy () takes 22.5 percent of total
computying time on my Alpha, so that your MFLOPS numbers are
too low as run time is measured overall.
I is now your part
- to verify that my version gives right results
- to let me know how my version performes on the PPro (especially
gcc and egcs compiled)
[Robert: could you please compile my code on your Alpha using
egcs and report your results to me]
Stefan Schroepfer
scr@iis.fhg.de
-----------------
#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 c0 = 3.52262918857095333469e-02;
double c1 = -8.54412738820266443041e-02;
double c2 = -1.35011020010254584323e-01;
double c3 = 4.59877502118491543470e-01;
double c4 = 8.06891509311092547385e-01;
double c5 = 3.32670552950082631938e-01;
int i,j;
double *wksph=wksp+n/2;
double lfT1, lfT2;
double lfA0, lfA1;
if(n<6)
return;
for(i=j=0;i<n/2-2;i++,j+=2)
{
/* 324.00 MFLOPS (reduced a[] - accesses) */
lfA0 = a[j]; lfA1 = a[j+1];
lfT1 = c0*lfA0 + c1*lfA1;
lfT2 = c5*lfA0 - c4*lfA1;
lfA0 = a[j+2]; lfA1 = a[j+3];
lfT1 += c2*lfA0 + c3*lfA1;
lfT2 += c3*lfA0 - c2*lfA1;
lfA0 = a[j+4]; lfA1 = a[j+5];
lfT1 += c4*lfA0 + c5*lfA1;
lfT2 += c1*lfA0 - c0*lfA1;
wksph[i] = lfT1;
wksp[i] = lfT2;
/* 191.28 MFLOPS (cx variables instead of array c[]) */
/*
wksph[i] = (c0*a[j] + c1*a[j+1] +
c2*a[j+2] + c3*a[j+3] +
c4*a[j+4] + c5*a[j+5]);
wksp[i] = (c5*a[j] - c4*a[j+1] +
c3*a[j+2] - c2*a[j+3] +
c1*a[j+4] - c0*a[j+5]);
*/
}
wksph[i] = (c0*a[j] + c1*a[j+1] +
c2*a[j+2] + c3*a[j+3] +
c4*a[0] + c5*a[1]);
wksp[i] = (c5*a[j] - c4*a[j+1] +
c3*a[j+2] - c2*a[j+3] +
c1*a[0] - c0*a[1]);
i++;j+=2;
wksph[i] = (c0*a[j] + c1*a[j+1] +
c2*a[0] + c3*a[1] +
c4*a[2] + c5*a[3]);
wksp[i] = (c5*a[j] - c4*a[j+1] +
c3*a[0] - c2*a[1] +
c1*a[2] - c0*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*M_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;
}
next prev parent reply other threads:[~1998-06-24 13:44 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox