From: Matti Aarnio <matti.aarnio@sonera.fi>
To: axp-list@redhat.com
Subject: Re: Binary search speed in Alpha
Date: Fri, 27 Nov 1998 10:58:31 +0200 (EET) [thread overview]
Message-ID: <19981127085841Z92268-18653+2@mea.tmt.tele.fi> (raw)
In-Reply-To: <13918.31089.348053.439622@flow.geo.vu.nl> from Jaap Schellekens at "Nov 27, 98 11:07:37 am"
> Hello all,
>
> I have a model of unsaturated flow which I try to optimize
> speedwise. I'm asking you this becuase we are in the process
> of getting one ore two new workstation for modelling and I would
> love to get an Alpha.
>
> >From profiling I concluded that most of the time is not spend
> in the matrix solving, but in the functions to construct the matrix.
> Basically I'm now looking at a method for searching a sorted table
> that has a better performance on an Alpha. I suspect the
> memory access pattern of the binary search I use does not
> favour the Alpha architecture a lot. Some numbers (seconds):
How large is the table ?
...
> From this i conclude:
> 1) libfm and libffm are a Good Thing Indeed!!
> 2) Somehow the binary search is not well optimized
> for the Alpha architecture
>
> I have tried several things, including changing the size of the look up
> tables but that has very little influence on the results. The same for
> changing the type of the tables from double to float.
Alpha's memory subsystem is very good at pulling in (and also
writing) large amounts of *sequential* data, in fact so good,
that you can get at least 10-20 sequential data entries in
within the time you do a *single* random walk step. (And you
may get even more dramatic boosts with SDRAM based 21164 systems,
I don't remember what the XL300 has in it.)
Consider: CPU is clocking at 500+ MHz, it issues two integer
instructions and one or two float instructions in parallel
in every cycle. The memory subsystem runs at 60 to 100 million
cycles per second during the SDRAM burst (128 to 2048 cycles per
burst). With wide busses (128 bits) the memory can barely stay
in par with processing speed. (Usually the CPU pipeline is
running idle waiting for data...)
So yes, surprisingly you could perhaps get best performance by
doing simple linear search. Of course the log(N) is better when
the N is very large, but up to N=100 (?) that might not be the case.
When you know that you are reading in large amounts of data,
you could perhaps sprinkle in assembly statements ordering
the memory subsystem to do pre-load of a burst of data into
the cache. The amount of data does exceed the amount of
L1 cache at the CPU ? Then timely preloads will help.
(So if you can't avoid blowing the cache away, do it at least
in a smart way.. You could even use loads which don't cache
at all, but getting them to burst properly is nightmarish..)
That preload trick is not quite simple, nor I have my reference
books with me now. But essentially:
preload(srcaddr)
for (...) {
preload(srcaddr+preload_stride)
scan_blob(srcaddr)
srcaddr += preload_stride
}
The scan processing must handle the amount of data given
in preload_stride, which in turn must be some power-of-2
given to the preload instruction, if I remember correctly.
These tricks should work with all processors, I think.
> Any suggestions (also pointers to books on this subject) are welcome,
> Jaap
> --
> Jaap Schellekens E-mail: schj@geo.vu.nl
/Matti Aarnio <matti.aarnio@sonera.fi>
next prev parent reply other threads:[~1998-11-27 10:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-11-27 10:07 Binary search speed in Alpha Jaap Schellekens
1998-11-27 8:58 ` Matti Aarnio [this message]
1998-11-27 13:27 ` Jaap Schellekens
1998-11-28 19:12 ` Bibek Sahu
1998-11-28 19:36 ` Jaap Schellekens
1998-11-28 20:46 ` Dave Gilbert
1998-11-29 16:54 ` Jaap Schellekens
1999-05-26 13:05 ` ElectricFence/Alpha Jaap Schellekens
1999-05-26 14:03 ` ElectricFence/Alpha Uncle George
1999-05-26 14:52 ` ElectricFence/Alpha Jaap Schellekens
1999-05-26 14:06 ` ElectricFence/Alpha Alvin Starr
1999-05-26 14:24 ` ElectricFence/Alpha Maciej W. Rozycki
1999-05-26 14:45 ` ElectricFence/Alpha Giuliano Procida
1999-05-26 14:56 ` ElectricFence/Alpha Mark Probst
-- strict thread matches above, loose matches on Subject: below --
1998-11-27 13:58 Binary search speed in Alpha Wessels, Hans
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