From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,7f84976ed48a7472 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 2001-06-15 16:23:41 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!demon!diablo.netcom.net.uk!netcom.net.uk!not-for-mail From: Tobias Oed Newsgroups: comp.sys.dec Subject: Re: Optimal use of the L2 cache Date: Fri, 15 Jun 2001 19:23:39 -0400 Organization: Old Dominion University Sender: tobias@physics.odu.edu Message-ID: <3B2A98FB.9C766616@physics.odu.edu> References: <3B2A74B6.5F18718A@physics.odu.edu> NNTP-Posting-Host: bernoulli.physics.odu.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: taliesin.netcom.net.uk 992647420 28726 128.82.242.52 (15 Jun 2001 23:23:40 GMT) X-Complaints-To: abuse@corp.netcom.net.uk NNTP-Posting-Date: Fri, 15 Jun 2001 23:23:40 +0000 (UTC) X-Mailer: Mozilla 4.77 [en] (X11; U; OSF1 V4.0 alpha) X-Accept-Language: en Xref: archiver1.google.com comp.sys.dec:4507 Hoff Hoffman wrote: > > In article <3B2A74B6.5F18718A@physics.odu.edu>, Tobias Oed 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 > :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.