Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Tobias Oed <tobias@physics.odu.edu>
Subject: Re: Optimal use of the L2 cache
Date: Fri, 15 Jun 2001 19:23:39 -0400	[thread overview]
Message-ID: <3B2A98FB.9C766616@physics.odu.edu> (raw)
In-Reply-To: rUvW6.1512$fi2.45180@news.cpqcorp.net

Hoff Hoffman wrote:
> 
> In article <3B2A74B6.5F18718A@physics.odu.edu>, Tobias Oed <tobias@physics.odu.edu> writes:
> 
>   Operating system, version, and platform?

Linux version 2.4.3-pre1 (root@gamow) (gcc version 2.95.2 19991024
(release)) #1 SMP Sun Mar 4 18:12:44 EST 2001

cpu                     : Alpha
cpu model               : EV67
cpu variation           : 7
cpu revision            : 0
cpu serial number       : 
system type             : Tsunami
system variation        : DP264
system revision         : 0
system serial number    : 
cycle frequency [Hz]    : 666666666 
timer frequency [Hz]    : 1024.00
page size [bytes]       : 8192
phys. address bits      : 44
max. addr. space #      : 255
BogoMIPS                : 1330.04
kernel unaligned acc    : 558589956
(pc=fffffc00004cab50,va=fffffc000056ec49)
user unaligned acc      : 63590241 (pc=2000000eb80,va=2000027f2cc)
platform string         : AlphaPC 264DP 666 MHz
cpus detected           : 2
cpus active             : 2
cpu active mask         : 0000000000000003

I have two processors and use both of them to do my 
computation using a message passing mechanism. This 
is of no concern here since what I'm talking about is
running on a single processor. The message passing is
in a much lower level of looping.

>   Compiler and version?

Compaq C V6.2-504 on Linux 2.4.3-pre1 alpha
Compiler Driver V6.2-504 (Linux) cc Driver
Installed as ccc-6.2.9.504-2
SuSE Linux 7.0 (Alpha)
VERSION = 7.0
Using /usr/lib/gcc-lib/alpha-suse-linux/2.95.2 (2).

>   Compiler command(s) used?

CFLAGS=-fast -unroll 16 -std1 -msg_enable level4

>   Example of the code involved?

quick_table is my lookup table, iso_ff is the array in which 
I sum the result. There are six functions of the form:

void add_born(double mN,/* as well as mPi,ks,kv,s,sp,sp,tp,tm */
	double quick_table[4000],
	double iso_ff[16][6][2]
){
double redeno,imdeno,deno,recontri,imcontri;
double iso_coefs[6],contri[16];

redeno=(0);
imdeno=(-quick_table[30]);
deno=(quick_table[867])/(redeno*redeno+imdeno*imdeno);
redeno*=deno;
imdeno*=deno;

iso_coefs[0]=(quick_table[20]);
iso_coefs[1]=(-ks);
iso_coefs[2]=(0);
iso_coefs[3]=(0);
iso_coefs[4]=(quick_table[18]);
iso_coefs[5]=(-kv);

contri[0]=(quick_table[917]*quick_table[1826]);
contri[1]=(-(quick_table[16]*quick_table[1663]));
contri[2]=(0);
contri[3]=(0);
contri[4]=(0);
contri[5]=(0);
contri[6]=(0);
contri[7]=(0);
contri[8]=(tm*quick_table[1826]);
contri[9]=(quick_table[14]*quick_table[1746]);
contri[10]=(0);
contri[11]=(quick_table[1826]);
contri[12]=(mN*quick_table[4281]);
contri[13]=(quick_table[4076]/2.);
contri[14]=(-(quick_table[1449]*quick_table[1826]));
contri[15]=(-(mN*quick_table[1663]));

for(i=0;i<N_FORMFACTORS;i++){
        recontri=redeno*contri[i];
        imcontri=imdeno*contri[i];
        for(j=0;j<N_ISOSPIN;j++){
                iso_ff[i][j][RE]+=recontri*iso_coefs[j];
                iso_ff[i][j][IM]+=imcontri*iso_coefs[j];
        }
}

(This loop gets fully unrolled).

This is repeated ~300 times with differnt assignement to 
redeno, imdeno, the iso_coeof and the contri and the same loop.

> 
> :I have a piece of code that does a large amount of
> :floating point computations. In order to get it to
> :run faster, I build a lookup table of ~4000 floating
> :point values...
> 
>   You will want the floating point values naturally aligned.

I belive I can trust the compaq compiler to ensure that 
for me, can't I?

> :I access the elements of the table in a more or less random fashion
> :and am affraid that I get a terrible cache performance.
> 
>   Yes, you could be thrashing the cache.  Other considerations
>   include the floating point format and the data alignment...

Assuming that the data alignment is ok, how could I change the 
floating point format? Would using float instead of double get
some speed? Also, would VAX instead of IEEE floating point 
representation make a difference?

> :If I am not mistaken, my EV67 has 64k of L2 data cache...
> 
>   Which system do you have?
> 
> :How could I convince the processor to keep my arrays in that cache.
> 
>   I'd normally expect it to happen, unless something else is tossing
>   the pages out of cache -- eg: a lack of locality, excessive paging.

The problem is that my lookup table doesn't fit in a single 
page. 4000*8=32k a page is 8k. (correct??)

> :Would adding dummy values in the middle of the array help?
> 
>   That would not be my first choice.
> 
> :How big should the chunks of used values be and
> :how many dummy ones should I insert between them?
> 
>   You say you access the data randomly, and your comments imply
>   some sort of hashing...

I generated the code using mathematica. I also used mathematica
to find the elements in my lookup table. That's how I know which
element to use.

I hope this clarifies my problem a bit...
cheers, Tobias.


  reply	other threads:[~2001-06-15 23:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-15 20:48 Optimal use of the L2 cache Tobias Oed
2001-06-15 22:22 ` Hoff Hoffman
2001-06-15 23:23   ` Tobias Oed [this message]
2001-06-16  1:23     ` Hoff Hoffman
2001-06-16 17:42     ` Paul Hughett
2001-06-16 20:50       ` Tobias Oed
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