* Re: Binary search speed in Alpha
1998-11-27 10:07 Binary search speed in Alpha Jaap Schellekens
@ 1998-11-27 8:58 ` Matti Aarnio
1998-11-27 13:27 ` Jaap Schellekens
0 siblings, 1 reply; 14+ messages in thread
From: Matti Aarnio @ 1998-11-27 8:58 UTC (permalink / raw)
To: axp-list
> 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>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Binary search speed in Alpha
@ 1998-11-27 10:07 Jaap Schellekens
1998-11-27 8:58 ` Matti Aarnio
0 siblings, 1 reply; 14+ messages in thread
From: Jaap Schellekens @ 1998-11-27 10:07 UTC (permalink / raw)
To: axp-list
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):
Arch TimeA TimeB TimeC
----------------------------------------------------------
pentium 293MMX (used to be 233): 19.1 37.1 -
Alpha XL300: 19.4 100.7 26.1
SPARC Ultra 170: 30.3 91.5 -
TimeA: run time with look-up tables
TimeB: run time original function
TimeB: run time original function using libfm and libffm
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.
Any suggestions (also pointers to books on this subject) are welcome,
Jaap
The code (based on an old -- freeware -- pascal version of numerical recipies):
double getval_short(TBL *tab, double xval)
{
unsigned long index,mid,lo,up,n;
int ascnd;
double top,bott,rico;
/* first check high and low points */
if (xval <= tab->x[0])
return tab->y[0];
else if (xval >= tab->x[(tab->points) - 1])
return tab->y[(tab->points) - 1];
/* Find position in array: x[index] < xval < x[index +1]*/
n = tab->points;
lo = -1; up = n;
ascnd = (tab->x[n - 1] >= tab->x[0]);
while (up - lo > 1){
mid = (up + lo) >> 1;
if (xval >= tab->x[mid] == ascnd)
lo = mid;
else
up = mid;
}
if ( xval == tab->x[0]) index = 0;
else if (xval == tab->x[n-1]) index = n - 2;
else index = lo;
/* linear interpolation */
top = (tab->y[index + 1] - tab->y[index]);
bott = (tab->x[index + 1] - tab->x[index]);
rico = top/bott;
return (rico * (xval - tab->x[index])) + tab->y[index];
}
--
--------------------------------------------------------------
Jaap Schellekens E-mail: schj@geo.vu.nl
Hydro(geo)logy Dept. Fax: ++31 20 6462457
Inst. of Earth Sc. Voice: ++31 20 4447287
Vrije Universiteit
De Boelelaan 1085 use finger schj@flow.geo.vu.nl
for extra information
1081 HV Amsterdam NL See also: http://flow.geo.vu.nl
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Binary search speed in Alpha
1998-11-27 8:58 ` Matti Aarnio
@ 1998-11-27 13:27 ` Jaap Schellekens
1998-11-28 19:12 ` Bibek Sahu
0 siblings, 1 reply; 14+ messages in thread
From: Jaap Schellekens @ 1998-11-27 13:27 UTC (permalink / raw)
To: axp-list
Matti Aarnio writes:
> > 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 ?
About 300 rows,
...
>
> 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.)
Plain fpram (128 bit wide)
> 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.
Tried that but it performs quite a lot slower. I forgot to mention
that I already keep the last position in the table as a starting
point becuase the answer is usually close to the previous one.
> the cache. The amount of data does exceed the amount of
> L1 cache at the CPU ? Then timely preloads will help.
I think that the 96kb should be enough..
> 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.
Sounds interesting if there are any refereces to book or other info
that describe how to do this please let me know.
Thanks a lot,
Jaap
--
--------------------------------------------------------------
Jaap Schellekens E-mail: schj@geo.vu.nl
Hydro(geo)logy Dept. Fax: ++31 20 6462457
Inst. of Earth Sc. Voice: ++31 20 4447287
Vrije Universiteit
De Boelelaan 1085 use finger schj@flow.geo.vu.nl
for extra information
1081 HV Amsterdam NL See also: http://flow.geo.vu.nl
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Binary search speed in Alpha
1998-11-27 13:27 ` Jaap Schellekens
@ 1998-11-28 19:12 ` Bibek Sahu
1998-11-28 19:36 ` Jaap Schellekens
1999-05-26 13:05 ` ElectricFence/Alpha Jaap Schellekens
0 siblings, 2 replies; 14+ messages in thread
From: Bibek Sahu @ 1998-11-28 19:12 UTC (permalink / raw)
To: axp-list
Assembly Language Programmer's Guide:
http://www.partner.digital.com/www-swdev/pages/Home/TECH/documents/Digital_UNIX/V4.0/AA-PS31D-TET1_html/TOC.html
Enjoy.
- Bob
On Fri, 27 Nov 1998, Jaap Schellekens wrote:
> Matti Aarnio writes:
> > > 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 ?
>
> About 300 rows,
> ...
> >
> > 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.)
>
> Plain fpram (128 bit wide)
>
> > 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.
>
> Tried that but it performs quite a lot slower. I forgot to mention
> that I already keep the last position in the table as a starting
> point becuase the answer is usually close to the previous one.
>
> > the cache. The amount of data does exceed the amount of
> > L1 cache at the CPU ? Then timely preloads will help.
>
> I think that the 96kb should be enough..
>
> > 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.
>
> Sounds interesting if there are any refereces to book or other info
> that describe how to do this please let me know.
>
> Thanks a lot,
>
> Jaap
>
> --
> --------------------------------------------------------------
> Jaap Schellekens E-mail: schj@geo.vu.nl
> Hydro(geo)logy Dept. Fax: ++31 20 6462457
> Inst. of Earth Sc. Voice: ++31 20 4447287
> Vrije Universiteit
> De Boelelaan 1085 use finger schj@flow.geo.vu.nl
> for extra information
> 1081 HV Amsterdam NL See also: http://flow.geo.vu.nl
>
> --
> To unsubscribe: send e-mail to axp-list-request@redhat.com with
> 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Binary search speed in Alpha
1998-11-28 19:12 ` Bibek Sahu
@ 1998-11-28 19:36 ` Jaap Schellekens
1998-11-28 20:46 ` Dave Gilbert
1999-05-26 13:05 ` ElectricFence/Alpha Jaap Schellekens
1 sibling, 1 reply; 14+ messages in thread
From: Jaap Schellekens @ 1998-11-28 19:36 UTC (permalink / raw)
To: axp-list
Bibek Sahu writes:
>
> Assembly Language Programmer's Guide:
> http://www.partner.digital.com/www-swdev/pages/Home/TECH/documents/Digital_UNIX/V4.0/AA-PS31D-TET1_html/TOC.html
Yep I know that it exists and most of it is on my local disk but the
lack of any education in computer sience is now catching up with me...
> Enjoy.
Slowly..
> - Bob
Jaap
--
--------------------------------------------------------------
Jaap Schellekens E-mail: schj@geo.vu.nl
Hydro(geo)logy Dept. Fax: ++31 20 6462457
Inst. of Earth Sc. Voice: ++31 20 4447287
Vrije Universiteit
De Boelelaan 1085 use finger schj@flow.geo.vu.nl
for extra information
1081 HV Amsterdam NL See also: http://flow.geo.vu.nl
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Binary search speed in Alpha
1998-11-28 19:36 ` Jaap Schellekens
@ 1998-11-28 20:46 ` Dave Gilbert
1998-11-29 16:54 ` Jaap Schellekens
0 siblings, 1 reply; 14+ messages in thread
From: Dave Gilbert @ 1998-11-28 20:46 UTC (permalink / raw)
To: axp-list
On Sat, 28 Nov 1998, Jaap Schellekens wrote:
> Bibek Sahu writes:
> >
> > Assembly Language Programmer's Guide:
> > http://www.partner.digital.com/www-swdev/pages/Home/TECH/documents/Digital_UNIX/V4.0/AA-PS31D-TET1_html/TOC.html
>
> Yep I know that it exists and most of it is on my local disk but the
> lack of any education in computer sience is now catching up with me...
Bah - I got that education after learning assembler; code and be happy.
Dave
P.S. The latest snap of EGCS skimmed over the 1MDhry/s on my 533MHz LX;
thats over 10% faster than a year ago, and easily 15% faster than GCC
2.7.2. Yes yes - I know - Dhrystone is meaningless.....
--------------------------------------------------------------------
/ Dr. David Alan Gilbert | Running Linux on Alpha(LX) | Happy \
\ gro.gilbert @ treblig.org | & ARM(EBSA285,old Arc) | In Hex /
\____________________________|___ http://www.treblig.demon.co.uk __/
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Binary search speed in Alpha
1998-11-28 20:46 ` Dave Gilbert
@ 1998-11-29 16:54 ` Jaap Schellekens
0 siblings, 0 replies; 14+ messages in thread
From: Jaap Schellekens @ 1998-11-29 16:54 UTC (permalink / raw)
To: axp-list
Dave Gilbert writes:
>
> P.S. The latest snap of EGCS skimmed over the 1MDhry/s on my 533MHz LX;
> thats over 10% faster than a year ago, and easily 15% faster than GCC
> 2.7.2. Yes yes - I know - Dhrystone is meaningless.....
Hmm, I think I need to dump egcs 1.0 and move on...
Thanks -- Jaap
--
--------------------------------------------------------------
Jaap Schellekens E-mail: schj@geo.vu.nl
Hydro(geo)logy Dept. Fax: ++31 20 6462457
Inst. of Earth Sc. Voice: ++31 20 4447287
Vrije Universiteit
De Boelelaan 1085 use finger schj@flow.geo.vu.nl
for extra information
1081 HV Amsterdam NL See also: http://flow.geo.vu.nl
^ permalink raw reply [flat|nested] 14+ messages in thread
* ElectricFence/Alpha
1998-11-28 19:12 ` Bibek Sahu
1998-11-28 19:36 ` Jaap Schellekens
@ 1999-05-26 13:05 ` Jaap Schellekens
1999-05-26 14:03 ` ElectricFence/Alpha Uncle George
` (4 more replies)
1 sibling, 5 replies; 14+ messages in thread
From: Jaap Schellekens @ 1999-05-26 13:05 UTC (permalink / raw)
To: axp-list
Ola,
Does anybody know if Bruce Perens' malloc debugger
works on Alpha/Linux? No Redhat packages are available (they
are for intel, and they saved me a number of times...)
which make me wonder if it is worth trying it on the alpha.
Thanks -- Jaap
--
|Jaap Schellekens | E-mail: schj@geo.vu.nl|
|Hydro(geo)logy Dept. | Fax: +31 20 6462457|
|Inst. of Earth Sc. | Voice: +31 20 4447287|
|Vrije Universiteit, De Boelelaan 1085, 1081 HV Amsterdam NL|
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ElectricFence/Alpha
1999-05-26 13:05 ` ElectricFence/Alpha Jaap Schellekens
@ 1999-05-26 14:03 ` Uncle George
1999-05-26 14:52 ` ElectricFence/Alpha Jaap Schellekens
1999-05-26 14:06 ` ElectricFence/Alpha Alvin Starr
` (3 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Uncle George @ 1999-05-26 14:03 UTC (permalink / raw)
To: axp-list
I used/use it to debug redhat linux alpha java. My problem with it is
not that it works, but rather that mem usage grows real large fairly
fast in particular witht the GUI/awt/X interface :(.
.
gat
Jaap Schellekens wrote:
> Ola,
>
> Does anybody know if Bruce Perens' malloc debugger
> works on Alpha/Linux? No Redhat packages are available (they
> are for intel, and they saved me a number of times...)
> which make me wonder if it is worth trying it on the alpha.
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ElectricFence/Alpha
1999-05-26 13:05 ` ElectricFence/Alpha Jaap Schellekens
1999-05-26 14:03 ` ElectricFence/Alpha Uncle George
@ 1999-05-26 14:06 ` Alvin Starr
1999-05-26 14:24 ` ElectricFence/Alpha Maciej W. Rozycki
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Alvin Starr @ 1999-05-26 14:06 UTC (permalink / raw)
To: axp-list
On Wed, 26 May 1999, Jaap Schellekens wrote:
> Does anybody know if Bruce Perens' malloc debugger
> works on Alpha/Linux? No Redhat packages are available (they
> are for intel, and they saved me a number of times...)
> which make me wonder if it is worth trying it on the alpha.
I at one point built and used ElectricFence-2.0.5-7.src.rpm. I cannot
remember if I made changes to get it to work or not? But it can be done.
Alvin Starr || voice: (416)585-9971
Interlink Connectivity || fax: (416)585-9974
alvin@iplink.net ||
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ElectricFence/Alpha
1999-05-26 13:05 ` ElectricFence/Alpha Jaap Schellekens
1999-05-26 14:03 ` ElectricFence/Alpha Uncle George
1999-05-26 14:06 ` ElectricFence/Alpha Alvin Starr
@ 1999-05-26 14:24 ` Maciej W. Rozycki
1999-05-26 14:45 ` ElectricFence/Alpha Giuliano Procida
1999-05-26 14:56 ` ElectricFence/Alpha Mark Probst
4 siblings, 0 replies; 14+ messages in thread
From: Maciej W. Rozycki @ 1999-05-26 14:24 UTC (permalink / raw)
To: axp-list
On Wed, 26 May 1999, Jaap Schellekens wrote:
> Does anybody know if Bruce Perens' malloc debugger
> works on Alpha/Linux? No Redhat packages are available (they
> are for intel, and they saved me a number of times...)
> which make me wonder if it is worth trying it on the alpha.
Of course, it works. I am using binaries I built using the source
package that is available at
"ftp://ftp.amg.gda.pl/pub/OS/Linux/people/macro/SRPMS.glibc21/ElectricFence-2.2.0-1.src.rpm",
but if you prefer compiling from a tarball you may get the sources from
"ftp://perens.com/pub/ElectricFence/" (there may be a newer version
available there -- I haven't checked it for a while).
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ElectricFence/Alpha
1999-05-26 13:05 ` ElectricFence/Alpha Jaap Schellekens
` (2 preceding siblings ...)
1999-05-26 14:24 ` ElectricFence/Alpha Maciej W. Rozycki
@ 1999-05-26 14:45 ` Giuliano Procida
1999-05-26 14:56 ` ElectricFence/Alpha Mark Probst
4 siblings, 0 replies; 14+ messages in thread
From: Giuliano Procida @ 1999-05-26 14:45 UTC (permalink / raw)
To: axp-list
On Wed, May 26, 1999 at 03:05:38PM +0200, Jaap Schellekens wrote:
> Does anybody know if Bruce Perens' malloc debugger
> works on Alpha/Linux? No Redhat packages are available (they
> are for intel, and they saved me a number of times...)
> which make me wonder if it is worth trying it on the alpha.
Source, Debian diffs and binaries are available on your favourite
Debian mirror. It seems to work fine. If you are desperate for a
binary you can unpack the .deb with ar and tar.
Giuliano.
-- myxie@debian.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ElectricFence/Alpha
1999-05-26 14:03 ` ElectricFence/Alpha Uncle George
@ 1999-05-26 14:52 ` Jaap Schellekens
0 siblings, 0 replies; 14+ messages in thread
From: Jaap Schellekens @ 1999-05-26 14:52 UTC (permalink / raw)
To: axp-list
On Wed, 26 May 1999, Uncle George wrote:
> I used/use it to debug redhat linux alpha java. My problem with it is
> not that it works, but rather that mem usage grows real large fairly
> fast in particular witht the GUI/awt/X interface :(.
Thanks for all the replys. I'll try and build it this evening.
And yes i know from experience that you _need_ to run the
programs from a debugger... I have spend hours waiting for
a 512Mb core dump over our slow network...
--
|Jaap Schellekens | E-mail: schj@geo.vu.nl|
|Hydro(geo)logy Dept. | Fax: +31 20 6462457|
|Inst. of Earth Sc. | Voice: +31 20 4447287|
|Vrije Universiteit, De Boelelaan 1085, 1081 HV Amsterdam NL|
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: ElectricFence/Alpha
1999-05-26 13:05 ` ElectricFence/Alpha Jaap Schellekens
` (3 preceding siblings ...)
1999-05-26 14:45 ` ElectricFence/Alpha Giuliano Procida
@ 1999-05-26 14:56 ` Mark Probst
4 siblings, 0 replies; 14+ messages in thread
From: Mark Probst @ 1999-05-26 14:56 UTC (permalink / raw)
To: axp-list
On Wed, May 26, 1999 at 03:05:38PM +0200, Jaap Schellekens wrote:
> Does anybody know if Bruce Perens' malloc debugger
> works on Alpha/Linux? No Redhat packages are available (they
> are for intel, and they saved me a number of times...)
> which make me wonder if it is worth trying it on the alpha.
it works fine for me.
bye
schani
--
Mark Probst
Student, Programmer
http://www.unix.cslab.tuwien.ac.at/~schani/
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~1999-05-26 15:38 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-11-27 10:07 Binary search speed in Alpha Jaap Schellekens
1998-11-27 8:58 ` Matti Aarnio
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox